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_NoneAPIErrorZ
12 pub union CResult_NoneAPIErrorZPtr {
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 /// A pointer to the contents in the error state.
16 /// Reading from this pointer when `result_ok` is set is undefined.
17 pub err: *mut crate::lightning::util::errors::APIError,
20 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
21 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
22 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23 pub struct CResult_NoneAPIErrorZ {
24 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
25 /// `err` or `result` depending on the state of `result_ok`.
26 pub contents: CResult_NoneAPIErrorZPtr,
27 /// Whether this CResult_NoneAPIErrorZ represents a success state.
31 /// Creates a new CResult_NoneAPIErrorZ in the success state.
32 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
33 CResult_NoneAPIErrorZ {
34 contents: CResult_NoneAPIErrorZPtr {
35 result: core::ptr::null_mut(),
41 /// Creates a new CResult_NoneAPIErrorZ in the error state.
42 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
43 CResult_NoneAPIErrorZ {
44 contents: CResult_NoneAPIErrorZPtr {
45 err: Box::into_raw(Box::new(e)),
50 /// Checks if the given object is currently in the success state
52 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
56 /// Frees any resources used by the CResult_NoneAPIErrorZ.
57 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
58 impl Drop for CResult_NoneAPIErrorZ {
62 if unsafe { !(self.contents.err as *mut ()).is_null() } {
63 let _ = unsafe { Box::from_raw(self.contents.err) };
68 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
69 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
70 let contents = if o.result_ok {
71 let _ = unsafe { Box::from_raw(o.contents.result) };
72 o.contents.result = core::ptr::null_mut();
73 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
75 let err = unsafe { o.contents.err };
76 unsafe { o.contents.err = core::ptr::null_mut(); }
77 CResult_NoneAPIErrorZPtr { err }
81 result_ok: o.result_ok,
85 impl Clone for CResult_NoneAPIErrorZ {
86 fn clone(&self) -> Self {
88 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
89 result: core::ptr::null_mut()
92 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
93 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
99 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
100 /// but with all dynamically-allocated buffers duplicated in new buffers.
101 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
103 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
104 /// This corresponds to std::vector in C++
105 pub struct CVec_CResult_NoneAPIErrorZZ {
106 /// The elements in the array.
107 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
108 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
109 /// The number of elements pointed to by `data`.
112 impl CVec_CResult_NoneAPIErrorZZ {
113 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
114 if self.datalen == 0 { return Vec::new(); }
115 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
116 self.data = core::ptr::null_mut();
120 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
121 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
124 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
125 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
126 let datalen = v.len();
127 let data = Box::into_raw(v.into_boxed_slice());
128 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
132 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
133 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
134 impl Drop for CVec_CResult_NoneAPIErrorZZ {
136 if self.datalen == 0 { return; }
137 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
140 impl Clone for CVec_CResult_NoneAPIErrorZZ {
141 fn clone(&self) -> Self {
142 let mut res = Vec::new();
143 if self.datalen == 0 { return Self::from(res); }
144 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
149 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
150 /// This corresponds to std::vector in C++
151 pub struct CVec_APIErrorZ {
152 /// The elements in the array.
153 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
154 pub data: *mut crate::lightning::util::errors::APIError,
155 /// The number of elements pointed to by `data`.
158 impl CVec_APIErrorZ {
159 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
160 if self.datalen == 0 { return Vec::new(); }
161 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
162 self.data = core::ptr::null_mut();
166 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
167 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
170 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
171 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
172 let datalen = v.len();
173 let data = Box::into_raw(v.into_boxed_slice());
174 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
178 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
179 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
180 impl Drop for CVec_APIErrorZ {
182 if self.datalen == 0 { return; }
183 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
186 impl Clone for CVec_APIErrorZ {
187 fn clone(&self) -> Self {
188 let mut res = Vec::new();
189 if self.datalen == 0 { return Self::from(res); }
190 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
195 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
196 pub enum COption_HTLCClaimZ {
197 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
198 Some(crate::lightning::ln::chan_utils::HTLCClaim),
199 /// When we're in this state, this COption_HTLCClaimZ contains nothing
202 impl COption_HTLCClaimZ {
203 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
204 if let Self::None = self { false } else { true }
206 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
209 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
210 if let Self::Some(v) = self { v } else { unreachable!() }
214 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
215 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
216 COption_HTLCClaimZ::Some(o)
219 /// Constructs a new COption_HTLCClaimZ containing nothing
220 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
221 COption_HTLCClaimZ::None
224 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
225 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
227 /// The contents of CResult_NoneNoneZ
228 pub union CResult_NoneNoneZPtr {
229 /// Note that this value is always NULL, as there are no contents in the OK variant
230 pub result: *mut core::ffi::c_void,
231 /// Note that this value is always NULL, as there are no contents in the Err variant
232 pub err: *mut core::ffi::c_void,
235 /// A CResult_NoneNoneZ represents the result of a fallible operation,
236 /// containing a () on success and a () on failure.
237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
238 pub struct CResult_NoneNoneZ {
239 /// The contents of this CResult_NoneNoneZ, accessible via either
240 /// `err` or `result` depending on the state of `result_ok`.
241 pub contents: CResult_NoneNoneZPtr,
242 /// Whether this CResult_NoneNoneZ represents a success state.
246 /// Creates a new CResult_NoneNoneZ in the success state.
247 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
249 contents: CResult_NoneNoneZPtr {
250 result: core::ptr::null_mut(),
256 /// Creates a new CResult_NoneNoneZ in the error state.
257 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
259 contents: CResult_NoneNoneZPtr {
260 err: core::ptr::null_mut(),
265 /// Checks if the given object is currently in the success state
267 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
271 /// Frees any resources used by the CResult_NoneNoneZ.
272 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
273 impl Drop for CResult_NoneNoneZ {
280 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
281 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
282 let contents = if o.result_ok {
283 let _ = unsafe { Box::from_raw(o.contents.result) };
284 o.contents.result = core::ptr::null_mut();
285 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
287 let _ = unsafe { Box::from_raw(o.contents.err) };
288 o.contents.err = core::ptr::null_mut();
289 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
293 result_ok: o.result_ok,
297 impl Clone for CResult_NoneNoneZ {
298 fn clone(&self) -> Self {
300 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
301 result: core::ptr::null_mut()
304 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
305 err: core::ptr::null_mut()
311 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
312 /// but with all dynamically-allocated buffers duplicated in new buffers.
313 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
315 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
316 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
317 /// A pointer to the contents in the success state.
318 /// Reading from this pointer when `result_ok` is not set is undefined.
319 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
320 /// A pointer to the contents in the error state.
321 /// Reading from this pointer when `result_ok` is set is undefined.
322 pub err: *mut crate::lightning::ln::msgs::DecodeError,
325 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
326 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
328 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
329 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
330 /// `err` or `result` depending on the state of `result_ok`.
331 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
332 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
336 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
337 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
338 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
339 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
340 result: Box::into_raw(Box::new(o)),
346 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
347 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
348 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
349 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
350 err: Box::into_raw(Box::new(e)),
355 /// Checks if the given object is currently in the success state
357 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
361 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
362 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
363 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
366 if unsafe { !(self.contents.result as *mut ()).is_null() } {
367 let _ = unsafe { Box::from_raw(self.contents.result) };
370 if unsafe { !(self.contents.err as *mut ()).is_null() } {
371 let _ = unsafe { Box::from_raw(self.contents.err) };
376 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
377 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
378 let contents = if o.result_ok {
379 let result = unsafe { o.contents.result };
380 unsafe { o.contents.result = core::ptr::null_mut() };
381 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
383 let err = unsafe { o.contents.err };
384 unsafe { o.contents.err = core::ptr::null_mut(); }
385 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
389 result_ok: o.result_ok,
393 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
394 fn clone(&self) -> Self {
396 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
397 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
400 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
401 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
407 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
408 /// but with all dynamically-allocated buffers duplicated in new buffers.
409 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
411 /// The contents of CResult_TxCreationKeysDecodeErrorZ
412 pub union CResult_TxCreationKeysDecodeErrorZPtr {
413 /// A pointer to the contents in the success state.
414 /// Reading from this pointer when `result_ok` is not set is undefined.
415 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
416 /// A pointer to the contents in the error state.
417 /// Reading from this pointer when `result_ok` is set is undefined.
418 pub err: *mut crate::lightning::ln::msgs::DecodeError,
421 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
422 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
424 pub struct CResult_TxCreationKeysDecodeErrorZ {
425 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
426 /// `err` or `result` depending on the state of `result_ok`.
427 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
428 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
432 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
433 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
434 CResult_TxCreationKeysDecodeErrorZ {
435 contents: CResult_TxCreationKeysDecodeErrorZPtr {
436 result: Box::into_raw(Box::new(o)),
442 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
443 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
444 CResult_TxCreationKeysDecodeErrorZ {
445 contents: CResult_TxCreationKeysDecodeErrorZPtr {
446 err: Box::into_raw(Box::new(e)),
451 /// Checks if the given object is currently in the success state
453 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
457 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
458 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
459 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
462 if unsafe { !(self.contents.result as *mut ()).is_null() } {
463 let _ = unsafe { Box::from_raw(self.contents.result) };
466 if unsafe { !(self.contents.err as *mut ()).is_null() } {
467 let _ = unsafe { Box::from_raw(self.contents.err) };
472 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
473 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
474 let contents = if o.result_ok {
475 let result = unsafe { o.contents.result };
476 unsafe { o.contents.result = core::ptr::null_mut() };
477 CResult_TxCreationKeysDecodeErrorZPtr { result }
479 let err = unsafe { o.contents.err };
480 unsafe { o.contents.err = core::ptr::null_mut(); }
481 CResult_TxCreationKeysDecodeErrorZPtr { err }
485 result_ok: o.result_ok,
489 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
490 fn clone(&self) -> Self {
492 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
493 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
496 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
497 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
503 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
504 /// but with all dynamically-allocated buffers duplicated in new buffers.
505 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
507 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
508 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
509 /// A pointer to the contents in the success state.
510 /// Reading from this pointer when `result_ok` is not set is undefined.
511 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
512 /// A pointer to the contents in the error state.
513 /// Reading from this pointer when `result_ok` is set is undefined.
514 pub err: *mut crate::lightning::ln::msgs::DecodeError,
517 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
518 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
520 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
521 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
522 /// `err` or `result` depending on the state of `result_ok`.
523 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
524 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
528 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
529 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
530 CResult_ChannelPublicKeysDecodeErrorZ {
531 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
532 result: Box::into_raw(Box::new(o)),
538 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
539 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
540 CResult_ChannelPublicKeysDecodeErrorZ {
541 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
542 err: Box::into_raw(Box::new(e)),
547 /// Checks if the given object is currently in the success state
549 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
553 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
554 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
555 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
558 if unsafe { !(self.contents.result as *mut ()).is_null() } {
559 let _ = unsafe { Box::from_raw(self.contents.result) };
562 if unsafe { !(self.contents.err as *mut ()).is_null() } {
563 let _ = unsafe { Box::from_raw(self.contents.err) };
568 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
569 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
570 let contents = if o.result_ok {
571 let result = unsafe { o.contents.result };
572 unsafe { o.contents.result = core::ptr::null_mut() };
573 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
575 let err = unsafe { o.contents.err };
576 unsafe { o.contents.err = core::ptr::null_mut(); }
577 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
581 result_ok: o.result_ok,
585 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
586 fn clone(&self) -> Self {
588 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
589 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
592 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
593 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
599 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
600 /// but with all dynamically-allocated buffers duplicated in new buffers.
601 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
604 /// An enum which can either contain a u32 or not
605 pub enum COption_u32Z {
606 /// When we're in this state, this COption_u32Z contains a u32
608 /// When we're in this state, this COption_u32Z contains nothing
612 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
613 if let Self::None = self { false } else { true }
615 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
618 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
619 if let Self::Some(v) = self { v } else { unreachable!() }
623 /// Constructs a new COption_u32Z containing a u32
624 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
625 COption_u32Z::Some(o)
628 /// Constructs a new COption_u32Z containing nothing
629 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
633 /// Frees any resources associated with the u32, if we are in the Some state
634 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
636 /// Creates a new COption_u32Z which has the same data as `orig`
637 /// but with all dynamically-allocated buffers duplicated in new buffers.
638 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
640 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
641 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
642 /// A pointer to the contents in the success state.
643 /// Reading from this pointer when `result_ok` is not set is undefined.
644 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
645 /// A pointer to the contents in the error state.
646 /// Reading from this pointer when `result_ok` is set is undefined.
647 pub err: *mut crate::lightning::ln::msgs::DecodeError,
650 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
651 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
653 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
654 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
655 /// `err` or `result` depending on the state of `result_ok`.
656 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
657 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
661 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
662 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
663 CResult_HTLCOutputInCommitmentDecodeErrorZ {
664 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
665 result: Box::into_raw(Box::new(o)),
671 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
672 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
673 CResult_HTLCOutputInCommitmentDecodeErrorZ {
674 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
675 err: Box::into_raw(Box::new(e)),
680 /// Checks if the given object is currently in the success state
682 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
686 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
687 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
688 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
691 if unsafe { !(self.contents.result as *mut ()).is_null() } {
692 let _ = unsafe { Box::from_raw(self.contents.result) };
695 if unsafe { !(self.contents.err as *mut ()).is_null() } {
696 let _ = unsafe { Box::from_raw(self.contents.err) };
701 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
702 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
703 let contents = if o.result_ok {
704 let result = unsafe { o.contents.result };
705 unsafe { o.contents.result = core::ptr::null_mut() };
706 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
708 let err = unsafe { o.contents.err };
709 unsafe { o.contents.err = core::ptr::null_mut(); }
710 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
714 result_ok: o.result_ok,
718 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
719 fn clone(&self) -> Self {
721 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
722 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
725 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
726 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
732 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
733 /// but with all dynamically-allocated buffers duplicated in new buffers.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
736 /// An enum which can either contain a or not
737 pub enum COption_NoneZ {
738 /// When we're in this state, this COption_NoneZ contains a
740 /// When we're in this state, this COption_NoneZ contains nothing
744 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
745 if let Self::None = self { false } else { true }
747 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
752 /// Constructs a new COption_NoneZ containing a
753 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
757 /// Constructs a new COption_NoneZ containing nothing
758 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
762 /// Frees any resources associated with the , if we are in the Some state
763 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
765 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
766 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
767 /// A pointer to the contents in the success state.
768 /// Reading from this pointer when `result_ok` is not set is undefined.
769 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
770 /// A pointer to the contents in the error state.
771 /// Reading from this pointer when `result_ok` is set is undefined.
772 pub err: *mut crate::lightning::ln::msgs::DecodeError,
775 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
776 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
777 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
778 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
779 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
780 /// `err` or `result` depending on the state of `result_ok`.
781 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
782 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
786 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
787 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
788 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
789 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
790 result: Box::into_raw(Box::new(o)),
796 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
797 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
798 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
799 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
800 err: Box::into_raw(Box::new(e)),
805 /// Checks if the given object is currently in the success state
807 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
811 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
812 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
813 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
816 if unsafe { !(self.contents.result as *mut ()).is_null() } {
817 let _ = unsafe { Box::from_raw(self.contents.result) };
820 if unsafe { !(self.contents.err as *mut ()).is_null() } {
821 let _ = unsafe { Box::from_raw(self.contents.err) };
826 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
827 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
828 let contents = if o.result_ok {
829 let result = unsafe { o.contents.result };
830 unsafe { o.contents.result = core::ptr::null_mut() };
831 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
833 let err = unsafe { o.contents.err };
834 unsafe { o.contents.err = core::ptr::null_mut(); }
835 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
839 result_ok: o.result_ok,
843 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
844 fn clone(&self) -> Self {
846 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
847 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
850 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
851 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
857 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
858 /// but with all dynamically-allocated buffers duplicated in new buffers.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
861 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
862 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
863 /// A pointer to the contents in the success state.
864 /// Reading from this pointer when `result_ok` is not set is undefined.
865 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
866 /// A pointer to the contents in the error state.
867 /// Reading from this pointer when `result_ok` is set is undefined.
868 pub err: *mut crate::lightning::ln::msgs::DecodeError,
871 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
872 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
874 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
875 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
876 /// `err` or `result` depending on the state of `result_ok`.
877 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
878 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
882 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
883 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
884 CResult_ChannelTransactionParametersDecodeErrorZ {
885 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
886 result: Box::into_raw(Box::new(o)),
892 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
893 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
894 CResult_ChannelTransactionParametersDecodeErrorZ {
895 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
896 err: Box::into_raw(Box::new(e)),
901 /// Checks if the given object is currently in the success state
903 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
907 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
908 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
909 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
912 if unsafe { !(self.contents.result as *mut ()).is_null() } {
913 let _ = unsafe { Box::from_raw(self.contents.result) };
916 if unsafe { !(self.contents.err as *mut ()).is_null() } {
917 let _ = unsafe { Box::from_raw(self.contents.err) };
922 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
923 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
924 let contents = if o.result_ok {
925 let result = unsafe { o.contents.result };
926 unsafe { o.contents.result = core::ptr::null_mut() };
927 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
929 let err = unsafe { o.contents.err };
930 unsafe { o.contents.err = core::ptr::null_mut(); }
931 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
935 result_ok: o.result_ok,
939 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
940 fn clone(&self) -> Self {
942 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
943 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
946 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
947 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
953 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
954 /// but with all dynamically-allocated buffers duplicated in new buffers.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
957 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
958 /// This corresponds to std::vector in C++
959 pub struct CVec_SignatureZ {
960 /// The elements in the array.
961 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
962 pub data: *mut crate::c_types::Signature,
963 /// The number of elements pointed to by `data`.
966 impl CVec_SignatureZ {
967 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
968 if self.datalen == 0 { return Vec::new(); }
969 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
970 self.data = core::ptr::null_mut();
974 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
975 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
978 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
979 fn from(v: Vec<crate::c_types::Signature>) -> Self {
980 let datalen = v.len();
981 let data = Box::into_raw(v.into_boxed_slice());
982 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
986 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
987 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
988 impl Drop for CVec_SignatureZ {
990 if self.datalen == 0 { return; }
991 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
994 impl Clone for CVec_SignatureZ {
995 fn clone(&self) -> Self {
996 let mut res = Vec::new();
997 if self.datalen == 0 { return Self::from(res); }
998 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1003 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1004 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1005 /// A pointer to the contents in the success state.
1006 /// Reading from this pointer when `result_ok` is not set is undefined.
1007 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1008 /// A pointer to the contents in the error state.
1009 /// Reading from this pointer when `result_ok` is set is undefined.
1010 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1013 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1014 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1016 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1017 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1018 /// `err` or `result` depending on the state of `result_ok`.
1019 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1020 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1021 pub result_ok: bool,
1024 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1025 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1026 CResult_HolderCommitmentTransactionDecodeErrorZ {
1027 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1028 result: Box::into_raw(Box::new(o)),
1034 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1035 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1036 CResult_HolderCommitmentTransactionDecodeErrorZ {
1037 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1038 err: Box::into_raw(Box::new(e)),
1043 /// Checks if the given object is currently in the success state
1045 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1049 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1050 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1051 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1052 fn drop(&mut self) {
1054 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1055 let _ = unsafe { Box::from_raw(self.contents.result) };
1058 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1059 let _ = unsafe { Box::from_raw(self.contents.err) };
1064 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1065 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1066 let contents = if o.result_ok {
1067 let result = unsafe { o.contents.result };
1068 unsafe { o.contents.result = core::ptr::null_mut() };
1069 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1071 let err = unsafe { o.contents.err };
1072 unsafe { o.contents.err = core::ptr::null_mut(); }
1073 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1077 result_ok: o.result_ok,
1081 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1082 fn clone(&self) -> Self {
1084 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1085 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1088 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1089 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1095 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1096 /// but with all dynamically-allocated buffers duplicated in new buffers.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1099 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1100 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1101 /// A pointer to the contents in the success state.
1102 /// Reading from this pointer when `result_ok` is not set is undefined.
1103 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1104 /// A pointer to the contents in the error state.
1105 /// Reading from this pointer when `result_ok` is set is undefined.
1106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1109 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1110 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1112 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1113 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1114 /// `err` or `result` depending on the state of `result_ok`.
1115 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1116 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1117 pub result_ok: bool,
1120 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1121 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1122 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1123 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1124 result: Box::into_raw(Box::new(o)),
1130 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1131 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1132 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1133 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1134 err: Box::into_raw(Box::new(e)),
1139 /// Checks if the given object is currently in the success state
1141 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1145 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1146 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1147 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1148 fn drop(&mut self) {
1150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1151 let _ = unsafe { Box::from_raw(self.contents.result) };
1154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1155 let _ = unsafe { Box::from_raw(self.contents.err) };
1160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1162 let contents = if o.result_ok {
1163 let result = unsafe { o.contents.result };
1164 unsafe { o.contents.result = core::ptr::null_mut() };
1165 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1167 let err = unsafe { o.contents.err };
1168 unsafe { o.contents.err = core::ptr::null_mut(); }
1169 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1173 result_ok: o.result_ok,
1177 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1178 fn clone(&self) -> Self {
1180 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1181 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1184 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1191 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1192 /// but with all dynamically-allocated buffers duplicated in new buffers.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1195 /// The contents of CResult_TrustedClosingTransactionNoneZ
1196 pub union CResult_TrustedClosingTransactionNoneZPtr {
1197 /// A pointer to the contents in the success state.
1198 /// Reading from this pointer when `result_ok` is not set is undefined.
1199 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1200 /// Note that this value is always NULL, as there are no contents in the Err variant
1201 pub err: *mut core::ffi::c_void,
1204 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1205 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1207 pub struct CResult_TrustedClosingTransactionNoneZ {
1208 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1209 /// `err` or `result` depending on the state of `result_ok`.
1210 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1211 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1212 pub result_ok: bool,
1215 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1216 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1217 CResult_TrustedClosingTransactionNoneZ {
1218 contents: CResult_TrustedClosingTransactionNoneZPtr {
1219 result: Box::into_raw(Box::new(o)),
1225 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1226 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1227 CResult_TrustedClosingTransactionNoneZ {
1228 contents: CResult_TrustedClosingTransactionNoneZPtr {
1229 err: core::ptr::null_mut(),
1234 /// Checks if the given object is currently in the success state
1236 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1240 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1241 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1242 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1243 fn drop(&mut self) {
1245 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1246 let _ = unsafe { Box::from_raw(self.contents.result) };
1252 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1253 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1254 let contents = if o.result_ok {
1255 let result = unsafe { o.contents.result };
1256 unsafe { o.contents.result = core::ptr::null_mut() };
1257 CResult_TrustedClosingTransactionNoneZPtr { result }
1259 let _ = unsafe { Box::from_raw(o.contents.err) };
1260 o.contents.err = core::ptr::null_mut();
1261 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1265 result_ok: o.result_ok,
1270 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1271 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1272 /// A pointer to the contents in the success state.
1273 /// Reading from this pointer when `result_ok` is not set is undefined.
1274 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1275 /// A pointer to the contents in the error state.
1276 /// Reading from this pointer when `result_ok` is set is undefined.
1277 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1280 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1281 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1283 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1284 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1285 /// `err` or `result` depending on the state of `result_ok`.
1286 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1287 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1288 pub result_ok: bool,
1291 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1292 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1293 CResult_CommitmentTransactionDecodeErrorZ {
1294 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1295 result: Box::into_raw(Box::new(o)),
1301 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1302 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1303 CResult_CommitmentTransactionDecodeErrorZ {
1304 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1305 err: Box::into_raw(Box::new(e)),
1310 /// Checks if the given object is currently in the success state
1312 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1316 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1317 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1318 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1319 fn drop(&mut self) {
1321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1322 let _ = unsafe { Box::from_raw(self.contents.result) };
1325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1326 let _ = unsafe { Box::from_raw(self.contents.err) };
1331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1332 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1333 let contents = if o.result_ok {
1334 let result = unsafe { o.contents.result };
1335 unsafe { o.contents.result = core::ptr::null_mut() };
1336 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1338 let err = unsafe { o.contents.err };
1339 unsafe { o.contents.err = core::ptr::null_mut(); }
1340 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1344 result_ok: o.result_ok,
1348 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1349 fn clone(&self) -> Self {
1351 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1352 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1355 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1356 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1362 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1363 /// but with all dynamically-allocated buffers duplicated in new buffers.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1366 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1367 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1368 /// A pointer to the contents in the success state.
1369 /// Reading from this pointer when `result_ok` is not set is undefined.
1370 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1371 /// Note that this value is always NULL, as there are no contents in the Err variant
1372 pub err: *mut core::ffi::c_void,
1375 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1376 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1378 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1379 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1380 /// `err` or `result` depending on the state of `result_ok`.
1381 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1382 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1383 pub result_ok: bool,
1386 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1387 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1388 CResult_TrustedCommitmentTransactionNoneZ {
1389 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1390 result: Box::into_raw(Box::new(o)),
1396 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1397 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1398 CResult_TrustedCommitmentTransactionNoneZ {
1399 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1400 err: core::ptr::null_mut(),
1405 /// Checks if the given object is currently in the success state
1407 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1411 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1412 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1413 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1414 fn drop(&mut self) {
1416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1417 let _ = unsafe { Box::from_raw(self.contents.result) };
1423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1424 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1425 let contents = if o.result_ok {
1426 let result = unsafe { o.contents.result };
1427 unsafe { o.contents.result = core::ptr::null_mut() };
1428 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1430 let _ = unsafe { Box::from_raw(o.contents.err) };
1431 o.contents.err = core::ptr::null_mut();
1432 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1436 result_ok: o.result_ok,
1441 /// The contents of CResult_CVec_SignatureZNoneZ
1442 pub union CResult_CVec_SignatureZNoneZPtr {
1443 /// A pointer to the contents in the success state.
1444 /// Reading from this pointer when `result_ok` is not set is undefined.
1445 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1446 /// Note that this value is always NULL, as there are no contents in the Err variant
1447 pub err: *mut core::ffi::c_void,
1450 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1451 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1453 pub struct CResult_CVec_SignatureZNoneZ {
1454 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1455 /// `err` or `result` depending on the state of `result_ok`.
1456 pub contents: CResult_CVec_SignatureZNoneZPtr,
1457 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1458 pub result_ok: bool,
1461 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1462 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1463 CResult_CVec_SignatureZNoneZ {
1464 contents: CResult_CVec_SignatureZNoneZPtr {
1465 result: Box::into_raw(Box::new(o)),
1471 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1472 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1473 CResult_CVec_SignatureZNoneZ {
1474 contents: CResult_CVec_SignatureZNoneZPtr {
1475 err: core::ptr::null_mut(),
1480 /// Checks if the given object is currently in the success state
1482 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1486 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1487 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1488 impl Drop for CResult_CVec_SignatureZNoneZ {
1489 fn drop(&mut self) {
1491 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1492 let _ = unsafe { Box::from_raw(self.contents.result) };
1498 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1499 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1500 let contents = if o.result_ok {
1501 let result = unsafe { o.contents.result };
1502 unsafe { o.contents.result = core::ptr::null_mut() };
1503 CResult_CVec_SignatureZNoneZPtr { result }
1505 let _ = unsafe { Box::from_raw(o.contents.err) };
1506 o.contents.err = core::ptr::null_mut();
1507 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1511 result_ok: o.result_ok,
1515 impl Clone for CResult_CVec_SignatureZNoneZ {
1516 fn clone(&self) -> Self {
1518 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1519 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1522 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1523 err: core::ptr::null_mut()
1529 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1530 /// but with all dynamically-allocated buffers duplicated in new buffers.
1531 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1533 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1534 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1535 /// A pointer to the contents in the success state.
1536 /// Reading from this pointer when `result_ok` is not set is undefined.
1537 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1538 /// A pointer to the contents in the error state.
1539 /// Reading from this pointer when `result_ok` is set is undefined.
1540 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1543 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1544 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1545 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1546 pub struct CResult_ShutdownScriptDecodeErrorZ {
1547 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1548 /// `err` or `result` depending on the state of `result_ok`.
1549 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1550 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1551 pub result_ok: bool,
1554 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1555 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1556 CResult_ShutdownScriptDecodeErrorZ {
1557 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1558 result: Box::into_raw(Box::new(o)),
1564 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1565 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1566 CResult_ShutdownScriptDecodeErrorZ {
1567 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1568 err: Box::into_raw(Box::new(e)),
1573 /// Checks if the given object is currently in the success state
1575 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1579 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1580 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1581 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1582 fn drop(&mut self) {
1584 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1585 let _ = unsafe { Box::from_raw(self.contents.result) };
1588 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1589 let _ = unsafe { Box::from_raw(self.contents.err) };
1594 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1595 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1596 let contents = if o.result_ok {
1597 let result = unsafe { o.contents.result };
1598 unsafe { o.contents.result = core::ptr::null_mut() };
1599 CResult_ShutdownScriptDecodeErrorZPtr { result }
1601 let err = unsafe { o.contents.err };
1602 unsafe { o.contents.err = core::ptr::null_mut(); }
1603 CResult_ShutdownScriptDecodeErrorZPtr { err }
1607 result_ok: o.result_ok,
1611 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1612 fn clone(&self) -> Self {
1614 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1615 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1618 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1619 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1625 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1626 /// but with all dynamically-allocated buffers duplicated in new buffers.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1629 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1630 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1631 /// A pointer to the contents in the success state.
1632 /// Reading from this pointer when `result_ok` is not set is undefined.
1633 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1634 /// A pointer to the contents in the error state.
1635 /// Reading from this pointer when `result_ok` is set is undefined.
1636 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1639 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1640 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1641 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1642 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1643 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1644 /// `err` or `result` depending on the state of `result_ok`.
1645 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1646 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1647 pub result_ok: bool,
1650 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1651 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1652 CResult_ShutdownScriptInvalidShutdownScriptZ {
1653 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1654 result: Box::into_raw(Box::new(o)),
1660 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1661 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1662 CResult_ShutdownScriptInvalidShutdownScriptZ {
1663 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1664 err: Box::into_raw(Box::new(e)),
1669 /// Checks if the given object is currently in the success state
1671 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1675 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1676 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1677 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1678 fn drop(&mut self) {
1680 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1681 let _ = unsafe { Box::from_raw(self.contents.result) };
1684 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1685 let _ = unsafe { Box::from_raw(self.contents.err) };
1690 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1691 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1692 let contents = if o.result_ok {
1693 let result = unsafe { o.contents.result };
1694 unsafe { o.contents.result = core::ptr::null_mut() };
1695 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1697 let err = unsafe { o.contents.err };
1698 unsafe { o.contents.err = core::ptr::null_mut(); }
1699 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1703 result_ok: o.result_ok,
1707 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1708 fn clone(&self) -> Self {
1710 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1711 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1714 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1715 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1721 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1722 /// but with all dynamically-allocated buffers duplicated in new buffers.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1725 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
1726 /// This corresponds to std::vector in C++
1727 pub struct CVec_PublicKeyZ {
1728 /// The elements in the array.
1729 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1730 pub data: *mut crate::c_types::PublicKey,
1731 /// The number of elements pointed to by `data`.
1734 impl CVec_PublicKeyZ {
1735 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
1736 if self.datalen == 0 { return Vec::new(); }
1737 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1738 self.data = core::ptr::null_mut();
1742 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
1743 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1746 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
1747 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
1748 let datalen = v.len();
1749 let data = Box::into_raw(v.into_boxed_slice());
1750 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1754 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1755 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
1756 impl Drop for CVec_PublicKeyZ {
1757 fn drop(&mut self) {
1758 if self.datalen == 0 { return; }
1759 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1762 impl Clone for CVec_PublicKeyZ {
1763 fn clone(&self) -> Self {
1764 let mut res = Vec::new();
1765 if self.datalen == 0 { return Self::from(res); }
1766 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1771 /// The contents of CResult_BlindedPathNoneZ
1772 pub union CResult_BlindedPathNoneZPtr {
1773 /// A pointer to the contents in the success state.
1774 /// Reading from this pointer when `result_ok` is not set is undefined.
1775 pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath,
1776 /// Note that this value is always NULL, as there are no contents in the Err variant
1777 pub err: *mut core::ffi::c_void,
1780 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
1781 /// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure.
1782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1783 pub struct CResult_BlindedPathNoneZ {
1784 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
1785 /// `err` or `result` depending on the state of `result_ok`.
1786 pub contents: CResult_BlindedPathNoneZPtr,
1787 /// Whether this CResult_BlindedPathNoneZ represents a success state.
1788 pub result_ok: bool,
1791 /// Creates a new CResult_BlindedPathNoneZ in the success state.
1792 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
1793 CResult_BlindedPathNoneZ {
1794 contents: CResult_BlindedPathNoneZPtr {
1795 result: Box::into_raw(Box::new(o)),
1801 /// Creates a new CResult_BlindedPathNoneZ in the error state.
1802 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
1803 CResult_BlindedPathNoneZ {
1804 contents: CResult_BlindedPathNoneZPtr {
1805 err: core::ptr::null_mut(),
1810 /// Checks if the given object is currently in the success state
1812 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
1816 /// Frees any resources used by the CResult_BlindedPathNoneZ.
1817 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
1818 impl Drop for CResult_BlindedPathNoneZ {
1819 fn drop(&mut self) {
1821 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1822 let _ = unsafe { Box::from_raw(self.contents.result) };
1828 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
1829 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, ()>) -> Self {
1830 let contents = if o.result_ok {
1831 let result = unsafe { o.contents.result };
1832 unsafe { o.contents.result = core::ptr::null_mut() };
1833 CResult_BlindedPathNoneZPtr { result }
1835 let _ = unsafe { Box::from_raw(o.contents.err) };
1836 o.contents.err = core::ptr::null_mut();
1837 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
1841 result_ok: o.result_ok,
1845 impl Clone for CResult_BlindedPathNoneZ {
1846 fn clone(&self) -> Self {
1848 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
1849 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
1852 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
1853 err: core::ptr::null_mut()
1859 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
1860 /// but with all dynamically-allocated buffers duplicated in new buffers.
1861 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
1863 /// The contents of CResult_BlindedPathDecodeErrorZ
1864 pub union CResult_BlindedPathDecodeErrorZPtr {
1865 /// A pointer to the contents in the success state.
1866 /// Reading from this pointer when `result_ok` is not set is undefined.
1867 pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath,
1868 /// A pointer to the contents in the error state.
1869 /// Reading from this pointer when `result_ok` is set is undefined.
1870 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1873 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
1874 /// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
1875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1876 pub struct CResult_BlindedPathDecodeErrorZ {
1877 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
1878 /// `err` or `result` depending on the state of `result_ok`.
1879 pub contents: CResult_BlindedPathDecodeErrorZPtr,
1880 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
1881 pub result_ok: bool,
1884 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
1885 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
1886 CResult_BlindedPathDecodeErrorZ {
1887 contents: CResult_BlindedPathDecodeErrorZPtr {
1888 result: Box::into_raw(Box::new(o)),
1894 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
1895 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
1896 CResult_BlindedPathDecodeErrorZ {
1897 contents: CResult_BlindedPathDecodeErrorZPtr {
1898 err: Box::into_raw(Box::new(e)),
1903 /// Checks if the given object is currently in the success state
1905 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
1909 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
1910 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
1911 impl Drop for CResult_BlindedPathDecodeErrorZ {
1912 fn drop(&mut self) {
1914 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1915 let _ = unsafe { Box::from_raw(self.contents.result) };
1918 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1919 let _ = unsafe { Box::from_raw(self.contents.err) };
1924 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
1925 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
1926 let contents = if o.result_ok {
1927 let result = unsafe { o.contents.result };
1928 unsafe { o.contents.result = core::ptr::null_mut() };
1929 CResult_BlindedPathDecodeErrorZPtr { result }
1931 let err = unsafe { o.contents.err };
1932 unsafe { o.contents.err = core::ptr::null_mut(); }
1933 CResult_BlindedPathDecodeErrorZPtr { err }
1937 result_ok: o.result_ok,
1941 impl Clone for CResult_BlindedPathDecodeErrorZ {
1942 fn clone(&self) -> Self {
1944 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
1945 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
1948 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
1949 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1955 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
1956 /// but with all dynamically-allocated buffers duplicated in new buffers.
1957 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
1959 /// The contents of CResult_BlindedHopDecodeErrorZ
1960 pub union CResult_BlindedHopDecodeErrorZPtr {
1961 /// A pointer to the contents in the success state.
1962 /// Reading from this pointer when `result_ok` is not set is undefined.
1963 pub result: *mut crate::lightning::onion_message::blinded_path::BlindedHop,
1964 /// A pointer to the contents in the error state.
1965 /// Reading from this pointer when `result_ok` is set is undefined.
1966 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1969 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
1970 /// containing a crate::lightning::onion_message::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1972 pub struct CResult_BlindedHopDecodeErrorZ {
1973 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
1974 /// `err` or `result` depending on the state of `result_ok`.
1975 pub contents: CResult_BlindedHopDecodeErrorZPtr,
1976 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
1977 pub result_ok: bool,
1980 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
1981 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
1982 CResult_BlindedHopDecodeErrorZ {
1983 contents: CResult_BlindedHopDecodeErrorZPtr {
1984 result: Box::into_raw(Box::new(o)),
1990 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
1991 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
1992 CResult_BlindedHopDecodeErrorZ {
1993 contents: CResult_BlindedHopDecodeErrorZPtr {
1994 err: Box::into_raw(Box::new(e)),
1999 /// Checks if the given object is currently in the success state
2001 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
2005 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
2006 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
2007 impl Drop for CResult_BlindedHopDecodeErrorZ {
2008 fn drop(&mut self) {
2010 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2011 let _ = unsafe { Box::from_raw(self.contents.result) };
2014 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2015 let _ = unsafe { Box::from_raw(self.contents.err) };
2020 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
2021 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2022 let contents = if o.result_ok {
2023 let result = unsafe { o.contents.result };
2024 unsafe { o.contents.result = core::ptr::null_mut() };
2025 CResult_BlindedHopDecodeErrorZPtr { result }
2027 let err = unsafe { o.contents.err };
2028 unsafe { o.contents.err = core::ptr::null_mut(); }
2029 CResult_BlindedHopDecodeErrorZPtr { err }
2033 result_ok: o.result_ok,
2037 impl Clone for CResult_BlindedHopDecodeErrorZ {
2038 fn clone(&self) -> Self {
2040 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
2041 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
2044 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
2045 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2051 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
2052 /// but with all dynamically-allocated buffers duplicated in new buffers.
2053 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
2055 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2056 pub enum COption_WriteableScoreZ {
2057 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2058 Some(crate::lightning::routing::scoring::WriteableScore),
2059 /// When we're in this state, this COption_WriteableScoreZ contains nothing
2062 impl COption_WriteableScoreZ {
2063 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2064 if let Self::None = self { false } else { true }
2066 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2069 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2070 if let Self::Some(v) = self { v } else { unreachable!() }
2074 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2075 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2076 COption_WriteableScoreZ::Some(o)
2079 /// Constructs a new COption_WriteableScoreZ containing nothing
2080 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2081 COption_WriteableScoreZ::None
2084 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2085 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2087 /// The contents of CResult_NoneErrorZ
2088 pub union CResult_NoneErrorZPtr {
2089 /// Note that this value is always NULL, as there are no contents in the OK variant
2090 pub result: *mut core::ffi::c_void,
2091 /// A pointer to the contents in the error state.
2092 /// Reading from this pointer when `result_ok` is set is undefined.
2093 pub err: *mut crate::c_types::IOError,
2096 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2097 /// containing a () on success and a crate::c_types::IOError on failure.
2098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2099 pub struct CResult_NoneErrorZ {
2100 /// The contents of this CResult_NoneErrorZ, accessible via either
2101 /// `err` or `result` depending on the state of `result_ok`.
2102 pub contents: CResult_NoneErrorZPtr,
2103 /// Whether this CResult_NoneErrorZ represents a success state.
2104 pub result_ok: bool,
2107 /// Creates a new CResult_NoneErrorZ in the success state.
2108 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2109 CResult_NoneErrorZ {
2110 contents: CResult_NoneErrorZPtr {
2111 result: core::ptr::null_mut(),
2117 /// Creates a new CResult_NoneErrorZ in the error state.
2118 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2119 CResult_NoneErrorZ {
2120 contents: CResult_NoneErrorZPtr {
2121 err: Box::into_raw(Box::new(e)),
2126 /// Checks if the given object is currently in the success state
2128 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2132 /// Frees any resources used by the CResult_NoneErrorZ.
2133 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2134 impl Drop for CResult_NoneErrorZ {
2135 fn drop(&mut self) {
2138 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2139 let _ = unsafe { Box::from_raw(self.contents.err) };
2144 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2145 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2146 let contents = if o.result_ok {
2147 let _ = unsafe { Box::from_raw(o.contents.result) };
2148 o.contents.result = core::ptr::null_mut();
2149 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2151 let err = unsafe { o.contents.err };
2152 unsafe { o.contents.err = core::ptr::null_mut(); }
2153 CResult_NoneErrorZPtr { err }
2157 result_ok: o.result_ok,
2161 impl Clone for CResult_NoneErrorZ {
2162 fn clone(&self) -> Self {
2164 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2165 result: core::ptr::null_mut()
2168 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2169 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2175 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2176 /// but with all dynamically-allocated buffers duplicated in new buffers.
2177 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2179 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2180 /// This corresponds to std::vector in C++
2181 pub struct CVec_ChannelDetailsZ {
2182 /// The elements in the array.
2183 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2184 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2185 /// The number of elements pointed to by `data`.
2188 impl CVec_ChannelDetailsZ {
2189 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2190 if self.datalen == 0 { return Vec::new(); }
2191 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2192 self.data = core::ptr::null_mut();
2196 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2197 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2200 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2201 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2202 let datalen = v.len();
2203 let data = Box::into_raw(v.into_boxed_slice());
2204 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2208 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2209 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2210 impl Drop for CVec_ChannelDetailsZ {
2211 fn drop(&mut self) {
2212 if self.datalen == 0 { return; }
2213 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2216 impl Clone for CVec_ChannelDetailsZ {
2217 fn clone(&self) -> Self {
2218 let mut res = Vec::new();
2219 if self.datalen == 0 { return Self::from(res); }
2220 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2225 /// The contents of CResult_RouteLightningErrorZ
2226 pub union CResult_RouteLightningErrorZPtr {
2227 /// A pointer to the contents in the success state.
2228 /// Reading from this pointer when `result_ok` is not set is undefined.
2229 pub result: *mut crate::lightning::routing::router::Route,
2230 /// A pointer to the contents in the error state.
2231 /// Reading from this pointer when `result_ok` is set is undefined.
2232 pub err: *mut crate::lightning::ln::msgs::LightningError,
2235 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2236 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2238 pub struct CResult_RouteLightningErrorZ {
2239 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2240 /// `err` or `result` depending on the state of `result_ok`.
2241 pub contents: CResult_RouteLightningErrorZPtr,
2242 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2243 pub result_ok: bool,
2246 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2247 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2248 CResult_RouteLightningErrorZ {
2249 contents: CResult_RouteLightningErrorZPtr {
2250 result: Box::into_raw(Box::new(o)),
2256 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2257 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2258 CResult_RouteLightningErrorZ {
2259 contents: CResult_RouteLightningErrorZPtr {
2260 err: Box::into_raw(Box::new(e)),
2265 /// Checks if the given object is currently in the success state
2267 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2271 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2272 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2273 impl Drop for CResult_RouteLightningErrorZ {
2274 fn drop(&mut self) {
2276 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2277 let _ = unsafe { Box::from_raw(self.contents.result) };
2280 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2281 let _ = unsafe { Box::from_raw(self.contents.err) };
2286 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2287 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2288 let contents = if o.result_ok {
2289 let result = unsafe { o.contents.result };
2290 unsafe { o.contents.result = core::ptr::null_mut() };
2291 CResult_RouteLightningErrorZPtr { result }
2293 let err = unsafe { o.contents.err };
2294 unsafe { o.contents.err = core::ptr::null_mut(); }
2295 CResult_RouteLightningErrorZPtr { err }
2299 result_ok: o.result_ok,
2303 impl Clone for CResult_RouteLightningErrorZ {
2304 fn clone(&self) -> Self {
2306 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2307 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2310 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2311 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2317 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2318 /// but with all dynamically-allocated buffers duplicated in new buffers.
2319 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2321 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2322 /// This corresponds to std::vector in C++
2323 pub struct CVec_RouteHopZ {
2324 /// The elements in the array.
2325 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2326 pub data: *mut crate::lightning::routing::router::RouteHop,
2327 /// The number of elements pointed to by `data`.
2330 impl CVec_RouteHopZ {
2331 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2332 if self.datalen == 0 { return Vec::new(); }
2333 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2334 self.data = core::ptr::null_mut();
2338 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2339 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2342 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2343 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2344 let datalen = v.len();
2345 let data = Box::into_raw(v.into_boxed_slice());
2346 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2350 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2351 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2352 impl Drop for CVec_RouteHopZ {
2353 fn drop(&mut self) {
2354 if self.datalen == 0 { return; }
2355 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2358 impl Clone for CVec_RouteHopZ {
2359 fn clone(&self) -> Self {
2360 let mut res = Vec::new();
2361 if self.datalen == 0 { return Self::from(res); }
2362 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2368 /// An enum which can either contain a u64 or not
2369 pub enum COption_u64Z {
2370 /// When we're in this state, this COption_u64Z contains a u64
2372 /// When we're in this state, this COption_u64Z contains nothing
2376 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2377 if let Self::None = self { false } else { true }
2379 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2382 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2383 if let Self::Some(v) = self { v } else { unreachable!() }
2387 /// Constructs a new COption_u64Z containing a u64
2388 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2389 COption_u64Z::Some(o)
2392 /// Constructs a new COption_u64Z containing nothing
2393 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2397 /// Frees any resources associated with the u64, if we are in the Some state
2398 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2400 /// Creates a new COption_u64Z which has the same data as `orig`
2401 /// but with all dynamically-allocated buffers duplicated in new buffers.
2402 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2404 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2405 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2406 /// A pointer to the contents in the success state.
2407 /// Reading from this pointer when `result_ok` is not set is undefined.
2408 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2409 /// A pointer to the contents in the error state.
2410 /// Reading from this pointer when `result_ok` is set is undefined.
2411 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2414 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2415 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2417 pub struct CResult_InFlightHtlcsDecodeErrorZ {
2418 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2419 /// `err` or `result` depending on the state of `result_ok`.
2420 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
2421 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2422 pub result_ok: bool,
2425 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
2426 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
2427 CResult_InFlightHtlcsDecodeErrorZ {
2428 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2429 result: Box::into_raw(Box::new(o)),
2435 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
2436 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
2437 CResult_InFlightHtlcsDecodeErrorZ {
2438 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2439 err: Box::into_raw(Box::new(e)),
2444 /// Checks if the given object is currently in the success state
2446 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
2450 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
2451 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
2452 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
2453 fn drop(&mut self) {
2455 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2456 let _ = unsafe { Box::from_raw(self.contents.result) };
2459 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2460 let _ = unsafe { Box::from_raw(self.contents.err) };
2465 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
2466 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
2467 let contents = if o.result_ok {
2468 let result = unsafe { o.contents.result };
2469 unsafe { o.contents.result = core::ptr::null_mut() };
2470 CResult_InFlightHtlcsDecodeErrorZPtr { result }
2472 let err = unsafe { o.contents.err };
2473 unsafe { o.contents.err = core::ptr::null_mut(); }
2474 CResult_InFlightHtlcsDecodeErrorZPtr { err }
2478 result_ok: o.result_ok,
2482 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
2483 fn clone(&self) -> Self {
2485 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2486 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
2489 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2490 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2496 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
2497 /// but with all dynamically-allocated buffers duplicated in new buffers.
2498 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
2500 /// The contents of CResult_RouteHopDecodeErrorZ
2501 pub union CResult_RouteHopDecodeErrorZPtr {
2502 /// A pointer to the contents in the success state.
2503 /// Reading from this pointer when `result_ok` is not set is undefined.
2504 pub result: *mut crate::lightning::routing::router::RouteHop,
2505 /// A pointer to the contents in the error state.
2506 /// Reading from this pointer when `result_ok` is set is undefined.
2507 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2510 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2511 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2513 pub struct CResult_RouteHopDecodeErrorZ {
2514 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2515 /// `err` or `result` depending on the state of `result_ok`.
2516 pub contents: CResult_RouteHopDecodeErrorZPtr,
2517 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2518 pub result_ok: bool,
2521 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2522 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2523 CResult_RouteHopDecodeErrorZ {
2524 contents: CResult_RouteHopDecodeErrorZPtr {
2525 result: Box::into_raw(Box::new(o)),
2531 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2532 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2533 CResult_RouteHopDecodeErrorZ {
2534 contents: CResult_RouteHopDecodeErrorZPtr {
2535 err: Box::into_raw(Box::new(e)),
2540 /// Checks if the given object is currently in the success state
2542 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2546 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2547 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2548 impl Drop for CResult_RouteHopDecodeErrorZ {
2549 fn drop(&mut self) {
2551 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2552 let _ = unsafe { Box::from_raw(self.contents.result) };
2555 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2556 let _ = unsafe { Box::from_raw(self.contents.err) };
2561 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2562 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2563 let contents = if o.result_ok {
2564 let result = unsafe { o.contents.result };
2565 unsafe { o.contents.result = core::ptr::null_mut() };
2566 CResult_RouteHopDecodeErrorZPtr { result }
2568 let err = unsafe { o.contents.err };
2569 unsafe { o.contents.err = core::ptr::null_mut(); }
2570 CResult_RouteHopDecodeErrorZPtr { err }
2574 result_ok: o.result_ok,
2578 impl Clone for CResult_RouteHopDecodeErrorZ {
2579 fn clone(&self) -> Self {
2581 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2582 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2585 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2586 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2592 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2593 /// but with all dynamically-allocated buffers duplicated in new buffers.
2594 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2596 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2597 /// This corresponds to std::vector in C++
2598 pub struct CVec_CVec_RouteHopZZ {
2599 /// The elements in the array.
2600 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2601 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2602 /// The number of elements pointed to by `data`.
2605 impl CVec_CVec_RouteHopZZ {
2606 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2607 if self.datalen == 0 { return Vec::new(); }
2608 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2609 self.data = core::ptr::null_mut();
2613 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2614 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2617 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2618 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2619 let datalen = v.len();
2620 let data = Box::into_raw(v.into_boxed_slice());
2621 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2625 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2626 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2627 impl Drop for CVec_CVec_RouteHopZZ {
2628 fn drop(&mut self) {
2629 if self.datalen == 0 { return; }
2630 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2633 impl Clone for CVec_CVec_RouteHopZZ {
2634 fn clone(&self) -> Self {
2635 let mut res = Vec::new();
2636 if self.datalen == 0 { return Self::from(res); }
2637 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2642 /// The contents of CResult_RouteDecodeErrorZ
2643 pub union CResult_RouteDecodeErrorZPtr {
2644 /// A pointer to the contents in the success state.
2645 /// Reading from this pointer when `result_ok` is not set is undefined.
2646 pub result: *mut crate::lightning::routing::router::Route,
2647 /// A pointer to the contents in the error state.
2648 /// Reading from this pointer when `result_ok` is set is undefined.
2649 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2652 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2653 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2655 pub struct CResult_RouteDecodeErrorZ {
2656 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2657 /// `err` or `result` depending on the state of `result_ok`.
2658 pub contents: CResult_RouteDecodeErrorZPtr,
2659 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2660 pub result_ok: bool,
2663 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2664 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2665 CResult_RouteDecodeErrorZ {
2666 contents: CResult_RouteDecodeErrorZPtr {
2667 result: Box::into_raw(Box::new(o)),
2673 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2674 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2675 CResult_RouteDecodeErrorZ {
2676 contents: CResult_RouteDecodeErrorZPtr {
2677 err: Box::into_raw(Box::new(e)),
2682 /// Checks if the given object is currently in the success state
2684 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2688 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2689 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2690 impl Drop for CResult_RouteDecodeErrorZ {
2691 fn drop(&mut self) {
2693 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2694 let _ = unsafe { Box::from_raw(self.contents.result) };
2697 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2698 let _ = unsafe { Box::from_raw(self.contents.err) };
2703 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2704 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2705 let contents = if o.result_ok {
2706 let result = unsafe { o.contents.result };
2707 unsafe { o.contents.result = core::ptr::null_mut() };
2708 CResult_RouteDecodeErrorZPtr { result }
2710 let err = unsafe { o.contents.err };
2711 unsafe { o.contents.err = core::ptr::null_mut(); }
2712 CResult_RouteDecodeErrorZPtr { err }
2716 result_ok: o.result_ok,
2720 impl Clone for CResult_RouteDecodeErrorZ {
2721 fn clone(&self) -> Self {
2723 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2724 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2727 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2728 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2734 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2735 /// but with all dynamically-allocated buffers duplicated in new buffers.
2736 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2738 /// The contents of CResult_RouteParametersDecodeErrorZ
2739 pub union CResult_RouteParametersDecodeErrorZPtr {
2740 /// A pointer to the contents in the success state.
2741 /// Reading from this pointer when `result_ok` is not set is undefined.
2742 pub result: *mut crate::lightning::routing::router::RouteParameters,
2743 /// A pointer to the contents in the error state.
2744 /// Reading from this pointer when `result_ok` is set is undefined.
2745 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2748 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2749 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2751 pub struct CResult_RouteParametersDecodeErrorZ {
2752 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2753 /// `err` or `result` depending on the state of `result_ok`.
2754 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2755 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2756 pub result_ok: bool,
2759 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2760 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2761 CResult_RouteParametersDecodeErrorZ {
2762 contents: CResult_RouteParametersDecodeErrorZPtr {
2763 result: Box::into_raw(Box::new(o)),
2769 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2770 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2771 CResult_RouteParametersDecodeErrorZ {
2772 contents: CResult_RouteParametersDecodeErrorZPtr {
2773 err: Box::into_raw(Box::new(e)),
2778 /// Checks if the given object is currently in the success state
2780 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2784 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2785 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2786 impl Drop for CResult_RouteParametersDecodeErrorZ {
2787 fn drop(&mut self) {
2789 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2790 let _ = unsafe { Box::from_raw(self.contents.result) };
2793 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2794 let _ = unsafe { Box::from_raw(self.contents.err) };
2799 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2800 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2801 let contents = if o.result_ok {
2802 let result = unsafe { o.contents.result };
2803 unsafe { o.contents.result = core::ptr::null_mut() };
2804 CResult_RouteParametersDecodeErrorZPtr { result }
2806 let err = unsafe { o.contents.err };
2807 unsafe { o.contents.err = core::ptr::null_mut(); }
2808 CResult_RouteParametersDecodeErrorZPtr { err }
2812 result_ok: o.result_ok,
2816 impl Clone for CResult_RouteParametersDecodeErrorZ {
2817 fn clone(&self) -> Self {
2819 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2820 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2823 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2824 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2830 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2831 /// but with all dynamically-allocated buffers duplicated in new buffers.
2832 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2834 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2835 /// This corresponds to std::vector in C++
2836 pub struct CVec_RouteHintZ {
2837 /// The elements in the array.
2838 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2839 pub data: *mut crate::lightning::routing::router::RouteHint,
2840 /// The number of elements pointed to by `data`.
2843 impl CVec_RouteHintZ {
2844 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2845 if self.datalen == 0 { return Vec::new(); }
2846 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2847 self.data = core::ptr::null_mut();
2851 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2852 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2855 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2856 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2857 let datalen = v.len();
2858 let data = Box::into_raw(v.into_boxed_slice());
2859 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2863 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2864 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2865 impl Drop for CVec_RouteHintZ {
2866 fn drop(&mut self) {
2867 if self.datalen == 0 { return; }
2868 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2871 impl Clone for CVec_RouteHintZ {
2872 fn clone(&self) -> Self {
2873 let mut res = Vec::new();
2874 if self.datalen == 0 { return Self::from(res); }
2875 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2880 /// A dynamically-allocated array of u64s of arbitrary size.
2881 /// This corresponds to std::vector in C++
2882 pub struct CVec_u64Z {
2883 /// The elements in the array.
2884 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2886 /// The number of elements pointed to by `data`.
2890 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2891 if self.datalen == 0 { return Vec::new(); }
2892 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2893 self.data = core::ptr::null_mut();
2897 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2898 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2901 impl From<Vec<u64>> for CVec_u64Z {
2902 fn from(v: Vec<u64>) -> Self {
2903 let datalen = v.len();
2904 let data = Box::into_raw(v.into_boxed_slice());
2905 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2910 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2911 impl Drop for CVec_u64Z {
2912 fn drop(&mut self) {
2913 if self.datalen == 0 { return; }
2914 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2917 impl Clone for CVec_u64Z {
2918 fn clone(&self) -> Self {
2919 let mut res = Vec::new();
2920 if self.datalen == 0 { return Self::from(res); }
2921 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2926 /// The contents of CResult_PaymentParametersDecodeErrorZ
2927 pub union CResult_PaymentParametersDecodeErrorZPtr {
2928 /// A pointer to the contents in the success state.
2929 /// Reading from this pointer when `result_ok` is not set is undefined.
2930 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2931 /// A pointer to the contents in the error state.
2932 /// Reading from this pointer when `result_ok` is set is undefined.
2933 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2936 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2937 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2939 pub struct CResult_PaymentParametersDecodeErrorZ {
2940 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2941 /// `err` or `result` depending on the state of `result_ok`.
2942 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2943 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2944 pub result_ok: bool,
2947 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2948 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2949 CResult_PaymentParametersDecodeErrorZ {
2950 contents: CResult_PaymentParametersDecodeErrorZPtr {
2951 result: Box::into_raw(Box::new(o)),
2957 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2958 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2959 CResult_PaymentParametersDecodeErrorZ {
2960 contents: CResult_PaymentParametersDecodeErrorZPtr {
2961 err: Box::into_raw(Box::new(e)),
2966 /// Checks if the given object is currently in the success state
2968 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2972 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2973 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2974 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2975 fn drop(&mut self) {
2977 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2978 let _ = unsafe { Box::from_raw(self.contents.result) };
2981 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2982 let _ = unsafe { Box::from_raw(self.contents.err) };
2987 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2988 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2989 let contents = if o.result_ok {
2990 let result = unsafe { o.contents.result };
2991 unsafe { o.contents.result = core::ptr::null_mut() };
2992 CResult_PaymentParametersDecodeErrorZPtr { result }
2994 let err = unsafe { o.contents.err };
2995 unsafe { o.contents.err = core::ptr::null_mut(); }
2996 CResult_PaymentParametersDecodeErrorZPtr { err }
3000 result_ok: o.result_ok,
3004 impl Clone for CResult_PaymentParametersDecodeErrorZ {
3005 fn clone(&self) -> Self {
3007 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
3008 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
3011 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
3012 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3018 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
3019 /// but with all dynamically-allocated buffers duplicated in new buffers.
3020 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
3022 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
3023 /// This corresponds to std::vector in C++
3024 pub struct CVec_RouteHintHopZ {
3025 /// The elements in the array.
3026 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3027 pub data: *mut crate::lightning::routing::router::RouteHintHop,
3028 /// The number of elements pointed to by `data`.
3031 impl CVec_RouteHintHopZ {
3032 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
3033 if self.datalen == 0 { return Vec::new(); }
3034 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3035 self.data = core::ptr::null_mut();
3039 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
3040 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3043 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
3044 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
3045 let datalen = v.len();
3046 let data = Box::into_raw(v.into_boxed_slice());
3047 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3051 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3052 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
3053 impl Drop for CVec_RouteHintHopZ {
3054 fn drop(&mut self) {
3055 if self.datalen == 0 { return; }
3056 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3059 impl Clone for CVec_RouteHintHopZ {
3060 fn clone(&self) -> Self {
3061 let mut res = Vec::new();
3062 if self.datalen == 0 { return Self::from(res); }
3063 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3068 /// The contents of CResult_RouteHintDecodeErrorZ
3069 pub union CResult_RouteHintDecodeErrorZPtr {
3070 /// A pointer to the contents in the success state.
3071 /// Reading from this pointer when `result_ok` is not set is undefined.
3072 pub result: *mut crate::lightning::routing::router::RouteHint,
3073 /// A pointer to the contents in the error state.
3074 /// Reading from this pointer when `result_ok` is set is undefined.
3075 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3078 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
3079 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
3080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3081 pub struct CResult_RouteHintDecodeErrorZ {
3082 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
3083 /// `err` or `result` depending on the state of `result_ok`.
3084 pub contents: CResult_RouteHintDecodeErrorZPtr,
3085 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
3086 pub result_ok: bool,
3089 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
3090 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
3091 CResult_RouteHintDecodeErrorZ {
3092 contents: CResult_RouteHintDecodeErrorZPtr {
3093 result: Box::into_raw(Box::new(o)),
3099 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
3100 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
3101 CResult_RouteHintDecodeErrorZ {
3102 contents: CResult_RouteHintDecodeErrorZPtr {
3103 err: Box::into_raw(Box::new(e)),
3108 /// Checks if the given object is currently in the success state
3110 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
3114 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
3115 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
3116 impl Drop for CResult_RouteHintDecodeErrorZ {
3117 fn drop(&mut self) {
3119 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3120 let _ = unsafe { Box::from_raw(self.contents.result) };
3123 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3124 let _ = unsafe { Box::from_raw(self.contents.err) };
3129 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
3130 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
3131 let contents = if o.result_ok {
3132 let result = unsafe { o.contents.result };
3133 unsafe { o.contents.result = core::ptr::null_mut() };
3134 CResult_RouteHintDecodeErrorZPtr { result }
3136 let err = unsafe { o.contents.err };
3137 unsafe { o.contents.err = core::ptr::null_mut(); }
3138 CResult_RouteHintDecodeErrorZPtr { err }
3142 result_ok: o.result_ok,
3146 impl Clone for CResult_RouteHintDecodeErrorZ {
3147 fn clone(&self) -> Self {
3149 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
3150 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
3153 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
3154 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3160 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
3161 /// but with all dynamically-allocated buffers duplicated in new buffers.
3162 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
3164 /// The contents of CResult_RouteHintHopDecodeErrorZ
3165 pub union CResult_RouteHintHopDecodeErrorZPtr {
3166 /// A pointer to the contents in the success state.
3167 /// Reading from this pointer when `result_ok` is not set is undefined.
3168 pub result: *mut crate::lightning::routing::router::RouteHintHop,
3169 /// A pointer to the contents in the error state.
3170 /// Reading from this pointer when `result_ok` is set is undefined.
3171 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3174 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
3175 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3176 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3177 pub struct CResult_RouteHintHopDecodeErrorZ {
3178 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
3179 /// `err` or `result` depending on the state of `result_ok`.
3180 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
3181 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
3182 pub result_ok: bool,
3185 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
3186 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
3187 CResult_RouteHintHopDecodeErrorZ {
3188 contents: CResult_RouteHintHopDecodeErrorZPtr {
3189 result: Box::into_raw(Box::new(o)),
3195 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
3196 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
3197 CResult_RouteHintHopDecodeErrorZ {
3198 contents: CResult_RouteHintHopDecodeErrorZPtr {
3199 err: Box::into_raw(Box::new(e)),
3204 /// Checks if the given object is currently in the success state
3206 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
3210 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
3211 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
3212 impl Drop for CResult_RouteHintHopDecodeErrorZ {
3213 fn drop(&mut self) {
3215 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3216 let _ = unsafe { Box::from_raw(self.contents.result) };
3219 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3220 let _ = unsafe { Box::from_raw(self.contents.err) };
3225 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3226 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3227 let contents = if o.result_ok {
3228 let result = unsafe { o.contents.result };
3229 unsafe { o.contents.result = core::ptr::null_mut() };
3230 CResult_RouteHintHopDecodeErrorZPtr { result }
3232 let err = unsafe { o.contents.err };
3233 unsafe { o.contents.err = core::ptr::null_mut(); }
3234 CResult_RouteHintHopDecodeErrorZPtr { err }
3238 result_ok: o.result_ok,
3242 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3243 fn clone(&self) -> Self {
3245 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3246 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3249 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3250 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3256 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3257 /// but with all dynamically-allocated buffers duplicated in new buffers.
3258 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3260 /// The contents of CResult_PaymentPurposeDecodeErrorZ
3261 pub union CResult_PaymentPurposeDecodeErrorZPtr {
3262 /// A pointer to the contents in the success state.
3263 /// Reading from this pointer when `result_ok` is not set is undefined.
3264 pub result: *mut crate::lightning::util::events::PaymentPurpose,
3265 /// A pointer to the contents in the error state.
3266 /// Reading from this pointer when `result_ok` is set is undefined.
3267 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3270 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
3271 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
3272 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3273 pub struct CResult_PaymentPurposeDecodeErrorZ {
3274 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
3275 /// `err` or `result` depending on the state of `result_ok`.
3276 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
3277 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
3278 pub result_ok: bool,
3281 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
3282 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
3283 CResult_PaymentPurposeDecodeErrorZ {
3284 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3285 result: Box::into_raw(Box::new(o)),
3291 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
3292 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
3293 CResult_PaymentPurposeDecodeErrorZ {
3294 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3295 err: Box::into_raw(Box::new(e)),
3300 /// Checks if the given object is currently in the success state
3302 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
3306 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
3307 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
3308 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
3309 fn drop(&mut self) {
3311 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3312 let _ = unsafe { Box::from_raw(self.contents.result) };
3315 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3316 let _ = unsafe { Box::from_raw(self.contents.err) };
3321 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
3322 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
3323 let contents = if o.result_ok {
3324 let result = unsafe { o.contents.result };
3325 unsafe { o.contents.result = core::ptr::null_mut() };
3326 CResult_PaymentPurposeDecodeErrorZPtr { result }
3328 let err = unsafe { o.contents.err };
3329 unsafe { o.contents.err = core::ptr::null_mut(); }
3330 CResult_PaymentPurposeDecodeErrorZPtr { err }
3334 result_ok: o.result_ok,
3338 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
3339 fn clone(&self) -> Self {
3341 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3342 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
3345 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3346 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3352 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
3353 /// but with all dynamically-allocated buffers duplicated in new buffers.
3354 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3357 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3358 pub enum COption_NetworkUpdateZ {
3359 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3360 Some(crate::lightning::routing::gossip::NetworkUpdate),
3361 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3364 impl COption_NetworkUpdateZ {
3365 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3366 if let Self::None = self { false } else { true }
3368 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3371 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3372 if let Self::Some(v) = self { v } else { unreachable!() }
3376 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3377 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3378 COption_NetworkUpdateZ::Some(o)
3381 /// Constructs a new COption_NetworkUpdateZ containing nothing
3382 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3383 COption_NetworkUpdateZ::None
3386 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3387 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3389 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3390 /// but with all dynamically-allocated buffers duplicated in new buffers.
3391 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3394 /// An enum which can either contain a crate::lightning::util::events::PathFailure or not
3395 pub enum COption_PathFailureZ {
3396 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::util::events::PathFailure
3397 Some(crate::lightning::util::events::PathFailure),
3398 /// When we're in this state, this COption_PathFailureZ contains nothing
3401 impl COption_PathFailureZ {
3402 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3403 if let Self::None = self { false } else { true }
3405 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3408 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::PathFailure {
3409 if let Self::Some(v) = self { v } else { unreachable!() }
3413 /// Constructs a new COption_PathFailureZ containing a crate::lightning::util::events::PathFailure
3414 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::util::events::PathFailure) -> COption_PathFailureZ {
3415 COption_PathFailureZ::Some(o)
3418 /// Constructs a new COption_PathFailureZ containing nothing
3419 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
3420 COption_PathFailureZ::None
3423 /// Frees any resources associated with the crate::lightning::util::events::PathFailure, if we are in the Some state
3424 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
3426 /// Creates a new COption_PathFailureZ which has the same data as `orig`
3427 /// but with all dynamically-allocated buffers duplicated in new buffers.
3428 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
3430 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
3431 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
3432 /// A pointer to the contents in the success state.
3433 /// Reading from this pointer when `result_ok` is not set is undefined.
3434 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
3435 /// A pointer to the contents in the error state.
3436 /// Reading from this pointer when `result_ok` is set is undefined.
3437 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3440 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
3441 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3442 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3443 pub struct CResult_COption_PathFailureZDecodeErrorZ {
3444 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
3445 /// `err` or `result` depending on the state of `result_ok`.
3446 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
3447 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
3448 pub result_ok: bool,
3451 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
3452 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
3453 CResult_COption_PathFailureZDecodeErrorZ {
3454 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
3455 result: Box::into_raw(Box::new(o)),
3461 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
3462 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
3463 CResult_COption_PathFailureZDecodeErrorZ {
3464 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
3465 err: Box::into_raw(Box::new(e)),
3470 /// Checks if the given object is currently in the success state
3472 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
3476 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
3477 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
3478 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
3479 fn drop(&mut self) {
3481 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3482 let _ = unsafe { Box::from_raw(self.contents.result) };
3485 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3486 let _ = unsafe { Box::from_raw(self.contents.err) };
3491 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
3492 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3493 let contents = if o.result_ok {
3494 let result = unsafe { o.contents.result };
3495 unsafe { o.contents.result = core::ptr::null_mut() };
3496 CResult_COption_PathFailureZDecodeErrorZPtr { result }
3498 let err = unsafe { o.contents.err };
3499 unsafe { o.contents.err = core::ptr::null_mut(); }
3500 CResult_COption_PathFailureZDecodeErrorZPtr { err }
3504 result_ok: o.result_ok,
3508 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
3509 fn clone(&self) -> Self {
3511 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
3512 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
3515 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
3516 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3522 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
3523 /// but with all dynamically-allocated buffers duplicated in new buffers.
3524 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
3527 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3528 pub enum COption_ClosureReasonZ {
3529 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3530 Some(crate::lightning::util::events::ClosureReason),
3531 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3534 impl COption_ClosureReasonZ {
3535 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3536 if let Self::None = self { false } else { true }
3538 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3541 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3542 if let Self::Some(v) = self { v } else { unreachable!() }
3546 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3547 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3548 COption_ClosureReasonZ::Some(o)
3551 /// Constructs a new COption_ClosureReasonZ containing nothing
3552 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3553 COption_ClosureReasonZ::None
3556 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3557 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3559 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3560 /// but with all dynamically-allocated buffers duplicated in new buffers.
3561 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3563 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3564 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3565 /// A pointer to the contents in the success state.
3566 /// Reading from this pointer when `result_ok` is not set is undefined.
3567 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3568 /// A pointer to the contents in the error state.
3569 /// Reading from this pointer when `result_ok` is set is undefined.
3570 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3573 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3574 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3576 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3577 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3578 /// `err` or `result` depending on the state of `result_ok`.
3579 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3580 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3581 pub result_ok: bool,
3584 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3585 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3586 CResult_COption_ClosureReasonZDecodeErrorZ {
3587 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3588 result: Box::into_raw(Box::new(o)),
3594 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3595 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3596 CResult_COption_ClosureReasonZDecodeErrorZ {
3597 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3598 err: Box::into_raw(Box::new(e)),
3603 /// Checks if the given object is currently in the success state
3605 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3609 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3610 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3611 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3612 fn drop(&mut self) {
3614 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3615 let _ = unsafe { Box::from_raw(self.contents.result) };
3618 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3619 let _ = unsafe { Box::from_raw(self.contents.err) };
3624 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3625 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3626 let contents = if o.result_ok {
3627 let result = unsafe { o.contents.result };
3628 unsafe { o.contents.result = core::ptr::null_mut() };
3629 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3631 let err = unsafe { o.contents.err };
3632 unsafe { o.contents.err = core::ptr::null_mut(); }
3633 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3637 result_ok: o.result_ok,
3641 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3642 fn clone(&self) -> Self {
3644 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3645 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3648 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3649 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3655 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3656 /// but with all dynamically-allocated buffers duplicated in new buffers.
3657 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3660 /// An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3661 pub enum COption_HTLCDestinationZ {
3662 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3663 Some(crate::lightning::util::events::HTLCDestination),
3664 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
3667 impl COption_HTLCDestinationZ {
3668 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3669 if let Self::None = self { false } else { true }
3671 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3674 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::HTLCDestination {
3675 if let Self::Some(v) = self { v } else { unreachable!() }
3679 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
3680 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::util::events::HTLCDestination) -> COption_HTLCDestinationZ {
3681 COption_HTLCDestinationZ::Some(o)
3684 /// Constructs a new COption_HTLCDestinationZ containing nothing
3685 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
3686 COption_HTLCDestinationZ::None
3689 /// Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
3690 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
3692 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
3693 /// but with all dynamically-allocated buffers duplicated in new buffers.
3694 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
3696 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3697 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3698 /// A pointer to the contents in the success state.
3699 /// Reading from this pointer when `result_ok` is not set is undefined.
3700 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
3701 /// A pointer to the contents in the error state.
3702 /// Reading from this pointer when `result_ok` is set is undefined.
3703 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3706 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3707 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3709 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
3710 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3711 /// `err` or `result` depending on the state of `result_ok`.
3712 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
3713 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3714 pub result_ok: bool,
3717 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
3718 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3719 CResult_COption_HTLCDestinationZDecodeErrorZ {
3720 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3721 result: Box::into_raw(Box::new(o)),
3727 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
3728 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3729 CResult_COption_HTLCDestinationZDecodeErrorZ {
3730 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3731 err: Box::into_raw(Box::new(e)),
3736 /// Checks if the given object is currently in the success state
3738 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
3742 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
3743 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
3744 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
3745 fn drop(&mut self) {
3747 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3748 let _ = unsafe { Box::from_raw(self.contents.result) };
3751 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3752 let _ = unsafe { Box::from_raw(self.contents.err) };
3757 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
3758 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3759 let contents = if o.result_ok {
3760 let result = unsafe { o.contents.result };
3761 unsafe { o.contents.result = core::ptr::null_mut() };
3762 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
3764 let err = unsafe { o.contents.err };
3765 unsafe { o.contents.err = core::ptr::null_mut(); }
3766 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
3770 result_ok: o.result_ok,
3774 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
3775 fn clone(&self) -> Self {
3777 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3778 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
3781 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3782 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3788 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
3789 /// but with all dynamically-allocated buffers duplicated in new buffers.
3790 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
3793 /// An enum which can either contain a crate::c_types::U128 or not
3794 pub enum COption_u128Z {
3795 /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
3796 Some(crate::c_types::U128),
3797 /// When we're in this state, this COption_u128Z contains nothing
3800 impl COption_u128Z {
3801 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3802 if let Self::None = self { false } else { true }
3804 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3807 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
3808 if let Self::Some(v) = self { v } else { unreachable!() }
3812 /// Constructs a new COption_u128Z containing a crate::c_types::U128
3813 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
3814 COption_u128Z::Some(o)
3817 /// Constructs a new COption_u128Z containing nothing
3818 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
3822 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
3823 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
3825 /// Creates a new COption_u128Z which has the same data as `orig`
3826 /// but with all dynamically-allocated buffers duplicated in new buffers.
3827 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
3829 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3830 /// This corresponds to std::vector in C++
3831 pub struct CVec_SpendableOutputDescriptorZ {
3832 /// The elements in the array.
3833 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3834 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3835 /// The number of elements pointed to by `data`.
3838 impl CVec_SpendableOutputDescriptorZ {
3839 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3840 if self.datalen == 0 { return Vec::new(); }
3841 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3842 self.data = core::ptr::null_mut();
3846 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3847 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3850 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3851 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3852 let datalen = v.len();
3853 let data = Box::into_raw(v.into_boxed_slice());
3854 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3859 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3860 impl Drop for CVec_SpendableOutputDescriptorZ {
3861 fn drop(&mut self) {
3862 if self.datalen == 0 { return; }
3863 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3866 impl Clone for CVec_SpendableOutputDescriptorZ {
3867 fn clone(&self) -> Self {
3868 let mut res = Vec::new();
3869 if self.datalen == 0 { return Self::from(res); }
3870 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3876 /// An enum which can either contain a crate::lightning::util::events::Event or not
3877 pub enum COption_EventZ {
3878 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3879 Some(crate::lightning::util::events::Event),
3880 /// When we're in this state, this COption_EventZ contains nothing
3883 impl COption_EventZ {
3884 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3885 if let Self::None = self { false } else { true }
3887 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3890 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3891 if let Self::Some(v) = self { v } else { unreachable!() }
3895 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3896 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3897 COption_EventZ::Some(o)
3900 /// Constructs a new COption_EventZ containing nothing
3901 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3902 COption_EventZ::None
3905 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3906 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3908 /// Creates a new COption_EventZ which has the same data as `orig`
3909 /// but with all dynamically-allocated buffers duplicated in new buffers.
3910 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3912 /// The contents of CResult_COption_EventZDecodeErrorZ
3913 pub union CResult_COption_EventZDecodeErrorZPtr {
3914 /// A pointer to the contents in the success state.
3915 /// Reading from this pointer when `result_ok` is not set is undefined.
3916 pub result: *mut crate::c_types::derived::COption_EventZ,
3917 /// A pointer to the contents in the error state.
3918 /// Reading from this pointer when `result_ok` is set is undefined.
3919 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3922 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3923 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3925 pub struct CResult_COption_EventZDecodeErrorZ {
3926 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3927 /// `err` or `result` depending on the state of `result_ok`.
3928 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3929 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3930 pub result_ok: bool,
3933 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3934 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3935 CResult_COption_EventZDecodeErrorZ {
3936 contents: CResult_COption_EventZDecodeErrorZPtr {
3937 result: Box::into_raw(Box::new(o)),
3943 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3944 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3945 CResult_COption_EventZDecodeErrorZ {
3946 contents: CResult_COption_EventZDecodeErrorZPtr {
3947 err: Box::into_raw(Box::new(e)),
3952 /// Checks if the given object is currently in the success state
3954 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3958 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3959 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3960 impl Drop for CResult_COption_EventZDecodeErrorZ {
3961 fn drop(&mut self) {
3963 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3964 let _ = unsafe { Box::from_raw(self.contents.result) };
3967 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3968 let _ = unsafe { Box::from_raw(self.contents.err) };
3973 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3974 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3975 let contents = if o.result_ok {
3976 let result = unsafe { o.contents.result };
3977 unsafe { o.contents.result = core::ptr::null_mut() };
3978 CResult_COption_EventZDecodeErrorZPtr { result }
3980 let err = unsafe { o.contents.err };
3981 unsafe { o.contents.err = core::ptr::null_mut(); }
3982 CResult_COption_EventZDecodeErrorZPtr { err }
3986 result_ok: o.result_ok,
3990 impl Clone for CResult_COption_EventZDecodeErrorZ {
3991 fn clone(&self) -> Self {
3993 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3994 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3997 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3998 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4004 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
4005 /// but with all dynamically-allocated buffers duplicated in new buffers.
4006 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
4008 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4009 /// This corresponds to std::vector in C++
4010 pub struct CVec_MessageSendEventZ {
4011 /// The elements in the array.
4012 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4013 pub data: *mut crate::lightning::util::events::MessageSendEvent,
4014 /// The number of elements pointed to by `data`.
4017 impl CVec_MessageSendEventZ {
4018 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
4019 if self.datalen == 0 { return Vec::new(); }
4020 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4021 self.data = core::ptr::null_mut();
4025 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
4026 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4029 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
4030 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
4031 let datalen = v.len();
4032 let data = Box::into_raw(v.into_boxed_slice());
4033 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4037 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4038 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
4039 impl Drop for CVec_MessageSendEventZ {
4040 fn drop(&mut self) {
4041 if self.datalen == 0 { return; }
4042 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4045 impl Clone for CVec_MessageSendEventZ {
4046 fn clone(&self) -> Self {
4047 let mut res = Vec::new();
4048 if self.datalen == 0 { return Self::from(res); }
4049 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4054 /// A tuple of 2 elements. See the individual fields for the types contained.
4055 pub struct C2Tuple_usizeTransactionZ {
4056 /// The element at position 0
4058 /// The element at position 1
4059 pub b: crate::c_types::Transaction,
4061 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
4062 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
4069 impl C2Tuple_usizeTransactionZ {
4070 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
4074 impl Clone for C2Tuple_usizeTransactionZ {
4075 fn clone(&self) -> Self {
4077 a: Clone::clone(&self.a),
4078 b: Clone::clone(&self.b),
4083 /// Creates a new tuple which has the same data as `orig`
4084 /// but with all dynamically-allocated buffers duplicated in new buffers.
4085 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
4086 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
4088 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
4089 C2Tuple_usizeTransactionZ { a, b, }
4093 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
4094 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
4096 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4097 /// This corresponds to std::vector in C++
4098 pub struct CVec_C2Tuple_usizeTransactionZZ {
4099 /// The elements in the array.
4100 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4101 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
4102 /// The number of elements pointed to by `data`.
4105 impl CVec_C2Tuple_usizeTransactionZZ {
4106 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
4107 if self.datalen == 0 { return Vec::new(); }
4108 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4109 self.data = core::ptr::null_mut();
4113 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
4114 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4117 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
4118 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
4119 let datalen = v.len();
4120 let data = Box::into_raw(v.into_boxed_slice());
4121 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4125 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4126 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
4127 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
4128 fn drop(&mut self) {
4129 if self.datalen == 0 { return; }
4130 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4133 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
4134 fn clone(&self) -> Self {
4135 let mut res = Vec::new();
4136 if self.datalen == 0 { return Self::from(res); }
4137 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4142 /// A tuple of 2 elements. See the individual fields for the types contained.
4143 pub struct C2Tuple_TxidBlockHashZ {
4144 /// The element at position 0
4145 pub a: crate::c_types::ThirtyTwoBytes,
4146 /// The element at position 1
4147 pub b: crate::c_types::ThirtyTwoBytes,
4149 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_TxidBlockHashZ {
4150 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4157 impl C2Tuple_TxidBlockHashZ {
4158 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4162 impl Clone for C2Tuple_TxidBlockHashZ {
4163 fn clone(&self) -> Self {
4165 a: Clone::clone(&self.a),
4166 b: Clone::clone(&self.b),
4171 /// Creates a new tuple which has the same data as `orig`
4172 /// but with all dynamically-allocated buffers duplicated in new buffers.
4173 pub extern "C" fn C2Tuple_TxidBlockHashZ_clone(orig: &C2Tuple_TxidBlockHashZ) -> C2Tuple_TxidBlockHashZ { Clone::clone(&orig) }
4174 /// Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
4176 pub extern "C" fn C2Tuple_TxidBlockHashZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_TxidBlockHashZ {
4177 C2Tuple_TxidBlockHashZ { a, b, }
4181 /// Frees any resources used by the C2Tuple_TxidBlockHashZ.
4182 pub extern "C" fn C2Tuple_TxidBlockHashZ_free(_res: C2Tuple_TxidBlockHashZ) { }
4184 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
4185 /// This corresponds to std::vector in C++
4186 pub struct CVec_C2Tuple_TxidBlockHashZZ {
4187 /// The elements in the array.
4188 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4189 pub data: *mut crate::c_types::derived::C2Tuple_TxidBlockHashZ,
4190 /// The number of elements pointed to by `data`.
4193 impl CVec_C2Tuple_TxidBlockHashZZ {
4194 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ> {
4195 if self.datalen == 0 { return Vec::new(); }
4196 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4197 self.data = core::ptr::null_mut();
4201 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidBlockHashZ] {
4202 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4205 impl From<Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>> for CVec_C2Tuple_TxidBlockHashZZ {
4206 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>) -> Self {
4207 let datalen = v.len();
4208 let data = Box::into_raw(v.into_boxed_slice());
4209 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4213 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4214 pub extern "C" fn CVec_C2Tuple_TxidBlockHashZZ_free(_res: CVec_C2Tuple_TxidBlockHashZZ) { }
4215 impl Drop for CVec_C2Tuple_TxidBlockHashZZ {
4216 fn drop(&mut self) {
4217 if self.datalen == 0 { return; }
4218 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4221 impl Clone for CVec_C2Tuple_TxidBlockHashZZ {
4222 fn clone(&self) -> Self {
4223 let mut res = Vec::new();
4224 if self.datalen == 0 { return Self::from(res); }
4225 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4230 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4231 /// This corresponds to std::vector in C++
4232 pub struct CVec_MonitorEventZ {
4233 /// The elements in the array.
4234 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4235 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
4236 /// The number of elements pointed to by `data`.
4239 impl CVec_MonitorEventZ {
4240 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
4241 if self.datalen == 0 { return Vec::new(); }
4242 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4243 self.data = core::ptr::null_mut();
4247 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
4248 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4251 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4252 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
4253 let datalen = v.len();
4254 let data = Box::into_raw(v.into_boxed_slice());
4255 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4259 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4260 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4261 impl Drop for CVec_MonitorEventZ {
4262 fn drop(&mut self) {
4263 if self.datalen == 0 { return; }
4264 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4267 impl Clone for CVec_MonitorEventZ {
4268 fn clone(&self) -> Self {
4269 let mut res = Vec::new();
4270 if self.datalen == 0 { return Self::from(res); }
4271 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4276 /// A tuple of 3 elements. See the individual fields for the types contained.
4277 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4278 /// The element at position 0
4279 pub a: crate::lightning::chain::transaction::OutPoint,
4280 /// The element at position 1
4281 pub b: crate::c_types::derived::CVec_MonitorEventZ,
4282 /// The element at position 2
4283 pub c: crate::c_types::PublicKey,
4285 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4286 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4294 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4295 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4296 (self.a, self.b, self.c)
4299 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4300 fn clone(&self) -> Self {
4302 a: Clone::clone(&self.a),
4303 b: Clone::clone(&self.b),
4304 c: Clone::clone(&self.c),
4309 /// Creates a new tuple which has the same data as `orig`
4310 /// but with all dynamically-allocated buffers duplicated in new buffers.
4311 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4312 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4314 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4315 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4319 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4320 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4322 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4323 /// This corresponds to std::vector in C++
4324 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4325 /// The elements in the array.
4326 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4327 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4328 /// The number of elements pointed to by `data`.
4331 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4332 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4333 if self.datalen == 0 { return Vec::new(); }
4334 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4335 self.data = core::ptr::null_mut();
4339 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4340 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4343 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4344 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4345 let datalen = v.len();
4346 let data = Box::into_raw(v.into_boxed_slice());
4347 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4351 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4352 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4353 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4354 fn drop(&mut self) {
4355 if self.datalen == 0 { return; }
4356 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4359 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4360 fn clone(&self) -> Self {
4361 let mut res = Vec::new();
4362 if self.datalen == 0 { return Self::from(res); }
4363 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4368 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4369 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4370 /// A pointer to the contents in the success state.
4371 /// Reading from this pointer when `result_ok` is not set is undefined.
4372 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4373 /// A pointer to the contents in the error state.
4374 /// Reading from this pointer when `result_ok` is set is undefined.
4375 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4378 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4379 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4381 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4382 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4383 /// `err` or `result` depending on the state of `result_ok`.
4384 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4385 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4386 pub result_ok: bool,
4389 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4390 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4391 CResult_FixedPenaltyScorerDecodeErrorZ {
4392 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4393 result: Box::into_raw(Box::new(o)),
4399 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4400 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4401 CResult_FixedPenaltyScorerDecodeErrorZ {
4402 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4403 err: Box::into_raw(Box::new(e)),
4408 /// Checks if the given object is currently in the success state
4410 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4414 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4415 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4416 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4417 fn drop(&mut self) {
4419 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4420 let _ = unsafe { Box::from_raw(self.contents.result) };
4423 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4424 let _ = unsafe { Box::from_raw(self.contents.err) };
4429 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4430 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4431 let contents = if o.result_ok {
4432 let result = unsafe { o.contents.result };
4433 unsafe { o.contents.result = core::ptr::null_mut() };
4434 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4436 let err = unsafe { o.contents.err };
4437 unsafe { o.contents.err = core::ptr::null_mut(); }
4438 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4442 result_ok: o.result_ok,
4446 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4447 fn clone(&self) -> Self {
4449 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4450 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4453 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4454 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4460 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4461 /// but with all dynamically-allocated buffers duplicated in new buffers.
4462 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4464 /// A tuple of 2 elements. See the individual fields for the types contained.
4465 pub struct C2Tuple_u64u64Z {
4466 /// The element at position 0
4468 /// The element at position 1
4471 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4472 fn from (tup: (u64, u64)) -> Self {
4479 impl C2Tuple_u64u64Z {
4480 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4484 impl Clone for C2Tuple_u64u64Z {
4485 fn clone(&self) -> Self {
4487 a: Clone::clone(&self.a),
4488 b: Clone::clone(&self.b),
4493 /// Creates a new tuple which has the same data as `orig`
4494 /// but with all dynamically-allocated buffers duplicated in new buffers.
4495 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4496 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4498 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4499 C2Tuple_u64u64Z { a, b, }
4503 /// Frees any resources used by the C2Tuple_u64u64Z.
4504 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4507 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4508 pub enum COption_C2Tuple_u64u64ZZ {
4509 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4510 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4511 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4514 impl COption_C2Tuple_u64u64ZZ {
4515 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4516 if let Self::None = self { false } else { true }
4518 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4521 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4522 if let Self::Some(v) = self { v } else { unreachable!() }
4526 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4527 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4528 COption_C2Tuple_u64u64ZZ::Some(o)
4531 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4532 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4533 COption_C2Tuple_u64u64ZZ::None
4536 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4537 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4539 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4540 /// but with all dynamically-allocated buffers duplicated in new buffers.
4541 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4543 /// A tuple of 2 elements. See the individual fields for the types contained.
4544 pub struct C2Tuple_Z {
4545 /// The element at position 0
4546 pub a: crate::c_types::EightU16s,
4547 /// The element at position 1
4548 pub b: crate::c_types::EightU16s,
4550 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z {
4551 fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4559 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4563 impl Clone for C2Tuple_Z {
4564 fn clone(&self) -> Self {
4566 a: Clone::clone(&self.a),
4567 b: Clone::clone(&self.b),
4572 /// Creates a new tuple which has the same data as `orig`
4573 /// but with all dynamically-allocated buffers duplicated in new buffers.
4574 pub extern "C" fn C2Tuple_Z_clone(orig: &C2Tuple_Z) -> C2Tuple_Z { Clone::clone(&orig) }
4575 /// Creates a new C2Tuple_Z from the contained elements.
4577 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple_Z {
4582 /// Frees any resources used by the C2Tuple_Z.
4583 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4585 /// A tuple of 2 elements. See the individual fields for the types contained.
4586 pub struct C2Tuple__u168_u168Z {
4587 /// The element at position 0
4588 pub a: crate::c_types::EightU16s,
4589 /// The element at position 1
4590 pub b: crate::c_types::EightU16s,
4592 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple__u168_u168Z {
4593 fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4600 impl C2Tuple__u168_u168Z {
4601 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4605 impl Clone for C2Tuple__u168_u168Z {
4606 fn clone(&self) -> Self {
4608 a: Clone::clone(&self.a),
4609 b: Clone::clone(&self.b),
4614 /// Creates a new tuple which has the same data as `orig`
4615 /// but with all dynamically-allocated buffers duplicated in new buffers.
4616 pub extern "C" fn C2Tuple__u168_u168Z_clone(orig: &C2Tuple__u168_u168Z) -> C2Tuple__u168_u168Z { Clone::clone(&orig) }
4617 /// Creates a new C2Tuple__u168_u168Z from the contained elements.
4619 pub extern "C" fn C2Tuple__u168_u168Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple__u168_u168Z {
4620 C2Tuple__u168_u168Z { a, b, }
4624 /// Frees any resources used by the C2Tuple__u168_u168Z.
4625 pub extern "C" fn C2Tuple__u168_u168Z_free(_res: C2Tuple__u168_u168Z) { }
4628 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
4629 pub enum COption_C2Tuple_EightU16sEightU16sZZ {
4630 /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
4631 Some(crate::c_types::derived::C2Tuple__u168_u168Z),
4632 /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
4635 impl COption_C2Tuple_EightU16sEightU16sZZ {
4636 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4637 if let Self::None = self { false } else { true }
4639 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4642 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u168_u168Z {
4643 if let Self::Some(v) = self { v } else { unreachable!() }
4647 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
4648 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_some(o: crate::c_types::derived::C2Tuple__u168_u168Z) -> COption_C2Tuple_EightU16sEightU16sZZ {
4649 COption_C2Tuple_EightU16sEightU16sZZ::Some(o)
4652 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
4653 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_none() -> COption_C2Tuple_EightU16sEightU16sZZ {
4654 COption_C2Tuple_EightU16sEightU16sZZ::None
4657 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
4658 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_free(_res: COption_C2Tuple_EightU16sEightU16sZZ) { }
4660 /// Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
4661 /// but with all dynamically-allocated buffers duplicated in new buffers.
4662 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_clone(orig: &COption_C2Tuple_EightU16sEightU16sZZ) -> COption_C2Tuple_EightU16sEightU16sZZ { Clone::clone(&orig) }
4664 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4665 /// This corresponds to std::vector in C++
4666 pub struct CVec_NodeIdZ {
4667 /// The elements in the array.
4668 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4669 pub data: *mut crate::lightning::routing::gossip::NodeId,
4670 /// The number of elements pointed to by `data`.
4674 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4675 if self.datalen == 0 { return Vec::new(); }
4676 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4677 self.data = core::ptr::null_mut();
4681 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4682 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4685 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4686 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4687 let datalen = v.len();
4688 let data = Box::into_raw(v.into_boxed_slice());
4689 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4693 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4694 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4695 impl Drop for CVec_NodeIdZ {
4696 fn drop(&mut self) {
4697 if self.datalen == 0 { return; }
4698 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4701 impl Clone for CVec_NodeIdZ {
4702 fn clone(&self) -> Self {
4703 let mut res = Vec::new();
4704 if self.datalen == 0 { return Self::from(res); }
4705 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4710 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4711 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4712 /// A pointer to the contents in the success state.
4713 /// Reading from this pointer when `result_ok` is not set is undefined.
4714 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4715 /// A pointer to the contents in the error state.
4716 /// Reading from this pointer when `result_ok` is set is undefined.
4717 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4720 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4721 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4723 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4724 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4725 /// `err` or `result` depending on the state of `result_ok`.
4726 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4727 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4728 pub result_ok: bool,
4731 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4732 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4733 CResult_ProbabilisticScorerDecodeErrorZ {
4734 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4735 result: Box::into_raw(Box::new(o)),
4741 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4742 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4743 CResult_ProbabilisticScorerDecodeErrorZ {
4744 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4745 err: Box::into_raw(Box::new(e)),
4750 /// Checks if the given object is currently in the success state
4752 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4756 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4757 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4758 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4759 fn drop(&mut self) {
4761 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4762 let _ = unsafe { Box::from_raw(self.contents.result) };
4765 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4766 let _ = unsafe { Box::from_raw(self.contents.err) };
4771 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4772 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4773 let contents = if o.result_ok {
4774 let result = unsafe { o.contents.result };
4775 unsafe { o.contents.result = core::ptr::null_mut() };
4776 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4778 let err = unsafe { o.contents.err };
4779 unsafe { o.contents.err = core::ptr::null_mut(); }
4780 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4784 result_ok: o.result_ok,
4789 /// The contents of CResult_InitFeaturesDecodeErrorZ
4790 pub union CResult_InitFeaturesDecodeErrorZPtr {
4791 /// A pointer to the contents in the success state.
4792 /// Reading from this pointer when `result_ok` is not set is undefined.
4793 pub result: *mut crate::lightning::ln::features::InitFeatures,
4794 /// A pointer to the contents in the error state.
4795 /// Reading from this pointer when `result_ok` is set is undefined.
4796 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4799 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4800 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4801 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4802 pub struct CResult_InitFeaturesDecodeErrorZ {
4803 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4804 /// `err` or `result` depending on the state of `result_ok`.
4805 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4806 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4807 pub result_ok: bool,
4810 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4811 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4812 CResult_InitFeaturesDecodeErrorZ {
4813 contents: CResult_InitFeaturesDecodeErrorZPtr {
4814 result: Box::into_raw(Box::new(o)),
4820 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4821 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4822 CResult_InitFeaturesDecodeErrorZ {
4823 contents: CResult_InitFeaturesDecodeErrorZPtr {
4824 err: Box::into_raw(Box::new(e)),
4829 /// Checks if the given object is currently in the success state
4831 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4835 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4836 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4837 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4838 fn drop(&mut self) {
4840 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4841 let _ = unsafe { Box::from_raw(self.contents.result) };
4844 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4845 let _ = unsafe { Box::from_raw(self.contents.err) };
4850 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4851 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4852 let contents = if o.result_ok {
4853 let result = unsafe { o.contents.result };
4854 unsafe { o.contents.result = core::ptr::null_mut() };
4855 CResult_InitFeaturesDecodeErrorZPtr { result }
4857 let err = unsafe { o.contents.err };
4858 unsafe { o.contents.err = core::ptr::null_mut(); }
4859 CResult_InitFeaturesDecodeErrorZPtr { err }
4863 result_ok: o.result_ok,
4867 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4868 fn clone(&self) -> Self {
4870 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4871 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4874 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4875 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4881 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4882 /// but with all dynamically-allocated buffers duplicated in new buffers.
4883 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4885 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4886 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4887 /// A pointer to the contents in the success state.
4888 /// Reading from this pointer when `result_ok` is not set is undefined.
4889 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4890 /// A pointer to the contents in the error state.
4891 /// Reading from this pointer when `result_ok` is set is undefined.
4892 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4895 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4896 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4897 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4898 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4899 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4900 /// `err` or `result` depending on the state of `result_ok`.
4901 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4902 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4903 pub result_ok: bool,
4906 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4907 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4908 CResult_ChannelFeaturesDecodeErrorZ {
4909 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4910 result: Box::into_raw(Box::new(o)),
4916 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4917 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4918 CResult_ChannelFeaturesDecodeErrorZ {
4919 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4920 err: Box::into_raw(Box::new(e)),
4925 /// Checks if the given object is currently in the success state
4927 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4931 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4932 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4933 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4934 fn drop(&mut self) {
4936 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4937 let _ = unsafe { Box::from_raw(self.contents.result) };
4940 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4941 let _ = unsafe { Box::from_raw(self.contents.err) };
4946 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4947 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4948 let contents = if o.result_ok {
4949 let result = unsafe { o.contents.result };
4950 unsafe { o.contents.result = core::ptr::null_mut() };
4951 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4953 let err = unsafe { o.contents.err };
4954 unsafe { o.contents.err = core::ptr::null_mut(); }
4955 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4959 result_ok: o.result_ok,
4963 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4964 fn clone(&self) -> Self {
4966 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4967 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4970 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4971 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4977 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4978 /// but with all dynamically-allocated buffers duplicated in new buffers.
4979 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4981 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4982 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4983 /// A pointer to the contents in the success state.
4984 /// Reading from this pointer when `result_ok` is not set is undefined.
4985 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4986 /// A pointer to the contents in the error state.
4987 /// Reading from this pointer when `result_ok` is set is undefined.
4988 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4991 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4992 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4993 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4994 pub struct CResult_NodeFeaturesDecodeErrorZ {
4995 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4996 /// `err` or `result` depending on the state of `result_ok`.
4997 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4998 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4999 pub result_ok: bool,
5002 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5003 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5004 CResult_NodeFeaturesDecodeErrorZ {
5005 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5006 result: Box::into_raw(Box::new(o)),
5012 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5013 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5014 CResult_NodeFeaturesDecodeErrorZ {
5015 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5016 err: Box::into_raw(Box::new(e)),
5021 /// Checks if the given object is currently in the success state
5023 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
5027 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5028 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5029 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5030 fn drop(&mut self) {
5032 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5033 let _ = unsafe { Box::from_raw(self.contents.result) };
5036 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5037 let _ = unsafe { Box::from_raw(self.contents.err) };
5042 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5043 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5044 let contents = if o.result_ok {
5045 let result = unsafe { o.contents.result };
5046 unsafe { o.contents.result = core::ptr::null_mut() };
5047 CResult_NodeFeaturesDecodeErrorZPtr { result }
5049 let err = unsafe { o.contents.err };
5050 unsafe { o.contents.err = core::ptr::null_mut(); }
5051 CResult_NodeFeaturesDecodeErrorZPtr { err }
5055 result_ok: o.result_ok,
5059 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
5060 fn clone(&self) -> Self {
5062 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5063 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
5066 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5067 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5073 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
5074 /// but with all dynamically-allocated buffers duplicated in new buffers.
5075 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5077 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
5078 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
5079 /// A pointer to the contents in the success state.
5080 /// Reading from this pointer when `result_ok` is not set is undefined.
5081 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
5082 /// A pointer to the contents in the error state.
5083 /// Reading from this pointer when `result_ok` is set is undefined.
5084 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5087 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5088 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5090 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
5091 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5092 /// `err` or `result` depending on the state of `result_ok`.
5093 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
5094 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5095 pub result_ok: bool,
5098 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
5099 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
5100 CResult_InvoiceFeaturesDecodeErrorZ {
5101 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5102 result: Box::into_raw(Box::new(o)),
5108 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
5109 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
5110 CResult_InvoiceFeaturesDecodeErrorZ {
5111 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5112 err: Box::into_raw(Box::new(e)),
5117 /// Checks if the given object is currently in the success state
5119 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
5123 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
5124 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
5125 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
5126 fn drop(&mut self) {
5128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5129 let _ = unsafe { Box::from_raw(self.contents.result) };
5132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5133 let _ = unsafe { Box::from_raw(self.contents.err) };
5138 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
5139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5140 let contents = if o.result_ok {
5141 let result = unsafe { o.contents.result };
5142 unsafe { o.contents.result = core::ptr::null_mut() };
5143 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
5145 let err = unsafe { o.contents.err };
5146 unsafe { o.contents.err = core::ptr::null_mut(); }
5147 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
5151 result_ok: o.result_ok,
5155 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
5156 fn clone(&self) -> Self {
5158 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5159 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5162 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5169 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5170 /// but with all dynamically-allocated buffers duplicated in new buffers.
5171 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5173 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
5174 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
5175 /// A pointer to the contents in the success state.
5176 /// Reading from this pointer when `result_ok` is not set is undefined.
5177 pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
5178 /// A pointer to the contents in the error state.
5179 /// Reading from this pointer when `result_ok` is set is undefined.
5180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5183 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
5184 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5186 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
5187 /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
5188 /// `err` or `result` depending on the state of `result_ok`.
5189 pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
5190 /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
5191 pub result_ok: bool,
5194 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
5195 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5196 CResult_BlindedHopFeaturesDecodeErrorZ {
5197 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5198 result: Box::into_raw(Box::new(o)),
5204 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
5205 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5206 CResult_BlindedHopFeaturesDecodeErrorZ {
5207 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5208 err: Box::into_raw(Box::new(e)),
5213 /// Checks if the given object is currently in the success state
5215 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
5219 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
5220 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
5221 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
5222 fn drop(&mut self) {
5224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5225 let _ = unsafe { Box::from_raw(self.contents.result) };
5228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5229 let _ = unsafe { Box::from_raw(self.contents.err) };
5234 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
5235 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5236 let contents = if o.result_ok {
5237 let result = unsafe { o.contents.result };
5238 unsafe { o.contents.result = core::ptr::null_mut() };
5239 CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
5241 let err = unsafe { o.contents.err };
5242 unsafe { o.contents.err = core::ptr::null_mut(); }
5243 CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
5247 result_ok: o.result_ok,
5251 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
5252 fn clone(&self) -> Self {
5254 Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5255 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
5258 Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5259 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5265 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
5266 /// but with all dynamically-allocated buffers duplicated in new buffers.
5267 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
5269 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5270 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5271 /// A pointer to the contents in the success state.
5272 /// Reading from this pointer when `result_ok` is not set is undefined.
5273 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
5274 /// A pointer to the contents in the error state.
5275 /// Reading from this pointer when `result_ok` is set is undefined.
5276 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5279 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5280 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5282 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
5283 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5284 /// `err` or `result` depending on the state of `result_ok`.
5285 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
5286 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5287 pub result_ok: bool,
5290 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
5291 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5292 CResult_ChannelTypeFeaturesDecodeErrorZ {
5293 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5294 result: Box::into_raw(Box::new(o)),
5300 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
5301 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5302 CResult_ChannelTypeFeaturesDecodeErrorZ {
5303 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5304 err: Box::into_raw(Box::new(e)),
5309 /// Checks if the given object is currently in the success state
5311 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
5315 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
5316 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
5317 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
5318 fn drop(&mut self) {
5320 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5321 let _ = unsafe { Box::from_raw(self.contents.result) };
5324 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5325 let _ = unsafe { Box::from_raw(self.contents.err) };
5330 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
5331 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5332 let contents = if o.result_ok {
5333 let result = unsafe { o.contents.result };
5334 unsafe { o.contents.result = core::ptr::null_mut() };
5335 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
5337 let err = unsafe { o.contents.err };
5338 unsafe { o.contents.err = core::ptr::null_mut(); }
5339 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
5343 result_ok: o.result_ok,
5347 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
5348 fn clone(&self) -> Self {
5350 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5351 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
5354 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5355 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5361 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
5362 /// but with all dynamically-allocated buffers duplicated in new buffers.
5363 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5365 /// The contents of CResult_NodeIdDecodeErrorZ
5366 pub union CResult_NodeIdDecodeErrorZPtr {
5367 /// A pointer to the contents in the success state.
5368 /// Reading from this pointer when `result_ok` is not set is undefined.
5369 pub result: *mut crate::lightning::routing::gossip::NodeId,
5370 /// A pointer to the contents in the error state.
5371 /// Reading from this pointer when `result_ok` is set is undefined.
5372 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5375 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5376 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5378 pub struct CResult_NodeIdDecodeErrorZ {
5379 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5380 /// `err` or `result` depending on the state of `result_ok`.
5381 pub contents: CResult_NodeIdDecodeErrorZPtr,
5382 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5383 pub result_ok: bool,
5386 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5387 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5388 CResult_NodeIdDecodeErrorZ {
5389 contents: CResult_NodeIdDecodeErrorZPtr {
5390 result: Box::into_raw(Box::new(o)),
5396 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5397 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5398 CResult_NodeIdDecodeErrorZ {
5399 contents: CResult_NodeIdDecodeErrorZPtr {
5400 err: Box::into_raw(Box::new(e)),
5405 /// Checks if the given object is currently in the success state
5407 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5411 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5412 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5413 impl Drop for CResult_NodeIdDecodeErrorZ {
5414 fn drop(&mut self) {
5416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5417 let _ = unsafe { Box::from_raw(self.contents.result) };
5420 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5421 let _ = unsafe { Box::from_raw(self.contents.err) };
5426 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5427 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5428 let contents = if o.result_ok {
5429 let result = unsafe { o.contents.result };
5430 unsafe { o.contents.result = core::ptr::null_mut() };
5431 CResult_NodeIdDecodeErrorZPtr { result }
5433 let err = unsafe { o.contents.err };
5434 unsafe { o.contents.err = core::ptr::null_mut(); }
5435 CResult_NodeIdDecodeErrorZPtr { err }
5439 result_ok: o.result_ok,
5443 impl Clone for CResult_NodeIdDecodeErrorZ {
5444 fn clone(&self) -> Self {
5446 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5447 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5450 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5451 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5457 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5458 /// but with all dynamically-allocated buffers duplicated in new buffers.
5459 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5461 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5462 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5463 /// A pointer to the contents in the success state.
5464 /// Reading from this pointer when `result_ok` is not set is undefined.
5465 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
5466 /// A pointer to the contents in the error state.
5467 /// Reading from this pointer when `result_ok` is set is undefined.
5468 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5471 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5472 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5474 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
5475 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5476 /// `err` or `result` depending on the state of `result_ok`.
5477 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
5478 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5479 pub result_ok: bool,
5482 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
5483 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5484 CResult_COption_NetworkUpdateZDecodeErrorZ {
5485 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5486 result: Box::into_raw(Box::new(o)),
5492 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
5493 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5494 CResult_COption_NetworkUpdateZDecodeErrorZ {
5495 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5496 err: Box::into_raw(Box::new(e)),
5501 /// Checks if the given object is currently in the success state
5503 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
5507 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
5508 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
5509 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
5510 fn drop(&mut self) {
5512 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5513 let _ = unsafe { Box::from_raw(self.contents.result) };
5516 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5517 let _ = unsafe { Box::from_raw(self.contents.err) };
5522 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
5523 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5524 let contents = if o.result_ok {
5525 let result = unsafe { o.contents.result };
5526 unsafe { o.contents.result = core::ptr::null_mut() };
5527 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
5529 let err = unsafe { o.contents.err };
5530 unsafe { o.contents.err = core::ptr::null_mut(); }
5531 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
5535 result_ok: o.result_ok,
5539 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
5540 fn clone(&self) -> Self {
5542 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5543 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5546 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5547 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5553 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5554 /// but with all dynamically-allocated buffers duplicated in new buffers.
5555 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5557 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
5558 pub enum COption_UtxoLookupZ {
5559 /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
5560 Some(crate::lightning::routing::utxo::UtxoLookup),
5561 /// When we're in this state, this COption_UtxoLookupZ contains nothing
5564 impl COption_UtxoLookupZ {
5565 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5566 if let Self::None = self { false } else { true }
5568 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5571 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
5572 if let Self::Some(v) = self { v } else { unreachable!() }
5576 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
5577 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
5578 COption_UtxoLookupZ::Some(o)
5581 /// Constructs a new COption_UtxoLookupZ containing nothing
5582 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
5583 COption_UtxoLookupZ::None
5586 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
5587 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
5589 /// The contents of CResult_boolLightningErrorZ
5590 pub union CResult_boolLightningErrorZPtr {
5591 /// A pointer to the contents in the success state.
5592 /// Reading from this pointer when `result_ok` is not set is undefined.
5593 pub result: *mut bool,
5594 /// A pointer to the contents in the error state.
5595 /// Reading from this pointer when `result_ok` is set is undefined.
5596 pub err: *mut crate::lightning::ln::msgs::LightningError,
5599 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5600 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5602 pub struct CResult_boolLightningErrorZ {
5603 /// The contents of this CResult_boolLightningErrorZ, accessible via either
5604 /// `err` or `result` depending on the state of `result_ok`.
5605 pub contents: CResult_boolLightningErrorZPtr,
5606 /// Whether this CResult_boolLightningErrorZ represents a success state.
5607 pub result_ok: bool,
5610 /// Creates a new CResult_boolLightningErrorZ in the success state.
5611 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5612 CResult_boolLightningErrorZ {
5613 contents: CResult_boolLightningErrorZPtr {
5614 result: Box::into_raw(Box::new(o)),
5620 /// Creates a new CResult_boolLightningErrorZ in the error state.
5621 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5622 CResult_boolLightningErrorZ {
5623 contents: CResult_boolLightningErrorZPtr {
5624 err: Box::into_raw(Box::new(e)),
5629 /// Checks if the given object is currently in the success state
5631 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5635 /// Frees any resources used by the CResult_boolLightningErrorZ.
5636 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5637 impl Drop for CResult_boolLightningErrorZ {
5638 fn drop(&mut self) {
5640 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5641 let _ = unsafe { Box::from_raw(self.contents.result) };
5644 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5645 let _ = unsafe { Box::from_raw(self.contents.err) };
5650 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5651 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5652 let contents = if o.result_ok {
5653 let result = unsafe { o.contents.result };
5654 unsafe { o.contents.result = core::ptr::null_mut() };
5655 CResult_boolLightningErrorZPtr { result }
5657 let err = unsafe { o.contents.err };
5658 unsafe { o.contents.err = core::ptr::null_mut(); }
5659 CResult_boolLightningErrorZPtr { err }
5663 result_ok: o.result_ok,
5667 impl Clone for CResult_boolLightningErrorZ {
5668 fn clone(&self) -> Self {
5670 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5671 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5674 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5675 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5681 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5682 /// but with all dynamically-allocated buffers duplicated in new buffers.
5683 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5685 /// A tuple of 3 elements. See the individual fields for the types contained.
5686 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5687 /// The element at position 0
5688 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5689 /// The element at position 1
5690 pub b: crate::lightning::ln::msgs::ChannelUpdate,
5691 /// The element at position 2
5692 pub c: crate::lightning::ln::msgs::ChannelUpdate,
5694 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5695 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5703 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5704 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5705 (self.a, self.b, self.c)
5708 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5709 fn clone(&self) -> Self {
5711 a: Clone::clone(&self.a),
5712 b: Clone::clone(&self.b),
5713 c: Clone::clone(&self.c),
5718 /// Creates a new tuple which has the same data as `orig`
5719 /// but with all dynamically-allocated buffers duplicated in new buffers.
5720 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5721 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5723 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 {
5724 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5728 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5729 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5732 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5733 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5734 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5735 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
5736 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5739 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5740 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5741 if let Self::None = self { false } else { true }
5743 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5746 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5747 if let Self::Some(v) = self { v } else { unreachable!() }
5751 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5752 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5753 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
5756 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
5757 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5758 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
5761 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
5762 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5764 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
5765 /// but with all dynamically-allocated buffers duplicated in new buffers.
5766 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
5768 /// The contents of CResult_NoneLightningErrorZ
5769 pub union CResult_NoneLightningErrorZPtr {
5770 /// Note that this value is always NULL, as there are no contents in the OK variant
5771 pub result: *mut core::ffi::c_void,
5772 /// A pointer to the contents in the error state.
5773 /// Reading from this pointer when `result_ok` is set is undefined.
5774 pub err: *mut crate::lightning::ln::msgs::LightningError,
5777 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5778 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5779 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5780 pub struct CResult_NoneLightningErrorZ {
5781 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5782 /// `err` or `result` depending on the state of `result_ok`.
5783 pub contents: CResult_NoneLightningErrorZPtr,
5784 /// Whether this CResult_NoneLightningErrorZ represents a success state.
5785 pub result_ok: bool,
5788 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5789 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5790 CResult_NoneLightningErrorZ {
5791 contents: CResult_NoneLightningErrorZPtr {
5792 result: core::ptr::null_mut(),
5798 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5799 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5800 CResult_NoneLightningErrorZ {
5801 contents: CResult_NoneLightningErrorZPtr {
5802 err: Box::into_raw(Box::new(e)),
5807 /// Checks if the given object is currently in the success state
5809 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5813 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5814 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5815 impl Drop for CResult_NoneLightningErrorZ {
5816 fn drop(&mut self) {
5819 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5820 let _ = unsafe { Box::from_raw(self.contents.err) };
5825 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5826 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5827 let contents = if o.result_ok {
5828 let _ = unsafe { Box::from_raw(o.contents.result) };
5829 o.contents.result = core::ptr::null_mut();
5830 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5832 let err = unsafe { o.contents.err };
5833 unsafe { o.contents.err = core::ptr::null_mut(); }
5834 CResult_NoneLightningErrorZPtr { err }
5838 result_ok: o.result_ok,
5842 impl Clone for CResult_NoneLightningErrorZ {
5843 fn clone(&self) -> Self {
5845 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5846 result: core::ptr::null_mut()
5849 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5850 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5856 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5857 /// but with all dynamically-allocated buffers duplicated in new buffers.
5858 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5860 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5861 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5862 /// A pointer to the contents in the success state.
5863 /// Reading from this pointer when `result_ok` is not set is undefined.
5864 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5865 /// A pointer to the contents in the error state.
5866 /// Reading from this pointer when `result_ok` is set is undefined.
5867 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5870 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5871 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5872 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5873 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5874 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5875 /// `err` or `result` depending on the state of `result_ok`.
5876 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5877 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5878 pub result_ok: bool,
5881 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5882 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5883 CResult_ChannelUpdateInfoDecodeErrorZ {
5884 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5885 result: Box::into_raw(Box::new(o)),
5891 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5892 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5893 CResult_ChannelUpdateInfoDecodeErrorZ {
5894 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5895 err: Box::into_raw(Box::new(e)),
5900 /// Checks if the given object is currently in the success state
5902 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5906 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5907 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5908 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5909 fn drop(&mut self) {
5911 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5912 let _ = unsafe { Box::from_raw(self.contents.result) };
5915 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5916 let _ = unsafe { Box::from_raw(self.contents.err) };
5921 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5922 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5923 let contents = if o.result_ok {
5924 let result = unsafe { o.contents.result };
5925 unsafe { o.contents.result = core::ptr::null_mut() };
5926 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5928 let err = unsafe { o.contents.err };
5929 unsafe { o.contents.err = core::ptr::null_mut(); }
5930 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5934 result_ok: o.result_ok,
5938 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5939 fn clone(&self) -> Self {
5941 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5942 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5945 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5946 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5952 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5953 /// but with all dynamically-allocated buffers duplicated in new buffers.
5954 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5956 /// The contents of CResult_ChannelInfoDecodeErrorZ
5957 pub union CResult_ChannelInfoDecodeErrorZPtr {
5958 /// A pointer to the contents in the success state.
5959 /// Reading from this pointer when `result_ok` is not set is undefined.
5960 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5961 /// A pointer to the contents in the error state.
5962 /// Reading from this pointer when `result_ok` is set is undefined.
5963 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5966 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5967 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5969 pub struct CResult_ChannelInfoDecodeErrorZ {
5970 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5971 /// `err` or `result` depending on the state of `result_ok`.
5972 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5973 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5974 pub result_ok: bool,
5977 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5978 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5979 CResult_ChannelInfoDecodeErrorZ {
5980 contents: CResult_ChannelInfoDecodeErrorZPtr {
5981 result: Box::into_raw(Box::new(o)),
5987 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5988 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5989 CResult_ChannelInfoDecodeErrorZ {
5990 contents: CResult_ChannelInfoDecodeErrorZPtr {
5991 err: Box::into_raw(Box::new(e)),
5996 /// Checks if the given object is currently in the success state
5998 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
6002 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6003 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6004 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6005 fn drop(&mut self) {
6007 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6008 let _ = unsafe { Box::from_raw(self.contents.result) };
6011 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6012 let _ = unsafe { Box::from_raw(self.contents.err) };
6017 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6018 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6019 let contents = if o.result_ok {
6020 let result = unsafe { o.contents.result };
6021 unsafe { o.contents.result = core::ptr::null_mut() };
6022 CResult_ChannelInfoDecodeErrorZPtr { result }
6024 let err = unsafe { o.contents.err };
6025 unsafe { o.contents.err = core::ptr::null_mut(); }
6026 CResult_ChannelInfoDecodeErrorZPtr { err }
6030 result_ok: o.result_ok,
6034 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6035 fn clone(&self) -> Self {
6037 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6038 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6041 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6042 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6048 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6049 /// but with all dynamically-allocated buffers duplicated in new buffers.
6050 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
6052 /// The contents of CResult_RoutingFeesDecodeErrorZ
6053 pub union CResult_RoutingFeesDecodeErrorZPtr {
6054 /// A pointer to the contents in the success state.
6055 /// Reading from this pointer when `result_ok` is not set is undefined.
6056 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
6057 /// A pointer to the contents in the error state.
6058 /// Reading from this pointer when `result_ok` is set is undefined.
6059 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6062 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6063 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6065 pub struct CResult_RoutingFeesDecodeErrorZ {
6066 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6067 /// `err` or `result` depending on the state of `result_ok`.
6068 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
6069 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6070 pub result_ok: bool,
6073 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
6074 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
6075 CResult_RoutingFeesDecodeErrorZ {
6076 contents: CResult_RoutingFeesDecodeErrorZPtr {
6077 result: Box::into_raw(Box::new(o)),
6083 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
6084 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
6085 CResult_RoutingFeesDecodeErrorZ {
6086 contents: CResult_RoutingFeesDecodeErrorZPtr {
6087 err: Box::into_raw(Box::new(e)),
6092 /// Checks if the given object is currently in the success state
6094 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
6098 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
6099 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
6100 impl Drop for CResult_RoutingFeesDecodeErrorZ {
6101 fn drop(&mut self) {
6103 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6104 let _ = unsafe { Box::from_raw(self.contents.result) };
6107 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6108 let _ = unsafe { Box::from_raw(self.contents.err) };
6113 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
6114 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
6115 let contents = if o.result_ok {
6116 let result = unsafe { o.contents.result };
6117 unsafe { o.contents.result = core::ptr::null_mut() };
6118 CResult_RoutingFeesDecodeErrorZPtr { result }
6120 let err = unsafe { o.contents.err };
6121 unsafe { o.contents.err = core::ptr::null_mut(); }
6122 CResult_RoutingFeesDecodeErrorZPtr { err }
6126 result_ok: o.result_ok,
6130 impl Clone for CResult_RoutingFeesDecodeErrorZ {
6131 fn clone(&self) -> Self {
6133 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
6134 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
6137 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
6138 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6144 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
6145 /// but with all dynamically-allocated buffers duplicated in new buffers.
6146 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
6148 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6149 /// This corresponds to std::vector in C++
6150 pub struct CVec_NetAddressZ {
6151 /// The elements in the array.
6152 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6153 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6154 /// The number of elements pointed to by `data`.
6157 impl CVec_NetAddressZ {
6158 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6159 if self.datalen == 0 { return Vec::new(); }
6160 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6161 self.data = core::ptr::null_mut();
6165 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6166 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6169 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6170 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6171 let datalen = v.len();
6172 let data = Box::into_raw(v.into_boxed_slice());
6173 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6178 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6179 impl Drop for CVec_NetAddressZ {
6180 fn drop(&mut self) {
6181 if self.datalen == 0 { return; }
6182 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6185 impl Clone for CVec_NetAddressZ {
6186 fn clone(&self) -> Self {
6187 let mut res = Vec::new();
6188 if self.datalen == 0 { return Self::from(res); }
6189 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6194 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6195 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6196 /// A pointer to the contents in the success state.
6197 /// Reading from this pointer when `result_ok` is not set is undefined.
6198 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
6199 /// A pointer to the contents in the error state.
6200 /// Reading from this pointer when `result_ok` is set is undefined.
6201 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6204 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6205 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6207 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
6208 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6209 /// `err` or `result` depending on the state of `result_ok`.
6210 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
6211 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6212 pub result_ok: bool,
6215 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
6216 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6217 CResult_NodeAnnouncementInfoDecodeErrorZ {
6218 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6219 result: Box::into_raw(Box::new(o)),
6225 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
6226 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6227 CResult_NodeAnnouncementInfoDecodeErrorZ {
6228 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6229 err: Box::into_raw(Box::new(e)),
6234 /// Checks if the given object is currently in the success state
6236 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
6240 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
6241 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
6242 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
6243 fn drop(&mut self) {
6245 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6246 let _ = unsafe { Box::from_raw(self.contents.result) };
6249 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6250 let _ = unsafe { Box::from_raw(self.contents.err) };
6255 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6256 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6257 let contents = if o.result_ok {
6258 let result = unsafe { o.contents.result };
6259 unsafe { o.contents.result = core::ptr::null_mut() };
6260 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6262 let err = unsafe { o.contents.err };
6263 unsafe { o.contents.err = core::ptr::null_mut(); }
6264 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6268 result_ok: o.result_ok,
6272 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6273 fn clone(&self) -> Self {
6275 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6276 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6279 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6280 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6286 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6287 /// but with all dynamically-allocated buffers duplicated in new buffers.
6288 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6290 /// The contents of CResult_NodeAliasDecodeErrorZ
6291 pub union CResult_NodeAliasDecodeErrorZPtr {
6292 /// A pointer to the contents in the success state.
6293 /// Reading from this pointer when `result_ok` is not set is undefined.
6294 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6295 /// A pointer to the contents in the error state.
6296 /// Reading from this pointer when `result_ok` is set is undefined.
6297 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6300 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6301 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6303 pub struct CResult_NodeAliasDecodeErrorZ {
6304 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6305 /// `err` or `result` depending on the state of `result_ok`.
6306 pub contents: CResult_NodeAliasDecodeErrorZPtr,
6307 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6308 pub result_ok: bool,
6311 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6312 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6313 CResult_NodeAliasDecodeErrorZ {
6314 contents: CResult_NodeAliasDecodeErrorZPtr {
6315 result: Box::into_raw(Box::new(o)),
6321 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6322 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6323 CResult_NodeAliasDecodeErrorZ {
6324 contents: CResult_NodeAliasDecodeErrorZPtr {
6325 err: Box::into_raw(Box::new(e)),
6330 /// Checks if the given object is currently in the success state
6332 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6336 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6337 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6338 impl Drop for CResult_NodeAliasDecodeErrorZ {
6339 fn drop(&mut self) {
6341 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6342 let _ = unsafe { Box::from_raw(self.contents.result) };
6345 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6346 let _ = unsafe { Box::from_raw(self.contents.err) };
6351 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6352 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6353 let contents = if o.result_ok {
6354 let result = unsafe { o.contents.result };
6355 unsafe { o.contents.result = core::ptr::null_mut() };
6356 CResult_NodeAliasDecodeErrorZPtr { result }
6358 let err = unsafe { o.contents.err };
6359 unsafe { o.contents.err = core::ptr::null_mut(); }
6360 CResult_NodeAliasDecodeErrorZPtr { err }
6364 result_ok: o.result_ok,
6368 impl Clone for CResult_NodeAliasDecodeErrorZ {
6369 fn clone(&self) -> Self {
6371 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6372 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6375 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6376 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6382 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6383 /// but with all dynamically-allocated buffers duplicated in new buffers.
6384 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6386 /// The contents of CResult_NodeInfoDecodeErrorZ
6387 pub union CResult_NodeInfoDecodeErrorZPtr {
6388 /// A pointer to the contents in the success state.
6389 /// Reading from this pointer when `result_ok` is not set is undefined.
6390 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6391 /// A pointer to the contents in the error state.
6392 /// Reading from this pointer when `result_ok` is set is undefined.
6393 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6396 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6397 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6399 pub struct CResult_NodeInfoDecodeErrorZ {
6400 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6401 /// `err` or `result` depending on the state of `result_ok`.
6402 pub contents: CResult_NodeInfoDecodeErrorZPtr,
6403 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6404 pub result_ok: bool,
6407 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6408 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6409 CResult_NodeInfoDecodeErrorZ {
6410 contents: CResult_NodeInfoDecodeErrorZPtr {
6411 result: Box::into_raw(Box::new(o)),
6417 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6418 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6419 CResult_NodeInfoDecodeErrorZ {
6420 contents: CResult_NodeInfoDecodeErrorZPtr {
6421 err: Box::into_raw(Box::new(e)),
6426 /// Checks if the given object is currently in the success state
6428 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
6432 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
6433 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
6434 impl Drop for CResult_NodeInfoDecodeErrorZ {
6435 fn drop(&mut self) {
6437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6438 let _ = unsafe { Box::from_raw(self.contents.result) };
6441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6442 let _ = unsafe { Box::from_raw(self.contents.err) };
6447 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
6448 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6449 let contents = if o.result_ok {
6450 let result = unsafe { o.contents.result };
6451 unsafe { o.contents.result = core::ptr::null_mut() };
6452 CResult_NodeInfoDecodeErrorZPtr { result }
6454 let err = unsafe { o.contents.err };
6455 unsafe { o.contents.err = core::ptr::null_mut(); }
6456 CResult_NodeInfoDecodeErrorZPtr { err }
6460 result_ok: o.result_ok,
6464 impl Clone for CResult_NodeInfoDecodeErrorZ {
6465 fn clone(&self) -> Self {
6467 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
6468 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
6471 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
6472 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6478 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
6479 /// but with all dynamically-allocated buffers duplicated in new buffers.
6480 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
6482 /// The contents of CResult_NetworkGraphDecodeErrorZ
6483 pub union CResult_NetworkGraphDecodeErrorZPtr {
6484 /// A pointer to the contents in the success state.
6485 /// Reading from this pointer when `result_ok` is not set is undefined.
6486 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
6487 /// A pointer to the contents in the error state.
6488 /// Reading from this pointer when `result_ok` is set is undefined.
6489 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6492 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6493 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6495 pub struct CResult_NetworkGraphDecodeErrorZ {
6496 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6497 /// `err` or `result` depending on the state of `result_ok`.
6498 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6499 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6500 pub result_ok: bool,
6503 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6504 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6505 CResult_NetworkGraphDecodeErrorZ {
6506 contents: CResult_NetworkGraphDecodeErrorZPtr {
6507 result: Box::into_raw(Box::new(o)),
6513 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6514 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6515 CResult_NetworkGraphDecodeErrorZ {
6516 contents: CResult_NetworkGraphDecodeErrorZPtr {
6517 err: Box::into_raw(Box::new(e)),
6522 /// Checks if the given object is currently in the success state
6524 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6528 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6529 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6530 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6531 fn drop(&mut self) {
6533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6534 let _ = unsafe { Box::from_raw(self.contents.result) };
6537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6538 let _ = unsafe { Box::from_raw(self.contents.err) };
6543 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6544 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6545 let contents = if o.result_ok {
6546 let result = unsafe { o.contents.result };
6547 unsafe { o.contents.result = core::ptr::null_mut() };
6548 CResult_NetworkGraphDecodeErrorZPtr { result }
6550 let err = unsafe { o.contents.err };
6551 unsafe { o.contents.err = core::ptr::null_mut(); }
6552 CResult_NetworkGraphDecodeErrorZPtr { err }
6556 result_ok: o.result_ok,
6562 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6563 pub enum COption_CVec_NetAddressZZ {
6564 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6565 Some(crate::c_types::derived::CVec_NetAddressZ),
6566 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6569 impl COption_CVec_NetAddressZZ {
6570 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6571 if let Self::None = self { false } else { true }
6573 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6576 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6577 if let Self::Some(v) = self { v } else { unreachable!() }
6581 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6582 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6583 COption_CVec_NetAddressZZ::Some(o)
6586 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6587 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6588 COption_CVec_NetAddressZZ::None
6591 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6592 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6594 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6595 /// but with all dynamically-allocated buffers duplicated in new buffers.
6596 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6598 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6599 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6600 /// A pointer to the contents in the success state.
6601 /// Reading from this pointer when `result_ok` is not set is undefined.
6602 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6603 /// A pointer to the contents in the error state.
6604 /// Reading from this pointer when `result_ok` is set is undefined.
6605 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6608 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6609 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6611 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6612 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6613 /// `err` or `result` depending on the state of `result_ok`.
6614 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6615 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6616 pub result_ok: bool,
6619 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6620 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6621 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6622 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6623 result: Box::into_raw(Box::new(o)),
6629 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6630 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6631 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6632 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6633 err: Box::into_raw(Box::new(e)),
6638 /// Checks if the given object is currently in the success state
6640 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6644 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6645 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6646 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6647 fn drop(&mut self) {
6649 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6650 let _ = unsafe { Box::from_raw(self.contents.result) };
6653 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6654 let _ = unsafe { Box::from_raw(self.contents.err) };
6659 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6660 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6661 let contents = if o.result_ok {
6662 let result = unsafe { o.contents.result };
6663 unsafe { o.contents.result = core::ptr::null_mut() };
6664 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6666 let err = unsafe { o.contents.err };
6667 unsafe { o.contents.err = core::ptr::null_mut(); }
6668 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6672 result_ok: o.result_ok,
6676 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6677 fn clone(&self) -> Self {
6679 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6680 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6683 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6684 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6690 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6691 /// but with all dynamically-allocated buffers duplicated in new buffers.
6692 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6694 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6695 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6696 /// A pointer to the contents in the success state.
6697 /// Reading from this pointer when `result_ok` is not set is undefined.
6698 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6699 /// A pointer to the contents in the error state.
6700 /// Reading from this pointer when `result_ok` is set is undefined.
6701 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6704 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6705 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6707 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6708 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6709 /// `err` or `result` depending on the state of `result_ok`.
6710 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6711 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6712 pub result_ok: bool,
6715 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6716 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6717 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6718 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6719 result: Box::into_raw(Box::new(o)),
6725 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6726 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6727 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6728 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6729 err: Box::into_raw(Box::new(e)),
6734 /// Checks if the given object is currently in the success state
6736 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6740 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6741 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6742 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6743 fn drop(&mut self) {
6745 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6746 let _ = unsafe { Box::from_raw(self.contents.result) };
6749 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6750 let _ = unsafe { Box::from_raw(self.contents.err) };
6755 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6756 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6757 let contents = if o.result_ok {
6758 let result = unsafe { o.contents.result };
6759 unsafe { o.contents.result = core::ptr::null_mut() };
6760 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6762 let err = unsafe { o.contents.err };
6763 unsafe { o.contents.err = core::ptr::null_mut(); }
6764 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6768 result_ok: o.result_ok,
6772 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6773 fn clone(&self) -> Self {
6775 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6776 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6779 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6780 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6786 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6787 /// but with all dynamically-allocated buffers duplicated in new buffers.
6788 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6790 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6791 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6792 /// A pointer to the contents in the success state.
6793 /// Reading from this pointer when `result_ok` is not set is undefined.
6794 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6795 /// A pointer to the contents in the error state.
6796 /// Reading from this pointer when `result_ok` is set is undefined.
6797 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6800 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6801 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6803 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6804 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6805 /// `err` or `result` depending on the state of `result_ok`.
6806 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6807 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6808 pub result_ok: bool,
6811 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6812 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6813 CResult_SpendableOutputDescriptorDecodeErrorZ {
6814 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6815 result: Box::into_raw(Box::new(o)),
6821 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6822 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6823 CResult_SpendableOutputDescriptorDecodeErrorZ {
6824 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6825 err: Box::into_raw(Box::new(e)),
6830 /// Checks if the given object is currently in the success state
6832 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6836 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6837 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6838 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6839 fn drop(&mut self) {
6841 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6842 let _ = unsafe { Box::from_raw(self.contents.result) };
6845 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6846 let _ = unsafe { Box::from_raw(self.contents.err) };
6851 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6852 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6853 let contents = if o.result_ok {
6854 let result = unsafe { o.contents.result };
6855 unsafe { o.contents.result = core::ptr::null_mut() };
6856 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6858 let err = unsafe { o.contents.err };
6859 unsafe { o.contents.err = core::ptr::null_mut(); }
6860 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6864 result_ok: o.result_ok,
6868 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6869 fn clone(&self) -> Self {
6871 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6872 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6875 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6876 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6882 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6883 /// but with all dynamically-allocated buffers duplicated in new buffers.
6884 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6886 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6887 /// This corresponds to std::vector in C++
6888 pub struct CVec_PaymentPreimageZ {
6889 /// The elements in the array.
6890 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6891 pub data: *mut crate::c_types::ThirtyTwoBytes,
6892 /// The number of elements pointed to by `data`.
6895 impl CVec_PaymentPreimageZ {
6896 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6897 if self.datalen == 0 { return Vec::new(); }
6898 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6899 self.data = core::ptr::null_mut();
6903 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6904 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6907 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6908 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6909 let datalen = v.len();
6910 let data = Box::into_raw(v.into_boxed_slice());
6911 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6915 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6916 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6917 impl Drop for CVec_PaymentPreimageZ {
6918 fn drop(&mut self) {
6919 if self.datalen == 0 { return; }
6920 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6923 impl Clone for CVec_PaymentPreimageZ {
6924 fn clone(&self) -> Self {
6925 let mut res = Vec::new();
6926 if self.datalen == 0 { return Self::from(res); }
6927 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6932 /// A tuple of 2 elements. See the individual fields for the types contained.
6933 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6934 /// The element at position 0
6935 pub a: crate::c_types::Signature,
6936 /// The element at position 1
6937 pub b: crate::c_types::derived::CVec_SignatureZ,
6939 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6940 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6947 impl C2Tuple_SignatureCVec_SignatureZZ {
6948 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6952 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6953 fn clone(&self) -> Self {
6955 a: Clone::clone(&self.a),
6956 b: Clone::clone(&self.b),
6961 /// Creates a new tuple which has the same data as `orig`
6962 /// but with all dynamically-allocated buffers duplicated in new buffers.
6963 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6964 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6966 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6967 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6971 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6972 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6974 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6975 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6976 /// A pointer to the contents in the success state.
6977 /// Reading from this pointer when `result_ok` is not set is undefined.
6978 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6979 /// Note that this value is always NULL, as there are no contents in the Err variant
6980 pub err: *mut core::ffi::c_void,
6983 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6984 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6986 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6987 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6988 /// `err` or `result` depending on the state of `result_ok`.
6989 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6990 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6991 pub result_ok: bool,
6994 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6995 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6996 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6997 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6998 result: Box::into_raw(Box::new(o)),
7004 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
7005 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7006 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7007 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7008 err: core::ptr::null_mut(),
7013 /// Checks if the given object is currently in the success state
7015 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
7019 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
7020 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
7021 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7022 fn drop(&mut self) {
7024 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7025 let _ = unsafe { Box::from_raw(self.contents.result) };
7031 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7032 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
7033 let contents = if o.result_ok {
7034 let result = unsafe { o.contents.result };
7035 unsafe { o.contents.result = core::ptr::null_mut() };
7036 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
7038 let _ = unsafe { Box::from_raw(o.contents.err) };
7039 o.contents.err = core::ptr::null_mut();
7040 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
7044 result_ok: o.result_ok,
7048 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7049 fn clone(&self) -> Self {
7051 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7052 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
7055 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7056 err: core::ptr::null_mut()
7062 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
7063 /// but with all dynamically-allocated buffers duplicated in new buffers.
7064 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
7066 /// The contents of CResult_SignatureNoneZ
7067 pub union CResult_SignatureNoneZPtr {
7068 /// A pointer to the contents in the success state.
7069 /// Reading from this pointer when `result_ok` is not set is undefined.
7070 pub result: *mut crate::c_types::Signature,
7071 /// Note that this value is always NULL, as there are no contents in the Err variant
7072 pub err: *mut core::ffi::c_void,
7075 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
7076 /// containing a crate::c_types::Signature on success and a () on failure.
7077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7078 pub struct CResult_SignatureNoneZ {
7079 /// The contents of this CResult_SignatureNoneZ, accessible via either
7080 /// `err` or `result` depending on the state of `result_ok`.
7081 pub contents: CResult_SignatureNoneZPtr,
7082 /// Whether this CResult_SignatureNoneZ represents a success state.
7083 pub result_ok: bool,
7086 /// Creates a new CResult_SignatureNoneZ in the success state.
7087 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
7088 CResult_SignatureNoneZ {
7089 contents: CResult_SignatureNoneZPtr {
7090 result: Box::into_raw(Box::new(o)),
7096 /// Creates a new CResult_SignatureNoneZ in the error state.
7097 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
7098 CResult_SignatureNoneZ {
7099 contents: CResult_SignatureNoneZPtr {
7100 err: core::ptr::null_mut(),
7105 /// Checks if the given object is currently in the success state
7107 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
7111 /// Frees any resources used by the CResult_SignatureNoneZ.
7112 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
7113 impl Drop for CResult_SignatureNoneZ {
7114 fn drop(&mut self) {
7116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7117 let _ = unsafe { Box::from_raw(self.contents.result) };
7123 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
7124 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
7125 let contents = if o.result_ok {
7126 let result = unsafe { o.contents.result };
7127 unsafe { o.contents.result = core::ptr::null_mut() };
7128 CResult_SignatureNoneZPtr { result }
7130 let _ = unsafe { Box::from_raw(o.contents.err) };
7131 o.contents.err = core::ptr::null_mut();
7132 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
7136 result_ok: o.result_ok,
7140 impl Clone for CResult_SignatureNoneZ {
7141 fn clone(&self) -> Self {
7143 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
7144 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
7147 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
7148 err: core::ptr::null_mut()
7154 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
7155 /// but with all dynamically-allocated buffers duplicated in new buffers.
7156 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
7158 /// The contents of CResult_PublicKeyNoneZ
7159 pub union CResult_PublicKeyNoneZPtr {
7160 /// A pointer to the contents in the success state.
7161 /// Reading from this pointer when `result_ok` is not set is undefined.
7162 pub result: *mut crate::c_types::PublicKey,
7163 /// Note that this value is always NULL, as there are no contents in the Err variant
7164 pub err: *mut core::ffi::c_void,
7167 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7168 /// containing a crate::c_types::PublicKey on success and a () on failure.
7169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7170 pub struct CResult_PublicKeyNoneZ {
7171 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
7172 /// `err` or `result` depending on the state of `result_ok`.
7173 pub contents: CResult_PublicKeyNoneZPtr,
7174 /// Whether this CResult_PublicKeyNoneZ represents a success state.
7175 pub result_ok: bool,
7178 /// Creates a new CResult_PublicKeyNoneZ in the success state.
7179 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
7180 CResult_PublicKeyNoneZ {
7181 contents: CResult_PublicKeyNoneZPtr {
7182 result: Box::into_raw(Box::new(o)),
7188 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7189 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7190 CResult_PublicKeyNoneZ {
7191 contents: CResult_PublicKeyNoneZPtr {
7192 err: core::ptr::null_mut(),
7197 /// Checks if the given object is currently in the success state
7199 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7203 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7204 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7205 impl Drop for CResult_PublicKeyNoneZ {
7206 fn drop(&mut self) {
7208 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7209 let _ = unsafe { Box::from_raw(self.contents.result) };
7215 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7216 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7217 let contents = if o.result_ok {
7218 let result = unsafe { o.contents.result };
7219 unsafe { o.contents.result = core::ptr::null_mut() };
7220 CResult_PublicKeyNoneZPtr { result }
7222 let _ = unsafe { Box::from_raw(o.contents.err) };
7223 o.contents.err = core::ptr::null_mut();
7224 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7228 result_ok: o.result_ok,
7232 impl Clone for CResult_PublicKeyNoneZ {
7233 fn clone(&self) -> Self {
7235 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7236 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7239 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7240 err: core::ptr::null_mut()
7246 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7247 /// but with all dynamically-allocated buffers duplicated in new buffers.
7248 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7250 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7251 pub enum COption_ScalarZ {
7252 /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7253 Some(crate::c_types::BigEndianScalar),
7254 /// When we're in this state, this COption_ScalarZ contains nothing
7257 impl COption_ScalarZ {
7258 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7259 if let Self::None = self { false } else { true }
7261 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7264 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7265 if let Self::Some(v) = self { v } else { unreachable!() }
7269 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7270 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7271 COption_ScalarZ::Some(o)
7274 /// Constructs a new COption_ScalarZ containing nothing
7275 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7276 COption_ScalarZ::None
7279 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7280 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7282 /// The contents of CResult_SharedSecretNoneZ
7283 pub union CResult_SharedSecretNoneZPtr {
7284 /// A pointer to the contents in the success state.
7285 /// Reading from this pointer when `result_ok` is not set is undefined.
7286 pub result: *mut crate::c_types::ThirtyTwoBytes,
7287 /// Note that this value is always NULL, as there are no contents in the Err variant
7288 pub err: *mut core::ffi::c_void,
7291 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7292 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7294 pub struct CResult_SharedSecretNoneZ {
7295 /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7296 /// `err` or `result` depending on the state of `result_ok`.
7297 pub contents: CResult_SharedSecretNoneZPtr,
7298 /// Whether this CResult_SharedSecretNoneZ represents a success state.
7299 pub result_ok: bool,
7302 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7303 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7304 CResult_SharedSecretNoneZ {
7305 contents: CResult_SharedSecretNoneZPtr {
7306 result: Box::into_raw(Box::new(o)),
7312 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7313 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7314 CResult_SharedSecretNoneZ {
7315 contents: CResult_SharedSecretNoneZPtr {
7316 err: core::ptr::null_mut(),
7321 /// Checks if the given object is currently in the success state
7323 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7327 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7328 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7329 impl Drop for CResult_SharedSecretNoneZ {
7330 fn drop(&mut self) {
7332 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7333 let _ = unsafe { Box::from_raw(self.contents.result) };
7339 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7340 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7341 let contents = if o.result_ok {
7342 let result = unsafe { o.contents.result };
7343 unsafe { o.contents.result = core::ptr::null_mut() };
7344 CResult_SharedSecretNoneZPtr { result }
7346 let _ = unsafe { Box::from_raw(o.contents.err) };
7347 o.contents.err = core::ptr::null_mut();
7348 CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7352 result_ok: o.result_ok,
7356 impl Clone for CResult_SharedSecretNoneZ {
7357 fn clone(&self) -> Self {
7359 Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7360 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7363 Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7364 err: core::ptr::null_mut()
7370 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7371 /// but with all dynamically-allocated buffers duplicated in new buffers.
7372 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7374 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7375 /// This corresponds to std::vector in C++
7376 pub struct CVec_U5Z {
7377 /// The elements in the array.
7378 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7379 pub data: *mut crate::c_types::U5,
7380 /// The number of elements pointed to by `data`.
7384 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
7385 if self.datalen == 0 { return Vec::new(); }
7386 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7387 self.data = core::ptr::null_mut();
7391 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
7392 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7395 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
7396 fn from(v: Vec<crate::c_types::U5>) -> Self {
7397 let datalen = v.len();
7398 let data = Box::into_raw(v.into_boxed_slice());
7399 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7403 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7404 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
7405 impl Drop for CVec_U5Z {
7406 fn drop(&mut self) {
7407 if self.datalen == 0 { return; }
7408 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7411 impl Clone for CVec_U5Z {
7412 fn clone(&self) -> Self {
7413 let mut res = Vec::new();
7414 if self.datalen == 0 { return Self::from(res); }
7415 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7420 /// The contents of CResult_RecoverableSignatureNoneZ
7421 pub union CResult_RecoverableSignatureNoneZPtr {
7422 /// A pointer to the contents in the success state.
7423 /// Reading from this pointer when `result_ok` is not set is undefined.
7424 pub result: *mut crate::c_types::RecoverableSignature,
7425 /// Note that this value is always NULL, as there are no contents in the Err variant
7426 pub err: *mut core::ffi::c_void,
7429 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7430 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
7431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7432 pub struct CResult_RecoverableSignatureNoneZ {
7433 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7434 /// `err` or `result` depending on the state of `result_ok`.
7435 pub contents: CResult_RecoverableSignatureNoneZPtr,
7436 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7437 pub result_ok: bool,
7440 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
7441 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
7442 CResult_RecoverableSignatureNoneZ {
7443 contents: CResult_RecoverableSignatureNoneZPtr {
7444 result: Box::into_raw(Box::new(o)),
7450 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
7451 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
7452 CResult_RecoverableSignatureNoneZ {
7453 contents: CResult_RecoverableSignatureNoneZPtr {
7454 err: core::ptr::null_mut(),
7459 /// Checks if the given object is currently in the success state
7461 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
7465 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
7466 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
7467 impl Drop for CResult_RecoverableSignatureNoneZ {
7468 fn drop(&mut self) {
7470 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7471 let _ = unsafe { Box::from_raw(self.contents.result) };
7477 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
7478 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
7479 let contents = if o.result_ok {
7480 let result = unsafe { o.contents.result };
7481 unsafe { o.contents.result = core::ptr::null_mut() };
7482 CResult_RecoverableSignatureNoneZPtr { result }
7484 let _ = unsafe { Box::from_raw(o.contents.err) };
7485 o.contents.err = core::ptr::null_mut();
7486 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
7490 result_ok: o.result_ok,
7494 impl Clone for CResult_RecoverableSignatureNoneZ {
7495 fn clone(&self) -> Self {
7497 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
7498 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
7501 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
7502 err: core::ptr::null_mut()
7508 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
7509 /// but with all dynamically-allocated buffers duplicated in new buffers.
7510 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
7512 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
7513 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
7514 /// A pointer to the contents in the success state.
7515 /// Reading from this pointer when `result_ok` is not set is undefined.
7516 pub result: *mut crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner,
7517 /// A pointer to the contents in the error state.
7518 /// Reading from this pointer when `result_ok` is set is undefined.
7519 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7522 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
7523 /// containing a crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7525 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7526 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
7527 /// `err` or `result` depending on the state of `result_ok`.
7528 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
7529 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
7530 pub result_ok: bool,
7533 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
7534 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7535 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7536 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
7537 result: Box::into_raw(Box::new(o)),
7543 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
7544 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7545 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7546 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
7547 err: Box::into_raw(Box::new(e)),
7552 /// Checks if the given object is currently in the success state
7554 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
7558 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
7559 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
7560 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7561 fn drop(&mut self) {
7563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7564 let _ = unsafe { Box::from_raw(self.contents.result) };
7567 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7568 let _ = unsafe { Box::from_raw(self.contents.err) };
7573 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7574 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7575 let contents = if o.result_ok {
7576 let result = unsafe { o.contents.result };
7577 unsafe { o.contents.result = core::ptr::null_mut() };
7578 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
7580 let err = unsafe { o.contents.err };
7581 unsafe { o.contents.err = core::ptr::null_mut(); }
7582 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
7586 result_ok: o.result_ok,
7591 /// A dynamically-allocated array of u8s of arbitrary size.
7592 /// This corresponds to std::vector in C++
7593 pub struct CVec_u8Z {
7594 /// The elements in the array.
7595 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7597 /// The number of elements pointed to by `data`.
7601 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7602 if self.datalen == 0 { return Vec::new(); }
7603 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7604 self.data = core::ptr::null_mut();
7608 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7609 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7612 impl From<Vec<u8>> for CVec_u8Z {
7613 fn from(v: Vec<u8>) -> Self {
7614 let datalen = v.len();
7615 let data = Box::into_raw(v.into_boxed_slice());
7616 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7620 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7621 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7622 impl Drop for CVec_u8Z {
7623 fn drop(&mut self) {
7624 if self.datalen == 0 { return; }
7625 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7628 impl Clone for CVec_u8Z {
7629 fn clone(&self) -> Self {
7630 let mut res = Vec::new();
7631 if self.datalen == 0 { return Self::from(res); }
7632 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7637 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7638 /// This corresponds to std::vector in C++
7639 pub struct CVec_CVec_u8ZZ {
7640 /// The elements in the array.
7641 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7642 pub data: *mut crate::c_types::derived::CVec_u8Z,
7643 /// The number of elements pointed to by `data`.
7646 impl CVec_CVec_u8ZZ {
7647 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7648 if self.datalen == 0 { return Vec::new(); }
7649 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7650 self.data = core::ptr::null_mut();
7654 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7655 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7658 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7659 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7660 let datalen = v.len();
7661 let data = Box::into_raw(v.into_boxed_slice());
7662 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7666 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7667 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7668 impl Drop for CVec_CVec_u8ZZ {
7669 fn drop(&mut self) {
7670 if self.datalen == 0 { return; }
7671 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7674 impl Clone for CVec_CVec_u8ZZ {
7675 fn clone(&self) -> Self {
7676 let mut res = Vec::new();
7677 if self.datalen == 0 { return Self::from(res); }
7678 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7683 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7684 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7685 /// A pointer to the contents in the success state.
7686 /// Reading from this pointer when `result_ok` is not set is undefined.
7687 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7688 /// Note that this value is always NULL, as there are no contents in the Err variant
7689 pub err: *mut core::ffi::c_void,
7692 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7693 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7695 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7696 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7697 /// `err` or `result` depending on the state of `result_ok`.
7698 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7699 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7700 pub result_ok: bool,
7703 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7704 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7705 CResult_CVec_CVec_u8ZZNoneZ {
7706 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7707 result: Box::into_raw(Box::new(o)),
7713 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7714 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7715 CResult_CVec_CVec_u8ZZNoneZ {
7716 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7717 err: core::ptr::null_mut(),
7722 /// Checks if the given object is currently in the success state
7724 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7728 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7729 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7730 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7731 fn drop(&mut self) {
7733 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7734 let _ = unsafe { Box::from_raw(self.contents.result) };
7740 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7741 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7742 let contents = if o.result_ok {
7743 let result = unsafe { o.contents.result };
7744 unsafe { o.contents.result = core::ptr::null_mut() };
7745 CResult_CVec_CVec_u8ZZNoneZPtr { result }
7747 let _ = unsafe { Box::from_raw(o.contents.err) };
7748 o.contents.err = core::ptr::null_mut();
7749 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7753 result_ok: o.result_ok,
7757 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7758 fn clone(&self) -> Self {
7760 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7761 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7764 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7765 err: core::ptr::null_mut()
7771 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7772 /// but with all dynamically-allocated buffers duplicated in new buffers.
7773 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7775 /// The contents of CResult_InMemorySignerDecodeErrorZ
7776 pub union CResult_InMemorySignerDecodeErrorZPtr {
7777 /// A pointer to the contents in the success state.
7778 /// Reading from this pointer when `result_ok` is not set is undefined.
7779 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7780 /// A pointer to the contents in the error state.
7781 /// Reading from this pointer when `result_ok` is set is undefined.
7782 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7785 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7786 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7788 pub struct CResult_InMemorySignerDecodeErrorZ {
7789 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7790 /// `err` or `result` depending on the state of `result_ok`.
7791 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7792 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7793 pub result_ok: bool,
7796 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7797 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7798 CResult_InMemorySignerDecodeErrorZ {
7799 contents: CResult_InMemorySignerDecodeErrorZPtr {
7800 result: Box::into_raw(Box::new(o)),
7806 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7807 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7808 CResult_InMemorySignerDecodeErrorZ {
7809 contents: CResult_InMemorySignerDecodeErrorZPtr {
7810 err: Box::into_raw(Box::new(e)),
7815 /// Checks if the given object is currently in the success state
7817 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7821 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7822 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7823 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7824 fn drop(&mut self) {
7826 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7827 let _ = unsafe { Box::from_raw(self.contents.result) };
7830 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7831 let _ = unsafe { Box::from_raw(self.contents.err) };
7836 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7837 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7838 let contents = if o.result_ok {
7839 let result = unsafe { o.contents.result };
7840 unsafe { o.contents.result = core::ptr::null_mut() };
7841 CResult_InMemorySignerDecodeErrorZPtr { result }
7843 let err = unsafe { o.contents.err };
7844 unsafe { o.contents.err = core::ptr::null_mut(); }
7845 CResult_InMemorySignerDecodeErrorZPtr { err }
7849 result_ok: o.result_ok,
7853 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7854 fn clone(&self) -> Self {
7856 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7857 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7860 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7861 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7867 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7868 /// but with all dynamically-allocated buffers duplicated in new buffers.
7869 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7871 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7872 /// This corresponds to std::vector in C++
7873 pub struct CVec_TxOutZ {
7874 /// The elements in the array.
7875 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7876 pub data: *mut crate::c_types::TxOut,
7877 /// The number of elements pointed to by `data`.
7881 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7882 if self.datalen == 0 { return Vec::new(); }
7883 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7884 self.data = core::ptr::null_mut();
7888 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7889 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7892 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7893 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7894 let datalen = v.len();
7895 let data = Box::into_raw(v.into_boxed_slice());
7896 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7900 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7901 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7902 impl Drop for CVec_TxOutZ {
7903 fn drop(&mut self) {
7904 if self.datalen == 0 { return; }
7905 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7908 impl Clone for CVec_TxOutZ {
7909 fn clone(&self) -> Self {
7910 let mut res = Vec::new();
7911 if self.datalen == 0 { return Self::from(res); }
7912 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7917 /// The contents of CResult_TransactionNoneZ
7918 pub union CResult_TransactionNoneZPtr {
7919 /// A pointer to the contents in the success state.
7920 /// Reading from this pointer when `result_ok` is not set is undefined.
7921 pub result: *mut crate::c_types::Transaction,
7922 /// Note that this value is always NULL, as there are no contents in the Err variant
7923 pub err: *mut core::ffi::c_void,
7926 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7927 /// containing a crate::c_types::Transaction on success and a () on failure.
7928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7929 pub struct CResult_TransactionNoneZ {
7930 /// The contents of this CResult_TransactionNoneZ, accessible via either
7931 /// `err` or `result` depending on the state of `result_ok`.
7932 pub contents: CResult_TransactionNoneZPtr,
7933 /// Whether this CResult_TransactionNoneZ represents a success state.
7934 pub result_ok: bool,
7937 /// Creates a new CResult_TransactionNoneZ in the success state.
7938 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7939 CResult_TransactionNoneZ {
7940 contents: CResult_TransactionNoneZPtr {
7941 result: Box::into_raw(Box::new(o)),
7947 /// Creates a new CResult_TransactionNoneZ in the error state.
7948 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7949 CResult_TransactionNoneZ {
7950 contents: CResult_TransactionNoneZPtr {
7951 err: core::ptr::null_mut(),
7956 /// Checks if the given object is currently in the success state
7958 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7962 /// Frees any resources used by the CResult_TransactionNoneZ.
7963 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7964 impl Drop for CResult_TransactionNoneZ {
7965 fn drop(&mut self) {
7967 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7968 let _ = unsafe { Box::from_raw(self.contents.result) };
7974 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7975 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7976 let contents = if o.result_ok {
7977 let result = unsafe { o.contents.result };
7978 unsafe { o.contents.result = core::ptr::null_mut() };
7979 CResult_TransactionNoneZPtr { result }
7981 let _ = unsafe { Box::from_raw(o.contents.err) };
7982 o.contents.err = core::ptr::null_mut();
7983 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7987 result_ok: o.result_ok,
7991 impl Clone for CResult_TransactionNoneZ {
7992 fn clone(&self) -> Self {
7994 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7995 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7998 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7999 err: core::ptr::null_mut()
8005 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
8006 /// but with all dynamically-allocated buffers duplicated in new buffers.
8007 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
8009 /// A tuple of 2 elements. See the individual fields for the types contained.
8010 pub struct C2Tuple_BlockHashChannelMonitorZ {
8011 /// The element at position 0
8012 pub a: crate::c_types::ThirtyTwoBytes,
8013 /// The element at position 1
8014 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
8016 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
8017 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
8024 impl C2Tuple_BlockHashChannelMonitorZ {
8025 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
8029 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8031 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
8032 C2Tuple_BlockHashChannelMonitorZ { a, b, }
8036 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8037 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
8039 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8040 /// This corresponds to std::vector in C++
8041 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8042 /// The elements in the array.
8043 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8044 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8045 /// The number of elements pointed to by `data`.
8048 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8049 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8050 if self.datalen == 0 { return Vec::new(); }
8051 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8052 self.data = core::ptr::null_mut();
8056 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8057 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8060 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8061 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8062 let datalen = v.len();
8063 let data = Box::into_raw(v.into_boxed_slice());
8064 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8068 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8069 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8070 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8071 fn drop(&mut self) {
8072 if self.datalen == 0 { return; }
8073 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8077 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8078 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8079 /// A pointer to the contents in the success state.
8080 /// Reading from this pointer when `result_ok` is not set is undefined.
8081 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8082 /// A pointer to the contents in the error state.
8083 /// Reading from this pointer when `result_ok` is set is undefined.
8084 pub err: *mut crate::c_types::IOError,
8087 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8088 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8090 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8091 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8092 /// `err` or `result` depending on the state of `result_ok`.
8093 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8094 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8095 pub result_ok: bool,
8098 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8099 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8100 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8101 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8102 result: Box::into_raw(Box::new(o)),
8108 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8109 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8110 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8111 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8112 err: Box::into_raw(Box::new(e)),
8117 /// Checks if the given object is currently in the success state
8119 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
8123 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8124 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8125 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8126 fn drop(&mut self) {
8128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8129 let _ = unsafe { Box::from_raw(self.contents.result) };
8132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8133 let _ = unsafe { Box::from_raw(self.contents.err) };
8138 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8139 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8140 let contents = if o.result_ok {
8141 let result = unsafe { o.contents.result };
8142 unsafe { o.contents.result = core::ptr::null_mut() };
8143 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8145 let err = unsafe { o.contents.err };
8146 unsafe { o.contents.err = core::ptr::null_mut(); }
8147 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8151 result_ok: o.result_ok,
8157 /// An enum which can either contain a u16 or not
8158 pub enum COption_u16Z {
8159 /// When we're in this state, this COption_u16Z contains a u16
8161 /// When we're in this state, this COption_u16Z contains nothing
8165 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8166 if let Self::None = self { false } else { true }
8168 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8171 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8172 if let Self::Some(v) = self { v } else { unreachable!() }
8176 /// Constructs a new COption_u16Z containing a u16
8177 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8178 COption_u16Z::Some(o)
8181 /// Constructs a new COption_u16Z containing nothing
8182 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8186 /// Frees any resources associated with the u16, if we are in the Some state
8187 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8189 /// Creates a new COption_u16Z which has the same data as `orig`
8190 /// but with all dynamically-allocated buffers duplicated in new buffers.
8191 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8193 /// The contents of CResult__u832APIErrorZ
8194 pub union CResult__u832APIErrorZPtr {
8195 /// A pointer to the contents in the success state.
8196 /// Reading from this pointer when `result_ok` is not set is undefined.
8197 pub result: *mut crate::c_types::ThirtyTwoBytes,
8198 /// A pointer to the contents in the error state.
8199 /// Reading from this pointer when `result_ok` is set is undefined.
8200 pub err: *mut crate::lightning::util::errors::APIError,
8203 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8204 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8206 pub struct CResult__u832APIErrorZ {
8207 /// The contents of this CResult__u832APIErrorZ, accessible via either
8208 /// `err` or `result` depending on the state of `result_ok`.
8209 pub contents: CResult__u832APIErrorZPtr,
8210 /// Whether this CResult__u832APIErrorZ represents a success state.
8211 pub result_ok: bool,
8214 /// Creates a new CResult__u832APIErrorZ in the success state.
8215 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8216 CResult__u832APIErrorZ {
8217 contents: CResult__u832APIErrorZPtr {
8218 result: Box::into_raw(Box::new(o)),
8224 /// Creates a new CResult__u832APIErrorZ in the error state.
8225 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8226 CResult__u832APIErrorZ {
8227 contents: CResult__u832APIErrorZPtr {
8228 err: Box::into_raw(Box::new(e)),
8233 /// Checks if the given object is currently in the success state
8235 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8239 /// Frees any resources used by the CResult__u832APIErrorZ.
8240 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8241 impl Drop for CResult__u832APIErrorZ {
8242 fn drop(&mut self) {
8244 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8245 let _ = unsafe { Box::from_raw(self.contents.result) };
8248 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8249 let _ = unsafe { Box::from_raw(self.contents.err) };
8254 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8255 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8256 let contents = if o.result_ok {
8257 let result = unsafe { o.contents.result };
8258 unsafe { o.contents.result = core::ptr::null_mut() };
8259 CResult__u832APIErrorZPtr { result }
8261 let err = unsafe { o.contents.err };
8262 unsafe { o.contents.err = core::ptr::null_mut(); }
8263 CResult__u832APIErrorZPtr { err }
8267 result_ok: o.result_ok,
8271 impl Clone for CResult__u832APIErrorZ {
8272 fn clone(&self) -> Self {
8274 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8275 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8278 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8279 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8285 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8286 /// but with all dynamically-allocated buffers duplicated in new buffers.
8287 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8289 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8290 /// This corresponds to std::vector in C++
8291 pub struct CVec_RecentPaymentDetailsZ {
8292 /// The elements in the array.
8293 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8294 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8295 /// The number of elements pointed to by `data`.
8298 impl CVec_RecentPaymentDetailsZ {
8299 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8300 if self.datalen == 0 { return Vec::new(); }
8301 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8302 self.data = core::ptr::null_mut();
8306 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8307 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8310 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8311 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8312 let datalen = v.len();
8313 let data = Box::into_raw(v.into_boxed_slice());
8314 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8318 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8319 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8320 impl Drop for CVec_RecentPaymentDetailsZ {
8321 fn drop(&mut self) {
8322 if self.datalen == 0 { return; }
8323 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8327 /// The contents of CResult_NonePaymentSendFailureZ
8328 pub union CResult_NonePaymentSendFailureZPtr {
8329 /// Note that this value is always NULL, as there are no contents in the OK variant
8330 pub result: *mut core::ffi::c_void,
8331 /// A pointer to the contents in the error state.
8332 /// Reading from this pointer when `result_ok` is set is undefined.
8333 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8336 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8337 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8339 pub struct CResult_NonePaymentSendFailureZ {
8340 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8341 /// `err` or `result` depending on the state of `result_ok`.
8342 pub contents: CResult_NonePaymentSendFailureZPtr,
8343 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8344 pub result_ok: bool,
8347 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8348 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8349 CResult_NonePaymentSendFailureZ {
8350 contents: CResult_NonePaymentSendFailureZPtr {
8351 result: core::ptr::null_mut(),
8357 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8358 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8359 CResult_NonePaymentSendFailureZ {
8360 contents: CResult_NonePaymentSendFailureZPtr {
8361 err: Box::into_raw(Box::new(e)),
8366 /// Checks if the given object is currently in the success state
8368 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8372 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8373 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8374 impl Drop for CResult_NonePaymentSendFailureZ {
8375 fn drop(&mut self) {
8378 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8379 let _ = unsafe { Box::from_raw(self.contents.err) };
8384 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8385 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8386 let contents = if o.result_ok {
8387 let _ = unsafe { Box::from_raw(o.contents.result) };
8388 o.contents.result = core::ptr::null_mut();
8389 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8391 let err = unsafe { o.contents.err };
8392 unsafe { o.contents.err = core::ptr::null_mut(); }
8393 CResult_NonePaymentSendFailureZPtr { err }
8397 result_ok: o.result_ok,
8401 impl Clone for CResult_NonePaymentSendFailureZ {
8402 fn clone(&self) -> Self {
8404 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8405 result: core::ptr::null_mut()
8408 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8409 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8415 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8416 /// but with all dynamically-allocated buffers duplicated in new buffers.
8417 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8419 /// The contents of CResult_NoneRetryableSendFailureZ
8420 pub union CResult_NoneRetryableSendFailureZPtr {
8421 /// Note that this value is always NULL, as there are no contents in the OK variant
8422 pub result: *mut core::ffi::c_void,
8423 /// A pointer to the contents in the error state.
8424 /// Reading from this pointer when `result_ok` is set is undefined.
8425 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8428 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8429 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8431 pub struct CResult_NoneRetryableSendFailureZ {
8432 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8433 /// `err` or `result` depending on the state of `result_ok`.
8434 pub contents: CResult_NoneRetryableSendFailureZPtr,
8435 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8436 pub result_ok: bool,
8439 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8440 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8441 CResult_NoneRetryableSendFailureZ {
8442 contents: CResult_NoneRetryableSendFailureZPtr {
8443 result: core::ptr::null_mut(),
8449 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8450 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8451 CResult_NoneRetryableSendFailureZ {
8452 contents: CResult_NoneRetryableSendFailureZPtr {
8453 err: Box::into_raw(Box::new(e)),
8458 /// Checks if the given object is currently in the success state
8460 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8464 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8465 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8466 impl Drop for CResult_NoneRetryableSendFailureZ {
8467 fn drop(&mut self) {
8470 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8471 let _ = unsafe { Box::from_raw(self.contents.err) };
8476 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
8477 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8478 let contents = if o.result_ok {
8479 let _ = unsafe { Box::from_raw(o.contents.result) };
8480 o.contents.result = core::ptr::null_mut();
8481 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
8483 let err = unsafe { o.contents.err };
8484 unsafe { o.contents.err = core::ptr::null_mut(); }
8485 CResult_NoneRetryableSendFailureZPtr { err }
8489 result_ok: o.result_ok,
8493 impl Clone for CResult_NoneRetryableSendFailureZ {
8494 fn clone(&self) -> Self {
8496 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
8497 result: core::ptr::null_mut()
8500 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
8501 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8507 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
8508 /// but with all dynamically-allocated buffers duplicated in new buffers.
8509 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
8511 /// The contents of CResult_PaymentHashPaymentSendFailureZ
8512 pub union CResult_PaymentHashPaymentSendFailureZPtr {
8513 /// A pointer to the contents in the success state.
8514 /// Reading from this pointer when `result_ok` is not set is undefined.
8515 pub result: *mut crate::c_types::ThirtyTwoBytes,
8516 /// A pointer to the contents in the error state.
8517 /// Reading from this pointer when `result_ok` is set is undefined.
8518 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8521 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
8522 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8523 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8524 pub struct CResult_PaymentHashPaymentSendFailureZ {
8525 /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
8526 /// `err` or `result` depending on the state of `result_ok`.
8527 pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
8528 /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
8529 pub result_ok: bool,
8532 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
8533 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
8534 CResult_PaymentHashPaymentSendFailureZ {
8535 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8536 result: Box::into_raw(Box::new(o)),
8542 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
8543 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
8544 CResult_PaymentHashPaymentSendFailureZ {
8545 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8546 err: Box::into_raw(Box::new(e)),
8551 /// Checks if the given object is currently in the success state
8553 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
8557 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
8558 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
8559 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
8560 fn drop(&mut self) {
8562 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8563 let _ = unsafe { Box::from_raw(self.contents.result) };
8566 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8567 let _ = unsafe { Box::from_raw(self.contents.err) };
8572 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
8573 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8574 let contents = if o.result_ok {
8575 let result = unsafe { o.contents.result };
8576 unsafe { o.contents.result = core::ptr::null_mut() };
8577 CResult_PaymentHashPaymentSendFailureZPtr { result }
8579 let err = unsafe { o.contents.err };
8580 unsafe { o.contents.err = core::ptr::null_mut(); }
8581 CResult_PaymentHashPaymentSendFailureZPtr { err }
8585 result_ok: o.result_ok,
8589 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
8590 fn clone(&self) -> Self {
8592 Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8593 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8596 Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8597 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8603 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
8604 /// but with all dynamically-allocated buffers duplicated in new buffers.
8605 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
8607 /// The contents of CResult_PaymentHashRetryableSendFailureZ
8608 pub union CResult_PaymentHashRetryableSendFailureZPtr {
8609 /// A pointer to the contents in the success state.
8610 /// Reading from this pointer when `result_ok` is not set is undefined.
8611 pub result: *mut crate::c_types::ThirtyTwoBytes,
8612 /// A pointer to the contents in the error state.
8613 /// Reading from this pointer when `result_ok` is set is undefined.
8614 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8617 /// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
8618 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8619 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8620 pub struct CResult_PaymentHashRetryableSendFailureZ {
8621 /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
8622 /// `err` or `result` depending on the state of `result_ok`.
8623 pub contents: CResult_PaymentHashRetryableSendFailureZPtr,
8624 /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
8625 pub result_ok: bool,
8628 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
8629 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ {
8630 CResult_PaymentHashRetryableSendFailureZ {
8631 contents: CResult_PaymentHashRetryableSendFailureZPtr {
8632 result: Box::into_raw(Box::new(o)),
8638 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
8639 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ {
8640 CResult_PaymentHashRetryableSendFailureZ {
8641 contents: CResult_PaymentHashRetryableSendFailureZPtr {
8642 err: Box::into_raw(Box::new(e)),
8647 /// Checks if the given object is currently in the success state
8649 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool {
8653 /// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
8654 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { }
8655 impl Drop for CResult_PaymentHashRetryableSendFailureZ {
8656 fn drop(&mut self) {
8658 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8659 let _ = unsafe { Box::from_raw(self.contents.result) };
8662 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8663 let _ = unsafe { Box::from_raw(self.contents.err) };
8668 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_PaymentHashRetryableSendFailureZ {
8669 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8670 let contents = if o.result_ok {
8671 let result = unsafe { o.contents.result };
8672 unsafe { o.contents.result = core::ptr::null_mut() };
8673 CResult_PaymentHashRetryableSendFailureZPtr { result }
8675 let err = unsafe { o.contents.err };
8676 unsafe { o.contents.err = core::ptr::null_mut(); }
8677 CResult_PaymentHashRetryableSendFailureZPtr { err }
8681 result_ok: o.result_ok,
8685 impl Clone for CResult_PaymentHashRetryableSendFailureZ {
8686 fn clone(&self) -> Self {
8688 Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr {
8689 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8692 Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr {
8693 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8699 /// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
8700 /// but with all dynamically-allocated buffers duplicated in new buffers.
8701 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) }
8703 /// A tuple of 2 elements. See the individual fields for the types contained.
8704 pub struct C2Tuple_PaymentHashPaymentIdZ {
8705 /// The element at position 0
8706 pub a: crate::c_types::ThirtyTwoBytes,
8707 /// The element at position 1
8708 pub b: crate::c_types::ThirtyTwoBytes,
8710 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8711 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8718 impl C2Tuple_PaymentHashPaymentIdZ {
8719 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8723 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8724 fn clone(&self) -> Self {
8726 a: Clone::clone(&self.a),
8727 b: Clone::clone(&self.b),
8732 /// Creates a new tuple which has the same data as `orig`
8733 /// but with all dynamically-allocated buffers duplicated in new buffers.
8734 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8735 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8737 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8738 C2Tuple_PaymentHashPaymentIdZ { a, b, }
8742 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8743 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8745 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8746 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8747 /// A pointer to the contents in the success state.
8748 /// Reading from this pointer when `result_ok` is not set is undefined.
8749 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8750 /// A pointer to the contents in the error state.
8751 /// Reading from this pointer when `result_ok` is set is undefined.
8752 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8755 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8756 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8758 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8759 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8760 /// `err` or `result` depending on the state of `result_ok`.
8761 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8762 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8763 pub result_ok: bool,
8766 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8767 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8768 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8769 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8770 result: Box::into_raw(Box::new(o)),
8776 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8777 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8778 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8779 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8780 err: Box::into_raw(Box::new(e)),
8785 /// Checks if the given object is currently in the success state
8787 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8791 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8792 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8793 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8794 fn drop(&mut self) {
8796 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8797 let _ = unsafe { Box::from_raw(self.contents.result) };
8800 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8801 let _ = unsafe { Box::from_raw(self.contents.err) };
8806 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8807 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8808 let contents = if o.result_ok {
8809 let result = unsafe { o.contents.result };
8810 unsafe { o.contents.result = core::ptr::null_mut() };
8811 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8813 let err = unsafe { o.contents.err };
8814 unsafe { o.contents.err = core::ptr::null_mut(); }
8815 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8819 result_ok: o.result_ok,
8823 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8824 fn clone(&self) -> Self {
8826 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8827 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8830 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8831 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8837 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8838 /// but with all dynamically-allocated buffers duplicated in new buffers.
8839 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8841 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8842 /// This corresponds to std::vector in C++
8843 pub struct CVec_ThirtyTwoBytesZ {
8844 /// The elements in the array.
8845 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8846 pub data: *mut crate::c_types::ThirtyTwoBytes,
8847 /// The number of elements pointed to by `data`.
8850 impl CVec_ThirtyTwoBytesZ {
8851 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8852 if self.datalen == 0 { return Vec::new(); }
8853 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8854 self.data = core::ptr::null_mut();
8858 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8859 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8862 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8863 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8864 let datalen = v.len();
8865 let data = Box::into_raw(v.into_boxed_slice());
8866 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8871 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8872 impl Drop for CVec_ThirtyTwoBytesZ {
8873 fn drop(&mut self) {
8874 if self.datalen == 0 { return; }
8875 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8878 impl Clone for CVec_ThirtyTwoBytesZ {
8879 fn clone(&self) -> Self {
8880 let mut res = Vec::new();
8881 if self.datalen == 0 { return Self::from(res); }
8882 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8887 /// A tuple of 2 elements. See the individual fields for the types contained.
8888 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8889 /// The element at position 0
8890 pub a: crate::c_types::ThirtyTwoBytes,
8891 /// The element at position 1
8892 pub b: crate::c_types::ThirtyTwoBytes,
8894 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8895 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8902 impl C2Tuple_PaymentHashPaymentSecretZ {
8903 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8907 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8908 fn clone(&self) -> Self {
8910 a: Clone::clone(&self.a),
8911 b: Clone::clone(&self.b),
8916 /// Creates a new tuple which has the same data as `orig`
8917 /// but with all dynamically-allocated buffers duplicated in new buffers.
8918 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8919 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8921 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8922 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8926 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8927 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8929 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8930 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8931 /// A pointer to the contents in the success state.
8932 /// Reading from this pointer when `result_ok` is not set is undefined.
8933 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8934 /// Note that this value is always NULL, as there are no contents in the Err variant
8935 pub err: *mut core::ffi::c_void,
8938 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8939 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8941 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8942 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8943 /// `err` or `result` depending on the state of `result_ok`.
8944 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8945 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8946 pub result_ok: bool,
8949 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8950 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8951 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8952 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8953 result: Box::into_raw(Box::new(o)),
8959 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8960 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8961 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8962 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8963 err: core::ptr::null_mut(),
8968 /// Checks if the given object is currently in the success state
8970 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8974 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8975 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8976 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8977 fn drop(&mut self) {
8979 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8980 let _ = unsafe { Box::from_raw(self.contents.result) };
8986 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8987 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8988 let contents = if o.result_ok {
8989 let result = unsafe { o.contents.result };
8990 unsafe { o.contents.result = core::ptr::null_mut() };
8991 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8993 let _ = unsafe { Box::from_raw(o.contents.err) };
8994 o.contents.err = core::ptr::null_mut();
8995 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8999 result_ok: o.result_ok,
9003 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9004 fn clone(&self) -> Self {
9006 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9007 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9010 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9011 err: core::ptr::null_mut()
9017 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
9018 /// but with all dynamically-allocated buffers duplicated in new buffers.
9019 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
9021 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
9022 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9023 /// A pointer to the contents in the success state.
9024 /// Reading from this pointer when `result_ok` is not set is undefined.
9025 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9026 /// A pointer to the contents in the error state.
9027 /// Reading from this pointer when `result_ok` is set is undefined.
9028 pub err: *mut crate::lightning::util::errors::APIError,
9031 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
9032 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
9033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9034 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9035 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
9036 /// `err` or `result` depending on the state of `result_ok`.
9037 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
9038 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
9039 pub result_ok: bool,
9042 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
9043 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9044 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9045 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9046 result: Box::into_raw(Box::new(o)),
9052 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
9053 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9054 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9055 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9056 err: Box::into_raw(Box::new(e)),
9061 /// Checks if the given object is currently in the success state
9063 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
9067 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
9068 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
9069 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9070 fn drop(&mut self) {
9072 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9073 let _ = unsafe { Box::from_raw(self.contents.result) };
9076 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9077 let _ = unsafe { Box::from_raw(self.contents.err) };
9082 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9083 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
9084 let contents = if o.result_ok {
9085 let result = unsafe { o.contents.result };
9086 unsafe { o.contents.result = core::ptr::null_mut() };
9087 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
9089 let err = unsafe { o.contents.err };
9090 unsafe { o.contents.err = core::ptr::null_mut(); }
9091 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
9095 result_ok: o.result_ok,
9099 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9100 fn clone(&self) -> Self {
9102 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9103 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9106 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9107 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9113 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
9114 /// but with all dynamically-allocated buffers duplicated in new buffers.
9115 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
9117 /// The contents of CResult_PaymentSecretNoneZ
9118 pub union CResult_PaymentSecretNoneZPtr {
9119 /// A pointer to the contents in the success state.
9120 /// Reading from this pointer when `result_ok` is not set is undefined.
9121 pub result: *mut crate::c_types::ThirtyTwoBytes,
9122 /// Note that this value is always NULL, as there are no contents in the Err variant
9123 pub err: *mut core::ffi::c_void,
9126 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
9127 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
9128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9129 pub struct CResult_PaymentSecretNoneZ {
9130 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
9131 /// `err` or `result` depending on the state of `result_ok`.
9132 pub contents: CResult_PaymentSecretNoneZPtr,
9133 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
9134 pub result_ok: bool,
9137 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
9138 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
9139 CResult_PaymentSecretNoneZ {
9140 contents: CResult_PaymentSecretNoneZPtr {
9141 result: Box::into_raw(Box::new(o)),
9147 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
9148 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
9149 CResult_PaymentSecretNoneZ {
9150 contents: CResult_PaymentSecretNoneZPtr {
9151 err: core::ptr::null_mut(),
9156 /// Checks if the given object is currently in the success state
9158 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
9162 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
9163 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
9164 impl Drop for CResult_PaymentSecretNoneZ {
9165 fn drop(&mut self) {
9167 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9168 let _ = unsafe { Box::from_raw(self.contents.result) };
9174 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
9175 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
9176 let contents = if o.result_ok {
9177 let result = unsafe { o.contents.result };
9178 unsafe { o.contents.result = core::ptr::null_mut() };
9179 CResult_PaymentSecretNoneZPtr { result }
9181 let _ = unsafe { Box::from_raw(o.contents.err) };
9182 o.contents.err = core::ptr::null_mut();
9183 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
9187 result_ok: o.result_ok,
9191 impl Clone for CResult_PaymentSecretNoneZ {
9192 fn clone(&self) -> Self {
9194 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
9195 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9198 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
9199 err: core::ptr::null_mut()
9205 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
9206 /// but with all dynamically-allocated buffers duplicated in new buffers.
9207 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9209 /// The contents of CResult_PaymentSecretAPIErrorZ
9210 pub union CResult_PaymentSecretAPIErrorZPtr {
9211 /// A pointer to the contents in the success state.
9212 /// Reading from this pointer when `result_ok` is not set is undefined.
9213 pub result: *mut crate::c_types::ThirtyTwoBytes,
9214 /// A pointer to the contents in the error state.
9215 /// Reading from this pointer when `result_ok` is set is undefined.
9216 pub err: *mut crate::lightning::util::errors::APIError,
9219 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9220 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9222 pub struct CResult_PaymentSecretAPIErrorZ {
9223 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9224 /// `err` or `result` depending on the state of `result_ok`.
9225 pub contents: CResult_PaymentSecretAPIErrorZPtr,
9226 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9227 pub result_ok: bool,
9230 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9231 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9232 CResult_PaymentSecretAPIErrorZ {
9233 contents: CResult_PaymentSecretAPIErrorZPtr {
9234 result: Box::into_raw(Box::new(o)),
9240 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9241 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9242 CResult_PaymentSecretAPIErrorZ {
9243 contents: CResult_PaymentSecretAPIErrorZPtr {
9244 err: Box::into_raw(Box::new(e)),
9249 /// Checks if the given object is currently in the success state
9251 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9255 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9256 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9257 impl Drop for CResult_PaymentSecretAPIErrorZ {
9258 fn drop(&mut self) {
9260 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9261 let _ = unsafe { Box::from_raw(self.contents.result) };
9264 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9265 let _ = unsafe { Box::from_raw(self.contents.err) };
9270 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9271 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9272 let contents = if o.result_ok {
9273 let result = unsafe { o.contents.result };
9274 unsafe { o.contents.result = core::ptr::null_mut() };
9275 CResult_PaymentSecretAPIErrorZPtr { result }
9277 let err = unsafe { o.contents.err };
9278 unsafe { o.contents.err = core::ptr::null_mut(); }
9279 CResult_PaymentSecretAPIErrorZPtr { err }
9283 result_ok: o.result_ok,
9287 impl Clone for CResult_PaymentSecretAPIErrorZ {
9288 fn clone(&self) -> Self {
9290 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9291 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9294 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9295 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9301 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9302 /// but with all dynamically-allocated buffers duplicated in new buffers.
9303 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9305 /// The contents of CResult_PaymentPreimageAPIErrorZ
9306 pub union CResult_PaymentPreimageAPIErrorZPtr {
9307 /// A pointer to the contents in the success state.
9308 /// Reading from this pointer when `result_ok` is not set is undefined.
9309 pub result: *mut crate::c_types::ThirtyTwoBytes,
9310 /// A pointer to the contents in the error state.
9311 /// Reading from this pointer when `result_ok` is set is undefined.
9312 pub err: *mut crate::lightning::util::errors::APIError,
9315 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9316 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9318 pub struct CResult_PaymentPreimageAPIErrorZ {
9319 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9320 /// `err` or `result` depending on the state of `result_ok`.
9321 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9322 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9323 pub result_ok: bool,
9326 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9327 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9328 CResult_PaymentPreimageAPIErrorZ {
9329 contents: CResult_PaymentPreimageAPIErrorZPtr {
9330 result: Box::into_raw(Box::new(o)),
9336 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9337 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9338 CResult_PaymentPreimageAPIErrorZ {
9339 contents: CResult_PaymentPreimageAPIErrorZPtr {
9340 err: Box::into_raw(Box::new(e)),
9345 /// Checks if the given object is currently in the success state
9347 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9351 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9352 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9353 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9354 fn drop(&mut self) {
9356 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9357 let _ = unsafe { Box::from_raw(self.contents.result) };
9360 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9361 let _ = unsafe { Box::from_raw(self.contents.err) };
9366 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9367 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9368 let contents = if o.result_ok {
9369 let result = unsafe { o.contents.result };
9370 unsafe { o.contents.result = core::ptr::null_mut() };
9371 CResult_PaymentPreimageAPIErrorZPtr { result }
9373 let err = unsafe { o.contents.err };
9374 unsafe { o.contents.err = core::ptr::null_mut(); }
9375 CResult_PaymentPreimageAPIErrorZPtr { err }
9379 result_ok: o.result_ok,
9383 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9384 fn clone(&self) -> Self {
9386 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9387 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9390 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9391 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9397 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9398 /// but with all dynamically-allocated buffers duplicated in new buffers.
9399 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9401 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9402 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9403 /// A pointer to the contents in the success state.
9404 /// Reading from this pointer when `result_ok` is not set is undefined.
9405 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9406 /// A pointer to the contents in the error state.
9407 /// Reading from this pointer when `result_ok` is set is undefined.
9408 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9411 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9412 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9414 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9415 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9416 /// `err` or `result` depending on the state of `result_ok`.
9417 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9418 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9419 pub result_ok: bool,
9422 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9423 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9424 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9425 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9426 result: Box::into_raw(Box::new(o)),
9432 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9433 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9434 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9435 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9436 err: Box::into_raw(Box::new(e)),
9441 /// Checks if the given object is currently in the success state
9443 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9447 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9448 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9449 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9450 fn drop(&mut self) {
9452 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9453 let _ = unsafe { Box::from_raw(self.contents.result) };
9456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9457 let _ = unsafe { Box::from_raw(self.contents.err) };
9462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9463 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9464 let contents = if o.result_ok {
9465 let result = unsafe { o.contents.result };
9466 unsafe { o.contents.result = core::ptr::null_mut() };
9467 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9469 let err = unsafe { o.contents.err };
9470 unsafe { o.contents.err = core::ptr::null_mut(); }
9471 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9475 result_ok: o.result_ok,
9479 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9480 fn clone(&self) -> Self {
9482 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9483 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9486 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9487 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9493 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9494 /// but with all dynamically-allocated buffers duplicated in new buffers.
9495 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9497 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9498 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9499 /// A pointer to the contents in the success state.
9500 /// Reading from this pointer when `result_ok` is not set is undefined.
9501 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9502 /// A pointer to the contents in the error state.
9503 /// Reading from this pointer when `result_ok` is set is undefined.
9504 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9507 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9508 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9510 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9511 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9512 /// `err` or `result` depending on the state of `result_ok`.
9513 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9514 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9515 pub result_ok: bool,
9518 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9519 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9520 CResult_ChannelCounterpartyDecodeErrorZ {
9521 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9522 result: Box::into_raw(Box::new(o)),
9528 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9529 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9530 CResult_ChannelCounterpartyDecodeErrorZ {
9531 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9532 err: Box::into_raw(Box::new(e)),
9537 /// Checks if the given object is currently in the success state
9539 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9543 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9544 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9545 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9546 fn drop(&mut self) {
9548 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9549 let _ = unsafe { Box::from_raw(self.contents.result) };
9552 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9553 let _ = unsafe { Box::from_raw(self.contents.err) };
9558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9559 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9560 let contents = if o.result_ok {
9561 let result = unsafe { o.contents.result };
9562 unsafe { o.contents.result = core::ptr::null_mut() };
9563 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9565 let err = unsafe { o.contents.err };
9566 unsafe { o.contents.err = core::ptr::null_mut(); }
9567 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9571 result_ok: o.result_ok,
9575 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9576 fn clone(&self) -> Self {
9578 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9579 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9582 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9583 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9589 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9590 /// but with all dynamically-allocated buffers duplicated in new buffers.
9591 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9593 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9594 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9595 /// A pointer to the contents in the success state.
9596 /// Reading from this pointer when `result_ok` is not set is undefined.
9597 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9598 /// A pointer to the contents in the error state.
9599 /// Reading from this pointer when `result_ok` is set is undefined.
9600 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9603 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9604 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9606 pub struct CResult_ChannelDetailsDecodeErrorZ {
9607 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9608 /// `err` or `result` depending on the state of `result_ok`.
9609 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9610 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9611 pub result_ok: bool,
9614 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9615 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9616 CResult_ChannelDetailsDecodeErrorZ {
9617 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9618 result: Box::into_raw(Box::new(o)),
9624 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9625 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9626 CResult_ChannelDetailsDecodeErrorZ {
9627 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9628 err: Box::into_raw(Box::new(e)),
9633 /// Checks if the given object is currently in the success state
9635 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9639 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9640 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9641 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9642 fn drop(&mut self) {
9644 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9645 let _ = unsafe { Box::from_raw(self.contents.result) };
9648 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9649 let _ = unsafe { Box::from_raw(self.contents.err) };
9654 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9655 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9656 let contents = if o.result_ok {
9657 let result = unsafe { o.contents.result };
9658 unsafe { o.contents.result = core::ptr::null_mut() };
9659 CResult_ChannelDetailsDecodeErrorZPtr { result }
9661 let err = unsafe { o.contents.err };
9662 unsafe { o.contents.err = core::ptr::null_mut(); }
9663 CResult_ChannelDetailsDecodeErrorZPtr { err }
9667 result_ok: o.result_ok,
9671 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9672 fn clone(&self) -> Self {
9674 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9675 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9678 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9679 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9685 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9686 /// but with all dynamically-allocated buffers duplicated in new buffers.
9687 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9689 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9690 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9691 /// A pointer to the contents in the success state.
9692 /// Reading from this pointer when `result_ok` is not set is undefined.
9693 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9694 /// A pointer to the contents in the error state.
9695 /// Reading from this pointer when `result_ok` is set is undefined.
9696 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9699 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9700 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9702 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9703 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9704 /// `err` or `result` depending on the state of `result_ok`.
9705 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9706 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9707 pub result_ok: bool,
9710 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9711 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9712 CResult_PhantomRouteHintsDecodeErrorZ {
9713 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9714 result: Box::into_raw(Box::new(o)),
9720 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9721 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9722 CResult_PhantomRouteHintsDecodeErrorZ {
9723 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9724 err: Box::into_raw(Box::new(e)),
9729 /// Checks if the given object is currently in the success state
9731 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9735 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9736 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9737 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9738 fn drop(&mut self) {
9740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9741 let _ = unsafe { Box::from_raw(self.contents.result) };
9744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9745 let _ = unsafe { Box::from_raw(self.contents.err) };
9750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9752 let contents = if o.result_ok {
9753 let result = unsafe { o.contents.result };
9754 unsafe { o.contents.result = core::ptr::null_mut() };
9755 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9757 let err = unsafe { o.contents.err };
9758 unsafe { o.contents.err = core::ptr::null_mut(); }
9759 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9763 result_ok: o.result_ok,
9767 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9768 fn clone(&self) -> Self {
9770 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9771 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9774 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9781 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9782 /// but with all dynamically-allocated buffers duplicated in new buffers.
9783 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9785 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9786 /// This corresponds to std::vector in C++
9787 pub struct CVec_ChannelMonitorZ {
9788 /// The elements in the array.
9789 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9790 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9791 /// The number of elements pointed to by `data`.
9794 impl CVec_ChannelMonitorZ {
9795 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9796 if self.datalen == 0 { return Vec::new(); }
9797 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9798 self.data = core::ptr::null_mut();
9802 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9803 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9806 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9807 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9808 let datalen = v.len();
9809 let data = Box::into_raw(v.into_boxed_slice());
9810 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9814 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9815 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9816 impl Drop for CVec_ChannelMonitorZ {
9817 fn drop(&mut self) {
9818 if self.datalen == 0 { return; }
9819 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9823 /// A tuple of 2 elements. See the individual fields for the types contained.
9824 pub struct C2Tuple_BlockHashChannelManagerZ {
9825 /// The element at position 0
9826 pub a: crate::c_types::ThirtyTwoBytes,
9827 /// The element at position 1
9828 pub b: crate::lightning::ln::channelmanager::ChannelManager,
9830 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9831 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9838 impl C2Tuple_BlockHashChannelManagerZ {
9839 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9843 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9845 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9846 C2Tuple_BlockHashChannelManagerZ { a, b, }
9850 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9851 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9853 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9854 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9855 /// A pointer to the contents in the success state.
9856 /// Reading from this pointer when `result_ok` is not set is undefined.
9857 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9858 /// A pointer to the contents in the error state.
9859 /// Reading from this pointer when `result_ok` is set is undefined.
9860 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9863 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9864 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9865 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9866 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9867 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9868 /// `err` or `result` depending on the state of `result_ok`.
9869 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9870 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9871 pub result_ok: bool,
9874 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9875 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9876 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9877 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9878 result: Box::into_raw(Box::new(o)),
9884 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9885 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9886 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9887 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9888 err: Box::into_raw(Box::new(e)),
9893 /// Checks if the given object is currently in the success state
9895 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9899 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9900 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9901 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9902 fn drop(&mut self) {
9904 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9905 let _ = unsafe { Box::from_raw(self.contents.result) };
9908 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9909 let _ = unsafe { Box::from_raw(self.contents.err) };
9914 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9915 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9916 let contents = if o.result_ok {
9917 let result = unsafe { o.contents.result };
9918 unsafe { o.contents.result = core::ptr::null_mut() };
9919 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9921 let err = unsafe { o.contents.err };
9922 unsafe { o.contents.err = core::ptr::null_mut(); }
9923 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9927 result_ok: o.result_ok,
9932 /// The contents of CResult_ChannelConfigDecodeErrorZ
9933 pub union CResult_ChannelConfigDecodeErrorZPtr {
9934 /// A pointer to the contents in the success state.
9935 /// Reading from this pointer when `result_ok` is not set is undefined.
9936 pub result: *mut crate::lightning::util::config::ChannelConfig,
9937 /// A pointer to the contents in the error state.
9938 /// Reading from this pointer when `result_ok` is set is undefined.
9939 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9942 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9943 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9945 pub struct CResult_ChannelConfigDecodeErrorZ {
9946 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9947 /// `err` or `result` depending on the state of `result_ok`.
9948 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9949 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9950 pub result_ok: bool,
9953 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9954 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9955 CResult_ChannelConfigDecodeErrorZ {
9956 contents: CResult_ChannelConfigDecodeErrorZPtr {
9957 result: Box::into_raw(Box::new(o)),
9963 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9964 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9965 CResult_ChannelConfigDecodeErrorZ {
9966 contents: CResult_ChannelConfigDecodeErrorZPtr {
9967 err: Box::into_raw(Box::new(e)),
9972 /// Checks if the given object is currently in the success state
9974 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9978 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9979 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9980 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9981 fn drop(&mut self) {
9983 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9984 let _ = unsafe { Box::from_raw(self.contents.result) };
9987 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9988 let _ = unsafe { Box::from_raw(self.contents.err) };
9993 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9994 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9995 let contents = if o.result_ok {
9996 let result = unsafe { o.contents.result };
9997 unsafe { o.contents.result = core::ptr::null_mut() };
9998 CResult_ChannelConfigDecodeErrorZPtr { result }
10000 let err = unsafe { o.contents.err };
10001 unsafe { o.contents.err = core::ptr::null_mut(); }
10002 CResult_ChannelConfigDecodeErrorZPtr { err }
10006 result_ok: o.result_ok,
10010 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10011 fn clone(&self) -> Self {
10012 if self.result_ok {
10013 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10014 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10017 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10018 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10024 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10025 /// but with all dynamically-allocated buffers duplicated in new buffers.
10026 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10029 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10030 pub enum COption_APIErrorZ {
10031 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10032 Some(crate::lightning::util::errors::APIError),
10033 /// When we're in this state, this COption_APIErrorZ contains nothing
10036 impl COption_APIErrorZ {
10037 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10038 if let Self::None = self { false } else { true }
10040 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10043 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10044 if let Self::Some(v) = self { v } else { unreachable!() }
10048 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10049 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10050 COption_APIErrorZ::Some(o)
10053 /// Constructs a new COption_APIErrorZ containing nothing
10054 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10055 COption_APIErrorZ::None
10058 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10059 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10061 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10062 /// but with all dynamically-allocated buffers duplicated in new buffers.
10063 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10065 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10066 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10067 /// A pointer to the contents in the success state.
10068 /// Reading from this pointer when `result_ok` is not set is undefined.
10069 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10070 /// A pointer to the contents in the error state.
10071 /// Reading from this pointer when `result_ok` is set is undefined.
10072 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10075 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10076 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10078 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10079 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10080 /// `err` or `result` depending on the state of `result_ok`.
10081 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10082 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10083 pub result_ok: bool,
10086 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10087 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10088 CResult_COption_APIErrorZDecodeErrorZ {
10089 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10090 result: Box::into_raw(Box::new(o)),
10096 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10097 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10098 CResult_COption_APIErrorZDecodeErrorZ {
10099 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10100 err: Box::into_raw(Box::new(e)),
10105 /// Checks if the given object is currently in the success state
10107 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10111 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10112 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10113 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10114 fn drop(&mut self) {
10115 if self.result_ok {
10116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10117 let _ = unsafe { Box::from_raw(self.contents.result) };
10120 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10121 let _ = unsafe { Box::from_raw(self.contents.err) };
10126 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10127 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10128 let contents = if o.result_ok {
10129 let result = unsafe { o.contents.result };
10130 unsafe { o.contents.result = core::ptr::null_mut() };
10131 CResult_COption_APIErrorZDecodeErrorZPtr { result }
10133 let err = unsafe { o.contents.err };
10134 unsafe { o.contents.err = core::ptr::null_mut(); }
10135 CResult_COption_APIErrorZDecodeErrorZPtr { err }
10139 result_ok: o.result_ok,
10143 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10144 fn clone(&self) -> Self {
10145 if self.result_ok {
10146 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10147 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10150 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10151 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10157 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10158 /// but with all dynamically-allocated buffers duplicated in new buffers.
10159 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10161 /// The contents of CResult_OutPointDecodeErrorZ
10162 pub union CResult_OutPointDecodeErrorZPtr {
10163 /// A pointer to the contents in the success state.
10164 /// Reading from this pointer when `result_ok` is not set is undefined.
10165 pub result: *mut crate::lightning::chain::transaction::OutPoint,
10166 /// A pointer to the contents in the error state.
10167 /// Reading from this pointer when `result_ok` is set is undefined.
10168 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10171 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
10172 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
10173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10174 pub struct CResult_OutPointDecodeErrorZ {
10175 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
10176 /// `err` or `result` depending on the state of `result_ok`.
10177 pub contents: CResult_OutPointDecodeErrorZPtr,
10178 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
10179 pub result_ok: bool,
10182 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
10183 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
10184 CResult_OutPointDecodeErrorZ {
10185 contents: CResult_OutPointDecodeErrorZPtr {
10186 result: Box::into_raw(Box::new(o)),
10192 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
10193 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
10194 CResult_OutPointDecodeErrorZ {
10195 contents: CResult_OutPointDecodeErrorZPtr {
10196 err: Box::into_raw(Box::new(e)),
10201 /// Checks if the given object is currently in the success state
10203 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
10207 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
10208 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
10209 impl Drop for CResult_OutPointDecodeErrorZ {
10210 fn drop(&mut self) {
10211 if self.result_ok {
10212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10213 let _ = unsafe { Box::from_raw(self.contents.result) };
10216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10217 let _ = unsafe { Box::from_raw(self.contents.err) };
10222 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
10223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
10224 let contents = if o.result_ok {
10225 let result = unsafe { o.contents.result };
10226 unsafe { o.contents.result = core::ptr::null_mut() };
10227 CResult_OutPointDecodeErrorZPtr { result }
10229 let err = unsafe { o.contents.err };
10230 unsafe { o.contents.err = core::ptr::null_mut(); }
10231 CResult_OutPointDecodeErrorZPtr { err }
10235 result_ok: o.result_ok,
10239 impl Clone for CResult_OutPointDecodeErrorZ {
10240 fn clone(&self) -> Self {
10241 if self.result_ok {
10242 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
10243 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
10246 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
10247 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10253 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10254 /// but with all dynamically-allocated buffers duplicated in new buffers.
10255 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
10257 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10258 pub enum COption_TypeZ {
10259 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10260 Some(crate::lightning::ln::wire::Type),
10261 /// When we're in this state, this COption_TypeZ contains nothing
10264 impl COption_TypeZ {
10265 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10266 if let Self::None = self { false } else { true }
10268 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10271 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10272 if let Self::Some(v) = self { v } else { unreachable!() }
10276 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10277 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10278 COption_TypeZ::Some(o)
10281 /// Constructs a new COption_TypeZ containing nothing
10282 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10283 COption_TypeZ::None
10286 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10287 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10289 /// The contents of CResult_COption_TypeZDecodeErrorZ
10290 pub union CResult_COption_TypeZDecodeErrorZPtr {
10291 /// A pointer to the contents in the success state.
10292 /// Reading from this pointer when `result_ok` is not set is undefined.
10293 pub result: *mut crate::c_types::derived::COption_TypeZ,
10294 /// A pointer to the contents in the error state.
10295 /// Reading from this pointer when `result_ok` is set is undefined.
10296 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10299 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10300 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10302 pub struct CResult_COption_TypeZDecodeErrorZ {
10303 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10304 /// `err` or `result` depending on the state of `result_ok`.
10305 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10306 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10307 pub result_ok: bool,
10310 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10311 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10312 CResult_COption_TypeZDecodeErrorZ {
10313 contents: CResult_COption_TypeZDecodeErrorZPtr {
10314 result: Box::into_raw(Box::new(o)),
10320 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10321 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10322 CResult_COption_TypeZDecodeErrorZ {
10323 contents: CResult_COption_TypeZDecodeErrorZPtr {
10324 err: Box::into_raw(Box::new(e)),
10329 /// Checks if the given object is currently in the success state
10331 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
10335 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
10336 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
10337 impl Drop for CResult_COption_TypeZDecodeErrorZ {
10338 fn drop(&mut self) {
10339 if self.result_ok {
10340 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10341 let _ = unsafe { Box::from_raw(self.contents.result) };
10344 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10345 let _ = unsafe { Box::from_raw(self.contents.err) };
10350 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10351 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10352 let contents = if o.result_ok {
10353 let result = unsafe { o.contents.result };
10354 unsafe { o.contents.result = core::ptr::null_mut() };
10355 CResult_COption_TypeZDecodeErrorZPtr { result }
10357 let err = unsafe { o.contents.err };
10358 unsafe { o.contents.err = core::ptr::null_mut(); }
10359 CResult_COption_TypeZDecodeErrorZPtr { err }
10363 result_ok: o.result_ok,
10368 /// The contents of CResult_PaymentIdPaymentErrorZ
10369 pub union CResult_PaymentIdPaymentErrorZPtr {
10370 /// A pointer to the contents in the success state.
10371 /// Reading from this pointer when `result_ok` is not set is undefined.
10372 pub result: *mut crate::c_types::ThirtyTwoBytes,
10373 /// A pointer to the contents in the error state.
10374 /// Reading from this pointer when `result_ok` is set is undefined.
10375 pub err: *mut crate::lightning_invoice::payment::PaymentError,
10378 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
10379 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
10380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10381 pub struct CResult_PaymentIdPaymentErrorZ {
10382 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
10383 /// `err` or `result` depending on the state of `result_ok`.
10384 pub contents: CResult_PaymentIdPaymentErrorZPtr,
10385 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
10386 pub result_ok: bool,
10389 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
10390 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
10391 CResult_PaymentIdPaymentErrorZ {
10392 contents: CResult_PaymentIdPaymentErrorZPtr {
10393 result: Box::into_raw(Box::new(o)),
10399 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
10400 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
10401 CResult_PaymentIdPaymentErrorZ {
10402 contents: CResult_PaymentIdPaymentErrorZPtr {
10403 err: Box::into_raw(Box::new(e)),
10408 /// Checks if the given object is currently in the success state
10410 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
10414 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
10415 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
10416 impl Drop for CResult_PaymentIdPaymentErrorZ {
10417 fn drop(&mut self) {
10418 if self.result_ok {
10419 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10420 let _ = unsafe { Box::from_raw(self.contents.result) };
10423 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10424 let _ = unsafe { Box::from_raw(self.contents.err) };
10429 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
10430 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
10431 let contents = if o.result_ok {
10432 let result = unsafe { o.contents.result };
10433 unsafe { o.contents.result = core::ptr::null_mut() };
10434 CResult_PaymentIdPaymentErrorZPtr { result }
10436 let err = unsafe { o.contents.err };
10437 unsafe { o.contents.err = core::ptr::null_mut(); }
10438 CResult_PaymentIdPaymentErrorZPtr { err }
10442 result_ok: o.result_ok,
10446 impl Clone for CResult_PaymentIdPaymentErrorZ {
10447 fn clone(&self) -> Self {
10448 if self.result_ok {
10449 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
10450 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10453 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
10454 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10460 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
10461 /// but with all dynamically-allocated buffers duplicated in new buffers.
10462 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
10464 /// The contents of CResult_NonePaymentErrorZ
10465 pub union CResult_NonePaymentErrorZPtr {
10466 /// Note that this value is always NULL, as there are no contents in the OK variant
10467 pub result: *mut core::ffi::c_void,
10468 /// A pointer to the contents in the error state.
10469 /// Reading from this pointer when `result_ok` is set is undefined.
10470 pub err: *mut crate::lightning_invoice::payment::PaymentError,
10473 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
10474 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
10475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10476 pub struct CResult_NonePaymentErrorZ {
10477 /// The contents of this CResult_NonePaymentErrorZ, accessible via either
10478 /// `err` or `result` depending on the state of `result_ok`.
10479 pub contents: CResult_NonePaymentErrorZPtr,
10480 /// Whether this CResult_NonePaymentErrorZ represents a success state.
10481 pub result_ok: bool,
10484 /// Creates a new CResult_NonePaymentErrorZ in the success state.
10485 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
10486 CResult_NonePaymentErrorZ {
10487 contents: CResult_NonePaymentErrorZPtr {
10488 result: core::ptr::null_mut(),
10494 /// Creates a new CResult_NonePaymentErrorZ in the error state.
10495 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
10496 CResult_NonePaymentErrorZ {
10497 contents: CResult_NonePaymentErrorZPtr {
10498 err: Box::into_raw(Box::new(e)),
10503 /// Checks if the given object is currently in the success state
10505 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
10509 /// Frees any resources used by the CResult_NonePaymentErrorZ.
10510 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
10511 impl Drop for CResult_NonePaymentErrorZ {
10512 fn drop(&mut self) {
10513 if self.result_ok {
10515 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10516 let _ = unsafe { Box::from_raw(self.contents.err) };
10521 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
10522 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
10523 let contents = if o.result_ok {
10524 let _ = unsafe { Box::from_raw(o.contents.result) };
10525 o.contents.result = core::ptr::null_mut();
10526 CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
10528 let err = unsafe { o.contents.err };
10529 unsafe { o.contents.err = core::ptr::null_mut(); }
10530 CResult_NonePaymentErrorZPtr { err }
10534 result_ok: o.result_ok,
10538 impl Clone for CResult_NonePaymentErrorZ {
10539 fn clone(&self) -> Self {
10540 if self.result_ok {
10541 Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
10542 result: core::ptr::null_mut()
10545 Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
10546 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10552 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
10553 /// but with all dynamically-allocated buffers duplicated in new buffers.
10554 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
10556 /// The contents of CResult_StringErrorZ
10557 pub union CResult_StringErrorZPtr {
10558 /// A pointer to the contents in the success state.
10559 /// Reading from this pointer when `result_ok` is not set is undefined.
10560 pub result: *mut crate::c_types::Str,
10561 /// A pointer to the contents in the error state.
10562 /// Reading from this pointer when `result_ok` is set is undefined.
10563 pub err: *mut crate::c_types::Secp256k1Error,
10566 /// A CResult_StringErrorZ represents the result of a fallible operation,
10567 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10569 pub struct CResult_StringErrorZ {
10570 /// The contents of this CResult_StringErrorZ, accessible via either
10571 /// `err` or `result` depending on the state of `result_ok`.
10572 pub contents: CResult_StringErrorZPtr,
10573 /// Whether this CResult_StringErrorZ represents a success state.
10574 pub result_ok: bool,
10577 /// Creates a new CResult_StringErrorZ in the success state.
10578 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10579 CResult_StringErrorZ {
10580 contents: CResult_StringErrorZPtr {
10581 result: Box::into_raw(Box::new(o)),
10587 /// Creates a new CResult_StringErrorZ in the error state.
10588 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10589 CResult_StringErrorZ {
10590 contents: CResult_StringErrorZPtr {
10591 err: Box::into_raw(Box::new(e)),
10596 /// Checks if the given object is currently in the success state
10598 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10602 /// Frees any resources used by the CResult_StringErrorZ.
10603 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10604 impl Drop for CResult_StringErrorZ {
10605 fn drop(&mut self) {
10606 if self.result_ok {
10607 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10608 let _ = unsafe { Box::from_raw(self.contents.result) };
10611 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10612 let _ = unsafe { Box::from_raw(self.contents.err) };
10617 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10618 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10619 let contents = if o.result_ok {
10620 let result = unsafe { o.contents.result };
10621 unsafe { o.contents.result = core::ptr::null_mut() };
10622 CResult_StringErrorZPtr { result }
10624 let err = unsafe { o.contents.err };
10625 unsafe { o.contents.err = core::ptr::null_mut(); }
10626 CResult_StringErrorZPtr { err }
10630 result_ok: o.result_ok,
10634 impl Clone for CResult_StringErrorZ {
10635 fn clone(&self) -> Self {
10636 if self.result_ok {
10637 Self { result_ok: true, contents: CResult_StringErrorZPtr {
10638 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10641 Self { result_ok: false, contents: CResult_StringErrorZPtr {
10642 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10648 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10649 /// but with all dynamically-allocated buffers duplicated in new buffers.
10650 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10652 /// The contents of CResult_PublicKeyErrorZ
10653 pub union CResult_PublicKeyErrorZPtr {
10654 /// A pointer to the contents in the success state.
10655 /// Reading from this pointer when `result_ok` is not set is undefined.
10656 pub result: *mut crate::c_types::PublicKey,
10657 /// A pointer to the contents in the error state.
10658 /// Reading from this pointer when `result_ok` is set is undefined.
10659 pub err: *mut crate::c_types::Secp256k1Error,
10662 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
10663 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
10664 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10665 pub struct CResult_PublicKeyErrorZ {
10666 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
10667 /// `err` or `result` depending on the state of `result_ok`.
10668 pub contents: CResult_PublicKeyErrorZPtr,
10669 /// Whether this CResult_PublicKeyErrorZ represents a success state.
10670 pub result_ok: bool,
10673 /// Creates a new CResult_PublicKeyErrorZ in the success state.
10674 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
10675 CResult_PublicKeyErrorZ {
10676 contents: CResult_PublicKeyErrorZPtr {
10677 result: Box::into_raw(Box::new(o)),
10683 /// Creates a new CResult_PublicKeyErrorZ in the error state.
10684 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
10685 CResult_PublicKeyErrorZ {
10686 contents: CResult_PublicKeyErrorZPtr {
10687 err: Box::into_raw(Box::new(e)),
10692 /// Checks if the given object is currently in the success state
10694 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
10698 /// Frees any resources used by the CResult_PublicKeyErrorZ.
10699 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
10700 impl Drop for CResult_PublicKeyErrorZ {
10701 fn drop(&mut self) {
10702 if self.result_ok {
10703 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10704 let _ = unsafe { Box::from_raw(self.contents.result) };
10707 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10708 let _ = unsafe { Box::from_raw(self.contents.err) };
10713 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
10714 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
10715 let contents = if o.result_ok {
10716 let result = unsafe { o.contents.result };
10717 unsafe { o.contents.result = core::ptr::null_mut() };
10718 CResult_PublicKeyErrorZPtr { result }
10720 let err = unsafe { o.contents.err };
10721 unsafe { o.contents.err = core::ptr::null_mut(); }
10722 CResult_PublicKeyErrorZPtr { err }
10726 result_ok: o.result_ok,
10730 impl Clone for CResult_PublicKeyErrorZ {
10731 fn clone(&self) -> Self {
10732 if self.result_ok {
10733 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
10734 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
10737 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
10738 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10744 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
10745 /// but with all dynamically-allocated buffers duplicated in new buffers.
10746 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
10748 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10749 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10750 /// A pointer to the contents in the success state.
10751 /// Reading from this pointer when `result_ok` is not set is undefined.
10752 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10753 /// A pointer to the contents in the error state.
10754 /// Reading from this pointer when `result_ok` is set is undefined.
10755 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10758 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10759 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10761 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10762 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10763 /// `err` or `result` depending on the state of `result_ok`.
10764 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10765 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10766 pub result_ok: bool,
10769 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10770 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10771 CResult_ChannelMonitorUpdateDecodeErrorZ {
10772 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10773 result: Box::into_raw(Box::new(o)),
10779 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10780 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10781 CResult_ChannelMonitorUpdateDecodeErrorZ {
10782 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10783 err: Box::into_raw(Box::new(e)),
10788 /// Checks if the given object is currently in the success state
10790 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10794 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10795 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10796 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10797 fn drop(&mut self) {
10798 if self.result_ok {
10799 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10800 let _ = unsafe { Box::from_raw(self.contents.result) };
10803 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10804 let _ = unsafe { Box::from_raw(self.contents.err) };
10809 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10810 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10811 let contents = if o.result_ok {
10812 let result = unsafe { o.contents.result };
10813 unsafe { o.contents.result = core::ptr::null_mut() };
10814 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10816 let err = unsafe { o.contents.err };
10817 unsafe { o.contents.err = core::ptr::null_mut(); }
10818 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10822 result_ok: o.result_ok,
10826 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10827 fn clone(&self) -> Self {
10828 if self.result_ok {
10829 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10830 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10833 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10834 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10840 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10841 /// but with all dynamically-allocated buffers duplicated in new buffers.
10842 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10845 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10846 pub enum COption_MonitorEventZ {
10847 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10848 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10849 /// When we're in this state, this COption_MonitorEventZ contains nothing
10852 impl COption_MonitorEventZ {
10853 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10854 if let Self::None = self { false } else { true }
10856 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10859 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10860 if let Self::Some(v) = self { v } else { unreachable!() }
10864 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10865 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10866 COption_MonitorEventZ::Some(o)
10869 /// Constructs a new COption_MonitorEventZ containing nothing
10870 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10871 COption_MonitorEventZ::None
10874 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10875 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10877 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10878 /// but with all dynamically-allocated buffers duplicated in new buffers.
10879 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10881 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10882 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10883 /// A pointer to the contents in the success state.
10884 /// Reading from this pointer when `result_ok` is not set is undefined.
10885 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10886 /// A pointer to the contents in the error state.
10887 /// Reading from this pointer when `result_ok` is set is undefined.
10888 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10891 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10892 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10894 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10895 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10896 /// `err` or `result` depending on the state of `result_ok`.
10897 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10898 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10899 pub result_ok: bool,
10902 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10903 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10904 CResult_COption_MonitorEventZDecodeErrorZ {
10905 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10906 result: Box::into_raw(Box::new(o)),
10912 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10913 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10914 CResult_COption_MonitorEventZDecodeErrorZ {
10915 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10916 err: Box::into_raw(Box::new(e)),
10921 /// Checks if the given object is currently in the success state
10923 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10927 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10928 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10929 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10930 fn drop(&mut self) {
10931 if self.result_ok {
10932 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10933 let _ = unsafe { Box::from_raw(self.contents.result) };
10936 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10937 let _ = unsafe { Box::from_raw(self.contents.err) };
10942 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10943 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10944 let contents = if o.result_ok {
10945 let result = unsafe { o.contents.result };
10946 unsafe { o.contents.result = core::ptr::null_mut() };
10947 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10949 let err = unsafe { o.contents.err };
10950 unsafe { o.contents.err = core::ptr::null_mut(); }
10951 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10955 result_ok: o.result_ok,
10959 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10960 fn clone(&self) -> Self {
10961 if self.result_ok {
10962 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10963 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10966 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10967 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10973 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10974 /// but with all dynamically-allocated buffers duplicated in new buffers.
10975 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10977 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10978 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10979 /// A pointer to the contents in the success state.
10980 /// Reading from this pointer when `result_ok` is not set is undefined.
10981 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10982 /// A pointer to the contents in the error state.
10983 /// Reading from this pointer when `result_ok` is set is undefined.
10984 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10987 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10988 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10990 pub struct CResult_HTLCUpdateDecodeErrorZ {
10991 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10992 /// `err` or `result` depending on the state of `result_ok`.
10993 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10994 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10995 pub result_ok: bool,
10998 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10999 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11000 CResult_HTLCUpdateDecodeErrorZ {
11001 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11002 result: Box::into_raw(Box::new(o)),
11008 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11009 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11010 CResult_HTLCUpdateDecodeErrorZ {
11011 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11012 err: Box::into_raw(Box::new(e)),
11017 /// Checks if the given object is currently in the success state
11019 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11023 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11024 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11025 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11026 fn drop(&mut self) {
11027 if self.result_ok {
11028 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11029 let _ = unsafe { Box::from_raw(self.contents.result) };
11032 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11033 let _ = unsafe { Box::from_raw(self.contents.err) };
11038 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11039 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11040 let contents = if o.result_ok {
11041 let result = unsafe { o.contents.result };
11042 unsafe { o.contents.result = core::ptr::null_mut() };
11043 CResult_HTLCUpdateDecodeErrorZPtr { result }
11045 let err = unsafe { o.contents.err };
11046 unsafe { o.contents.err = core::ptr::null_mut(); }
11047 CResult_HTLCUpdateDecodeErrorZPtr { err }
11051 result_ok: o.result_ok,
11055 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11056 fn clone(&self) -> Self {
11057 if self.result_ok {
11058 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11059 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11062 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11063 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11069 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11070 /// but with all dynamically-allocated buffers duplicated in new buffers.
11071 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11073 /// A tuple of 2 elements. See the individual fields for the types contained.
11074 pub struct C2Tuple_OutPointScriptZ {
11075 /// The element at position 0
11076 pub a: crate::lightning::chain::transaction::OutPoint,
11077 /// The element at position 1
11078 pub b: crate::c_types::derived::CVec_u8Z,
11080 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11081 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11088 impl C2Tuple_OutPointScriptZ {
11089 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11093 impl Clone for C2Tuple_OutPointScriptZ {
11094 fn clone(&self) -> Self {
11096 a: Clone::clone(&self.a),
11097 b: Clone::clone(&self.b),
11102 /// Creates a new tuple which has the same data as `orig`
11103 /// but with all dynamically-allocated buffers duplicated in new buffers.
11104 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11105 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11107 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11108 C2Tuple_OutPointScriptZ { a, b, }
11112 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11113 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11115 /// A tuple of 2 elements. See the individual fields for the types contained.
11116 pub struct C2Tuple_u32ScriptZ {
11117 /// The element at position 0
11119 /// The element at position 1
11120 pub b: crate::c_types::derived::CVec_u8Z,
11122 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11123 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11130 impl C2Tuple_u32ScriptZ {
11131 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11135 impl Clone for C2Tuple_u32ScriptZ {
11136 fn clone(&self) -> Self {
11138 a: Clone::clone(&self.a),
11139 b: Clone::clone(&self.b),
11144 /// Creates a new tuple which has the same data as `orig`
11145 /// but with all dynamically-allocated buffers duplicated in new buffers.
11146 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11147 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11149 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11150 C2Tuple_u32ScriptZ { a, b, }
11154 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11155 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11157 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11158 /// This corresponds to std::vector in C++
11159 pub struct CVec_C2Tuple_u32ScriptZZ {
11160 /// The elements in the array.
11161 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11162 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11163 /// The number of elements pointed to by `data`.
11166 impl CVec_C2Tuple_u32ScriptZZ {
11167 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11168 if self.datalen == 0 { return Vec::new(); }
11169 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11170 self.data = core::ptr::null_mut();
11174 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11175 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11178 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11179 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11180 let datalen = v.len();
11181 let data = Box::into_raw(v.into_boxed_slice());
11182 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11186 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11187 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11188 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11189 fn drop(&mut self) {
11190 if self.datalen == 0 { return; }
11191 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11194 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11195 fn clone(&self) -> Self {
11196 let mut res = Vec::new();
11197 if self.datalen == 0 { return Self::from(res); }
11198 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11203 /// A tuple of 2 elements. See the individual fields for the types contained.
11204 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11205 /// The element at position 0
11206 pub a: crate::c_types::ThirtyTwoBytes,
11207 /// The element at position 1
11208 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11210 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11211 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11218 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11219 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11223 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11224 fn clone(&self) -> Self {
11226 a: Clone::clone(&self.a),
11227 b: Clone::clone(&self.b),
11232 /// Creates a new tuple which has the same data as `orig`
11233 /// but with all dynamically-allocated buffers duplicated in new buffers.
11234 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11235 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11237 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 {
11238 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11242 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11243 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11245 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11246 /// This corresponds to std::vector in C++
11247 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11248 /// The elements in the array.
11249 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11250 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11251 /// The number of elements pointed to by `data`.
11254 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11255 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11256 if self.datalen == 0 { return Vec::new(); }
11257 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11258 self.data = core::ptr::null_mut();
11262 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11263 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11266 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11267 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11268 let datalen = v.len();
11269 let data = Box::into_raw(v.into_boxed_slice());
11270 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11274 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11275 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11276 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11277 fn drop(&mut self) {
11278 if self.datalen == 0 { return; }
11279 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11282 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11283 fn clone(&self) -> Self {
11284 let mut res = Vec::new();
11285 if self.datalen == 0 { return Self::from(res); }
11286 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11291 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11292 /// This corresponds to std::vector in C++
11293 pub struct CVec_EventZ {
11294 /// The elements in the array.
11295 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11296 pub data: *mut crate::lightning::util::events::Event,
11297 /// The number of elements pointed to by `data`.
11301 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11302 if self.datalen == 0 { return Vec::new(); }
11303 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11304 self.data = core::ptr::null_mut();
11308 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11309 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11312 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11313 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11314 let datalen = v.len();
11315 let data = Box::into_raw(v.into_boxed_slice());
11316 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11320 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11321 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11322 impl Drop for CVec_EventZ {
11323 fn drop(&mut self) {
11324 if self.datalen == 0 { return; }
11325 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11328 impl Clone for CVec_EventZ {
11329 fn clone(&self) -> Self {
11330 let mut res = Vec::new();
11331 if self.datalen == 0 { return Self::from(res); }
11332 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11337 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11338 /// This corresponds to std::vector in C++
11339 pub struct CVec_TransactionZ {
11340 /// The elements in the array.
11341 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11342 pub data: *mut crate::c_types::Transaction,
11343 /// The number of elements pointed to by `data`.
11346 impl CVec_TransactionZ {
11347 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11348 if self.datalen == 0 { return Vec::new(); }
11349 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11350 self.data = core::ptr::null_mut();
11354 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11355 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11358 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11359 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11360 let datalen = v.len();
11361 let data = Box::into_raw(v.into_boxed_slice());
11362 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11366 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11367 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11368 impl Drop for CVec_TransactionZ {
11369 fn drop(&mut self) {
11370 if self.datalen == 0 { return; }
11371 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11374 impl Clone for CVec_TransactionZ {
11375 fn clone(&self) -> Self {
11376 let mut res = Vec::new();
11377 if self.datalen == 0 { return Self::from(res); }
11378 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11383 /// A tuple of 2 elements. See the individual fields for the types contained.
11384 pub struct C2Tuple_u32TxOutZ {
11385 /// The element at position 0
11387 /// The element at position 1
11388 pub b: crate::c_types::TxOut,
11390 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11391 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11398 impl C2Tuple_u32TxOutZ {
11399 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11403 impl Clone for C2Tuple_u32TxOutZ {
11404 fn clone(&self) -> Self {
11406 a: Clone::clone(&self.a),
11407 b: Clone::clone(&self.b),
11412 /// Creates a new tuple which has the same data as `orig`
11413 /// but with all dynamically-allocated buffers duplicated in new buffers.
11414 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11415 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11417 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11418 C2Tuple_u32TxOutZ { a, b, }
11422 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11423 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11425 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11426 /// This corresponds to std::vector in C++
11427 pub struct CVec_C2Tuple_u32TxOutZZ {
11428 /// The elements in the array.
11429 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11430 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11431 /// The number of elements pointed to by `data`.
11434 impl CVec_C2Tuple_u32TxOutZZ {
11435 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11436 if self.datalen == 0 { return Vec::new(); }
11437 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11438 self.data = core::ptr::null_mut();
11442 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11443 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11446 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11447 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11448 let datalen = v.len();
11449 let data = Box::into_raw(v.into_boxed_slice());
11450 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11454 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11455 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11456 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11457 fn drop(&mut self) {
11458 if self.datalen == 0 { return; }
11459 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11462 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11463 fn clone(&self) -> Self {
11464 let mut res = Vec::new();
11465 if self.datalen == 0 { return Self::from(res); }
11466 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11471 /// A tuple of 2 elements. See the individual fields for the types contained.
11472 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11473 /// The element at position 0
11474 pub a: crate::c_types::ThirtyTwoBytes,
11475 /// The element at position 1
11476 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11478 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11479 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11486 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11487 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11491 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11492 fn clone(&self) -> Self {
11494 a: Clone::clone(&self.a),
11495 b: Clone::clone(&self.b),
11500 /// Creates a new tuple which has the same data as `orig`
11501 /// but with all dynamically-allocated buffers duplicated in new buffers.
11502 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11503 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11505 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 {
11506 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11510 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11511 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11513 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11514 /// This corresponds to std::vector in C++
11515 pub struct CVec_TransactionOutputsZ {
11516 /// The elements in the array.
11517 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11518 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11519 /// The number of elements pointed to by `data`.
11522 impl CVec_TransactionOutputsZ {
11523 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11524 if self.datalen == 0 { return Vec::new(); }
11525 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11526 self.data = core::ptr::null_mut();
11530 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11531 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11534 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11535 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11536 let datalen = v.len();
11537 let data = Box::into_raw(v.into_boxed_slice());
11538 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11542 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11543 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11544 impl Drop for CVec_TransactionOutputsZ {
11545 fn drop(&mut self) {
11546 if self.datalen == 0 { return; }
11547 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11550 impl Clone for CVec_TransactionOutputsZ {
11551 fn clone(&self) -> Self {
11552 let mut res = Vec::new();
11553 if self.datalen == 0 { return Self::from(res); }
11554 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11559 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11560 /// This corresponds to std::vector in C++
11561 pub struct CVec_BalanceZ {
11562 /// The elements in the array.
11563 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11564 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11565 /// The number of elements pointed to by `data`.
11568 impl CVec_BalanceZ {
11569 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11570 if self.datalen == 0 { return Vec::new(); }
11571 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11572 self.data = core::ptr::null_mut();
11576 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11577 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11580 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11581 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11582 let datalen = v.len();
11583 let data = Box::into_raw(v.into_boxed_slice());
11584 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11588 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11589 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11590 impl Drop for CVec_BalanceZ {
11591 fn drop(&mut self) {
11592 if self.datalen == 0 { return; }
11593 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11596 impl Clone for CVec_BalanceZ {
11597 fn clone(&self) -> Self {
11598 let mut res = Vec::new();
11599 if self.datalen == 0 { return Self::from(res); }
11600 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11605 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11606 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11607 /// A pointer to the contents in the success state.
11608 /// Reading from this pointer when `result_ok` is not set is undefined.
11609 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11610 /// A pointer to the contents in the error state.
11611 /// Reading from this pointer when `result_ok` is set is undefined.
11612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11615 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11619 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11620 /// `err` or `result` depending on the state of `result_ok`.
11621 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11622 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11623 pub result_ok: bool,
11626 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11628 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11629 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11630 result: Box::into_raw(Box::new(o)),
11636 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11638 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11639 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11640 err: Box::into_raw(Box::new(e)),
11645 /// Checks if the given object is currently in the success state
11647 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11651 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11652 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11653 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11654 fn drop(&mut self) {
11655 if self.result_ok {
11656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11657 let _ = unsafe { Box::from_raw(self.contents.result) };
11660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11661 let _ = unsafe { Box::from_raw(self.contents.err) };
11666 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11667 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11668 let contents = if o.result_ok {
11669 let result = unsafe { o.contents.result };
11670 unsafe { o.contents.result = core::ptr::null_mut() };
11671 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11673 let err = unsafe { o.contents.err };
11674 unsafe { o.contents.err = core::ptr::null_mut(); }
11675 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11679 result_ok: o.result_ok,
11684 /// A tuple of 2 elements. See the individual fields for the types contained.
11685 pub struct C2Tuple_PublicKeyTypeZ {
11686 /// The element at position 0
11687 pub a: crate::c_types::PublicKey,
11688 /// The element at position 1
11689 pub b: crate::lightning::ln::wire::Type,
11691 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11692 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11699 impl C2Tuple_PublicKeyTypeZ {
11700 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11704 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11706 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11707 C2Tuple_PublicKeyTypeZ { a, b, }
11711 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11712 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11714 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11715 /// This corresponds to std::vector in C++
11716 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11717 /// The elements in the array.
11718 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11719 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11720 /// The number of elements pointed to by `data`.
11723 impl CVec_C2Tuple_PublicKeyTypeZZ {
11724 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11725 if self.datalen == 0 { return Vec::new(); }
11726 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11727 self.data = core::ptr::null_mut();
11731 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11732 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11735 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11736 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11737 let datalen = v.len();
11738 let data = Box::into_raw(v.into_boxed_slice());
11739 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11744 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11745 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11746 fn drop(&mut self) {
11747 if self.datalen == 0 { return; }
11748 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11752 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
11753 pub enum COption_CustomOnionMessageContentsZ {
11754 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
11755 Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
11756 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
11759 impl COption_CustomOnionMessageContentsZ {
11760 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11761 if let Self::None = self { false } else { true }
11763 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11766 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
11767 if let Self::Some(v) = self { v } else { unreachable!() }
11771 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
11772 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
11773 COption_CustomOnionMessageContentsZ::Some(o)
11776 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
11777 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
11778 COption_CustomOnionMessageContentsZ::None
11781 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
11782 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
11784 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
11785 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11786 /// A pointer to the contents in the success state.
11787 /// Reading from this pointer when `result_ok` is not set is undefined.
11788 pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
11789 /// A pointer to the contents in the error state.
11790 /// Reading from this pointer when `result_ok` is set is undefined.
11791 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11794 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
11795 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11796 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11797 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11798 /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
11799 /// `err` or `result` depending on the state of `result_ok`.
11800 pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
11801 /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
11802 pub result_ok: bool,
11805 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
11806 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11807 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11808 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11809 result: Box::into_raw(Box::new(o)),
11815 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
11816 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11817 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11818 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11819 err: Box::into_raw(Box::new(e)),
11824 /// Checks if the given object is currently in the success state
11826 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
11830 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
11831 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
11832 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11833 fn drop(&mut self) {
11834 if self.result_ok {
11835 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11836 let _ = unsafe { Box::from_raw(self.contents.result) };
11839 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11840 let _ = unsafe { Box::from_raw(self.contents.err) };
11845 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11846 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11847 let contents = if o.result_ok {
11848 let result = unsafe { o.contents.result };
11849 unsafe { o.contents.result = core::ptr::null_mut() };
11850 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
11852 let err = unsafe { o.contents.err };
11853 unsafe { o.contents.err = core::ptr::null_mut(); }
11854 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
11858 result_ok: o.result_ok,
11864 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11865 pub enum COption_NetAddressZ {
11866 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11867 Some(crate::lightning::ln::msgs::NetAddress),
11868 /// When we're in this state, this COption_NetAddressZ contains nothing
11871 impl COption_NetAddressZ {
11872 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11873 if let Self::None = self { false } else { true }
11875 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11878 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11879 if let Self::Some(v) = self { v } else { unreachable!() }
11883 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11884 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11885 COption_NetAddressZ::Some(o)
11888 /// Constructs a new COption_NetAddressZ containing nothing
11889 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11890 COption_NetAddressZ::None
11893 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11894 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11896 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11897 /// but with all dynamically-allocated buffers duplicated in new buffers.
11898 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11900 /// A tuple of 2 elements. See the individual fields for the types contained.
11901 pub struct C2Tuple_PublicKeyCOption_NetAddressZZ {
11902 /// The element at position 0
11903 pub a: crate::c_types::PublicKey,
11904 /// The element at position 1
11905 pub b: crate::c_types::derived::COption_NetAddressZ,
11907 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ {
11908 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self {
11915 impl C2Tuple_PublicKeyCOption_NetAddressZZ {
11916 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) {
11920 impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ {
11921 fn clone(&self) -> Self {
11923 a: Clone::clone(&self.a),
11924 b: Clone::clone(&self.b),
11929 /// Creates a new tuple which has the same data as `orig`
11930 /// but with all dynamically-allocated buffers duplicated in new buffers.
11931 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) }
11932 /// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
11934 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ {
11935 C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, }
11939 /// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
11940 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { }
11942 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
11943 /// This corresponds to std::vector in C++
11944 pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11945 /// The elements in the array.
11946 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11947 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ,
11948 /// The number of elements pointed to by `data`.
11951 impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11952 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ> {
11953 if self.datalen == 0 { return Vec::new(); }
11954 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11955 self.data = core::ptr::null_mut();
11959 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] {
11960 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11963 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11964 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>) -> Self {
11965 let datalen = v.len();
11966 let data = Box::into_raw(v.into_boxed_slice());
11967 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11971 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11972 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { }
11973 impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11974 fn drop(&mut self) {
11975 if self.datalen == 0 { return; }
11976 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11979 impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11980 fn clone(&self) -> Self {
11981 let mut res = Vec::new();
11982 if self.datalen == 0 { return Self::from(res); }
11983 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11988 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11989 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11990 /// A pointer to the contents in the success state.
11991 /// Reading from this pointer when `result_ok` is not set is undefined.
11992 pub result: *mut crate::c_types::derived::CVec_u8Z,
11993 /// A pointer to the contents in the error state.
11994 /// Reading from this pointer when `result_ok` is set is undefined.
11995 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11998 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11999 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12001 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12002 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12003 /// `err` or `result` depending on the state of `result_ok`.
12004 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12005 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12006 pub result_ok: bool,
12009 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12010 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12011 CResult_CVec_u8ZPeerHandleErrorZ {
12012 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12013 result: Box::into_raw(Box::new(o)),
12019 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12020 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12021 CResult_CVec_u8ZPeerHandleErrorZ {
12022 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12023 err: Box::into_raw(Box::new(e)),
12028 /// Checks if the given object is currently in the success state
12030 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12034 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12035 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12036 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12037 fn drop(&mut self) {
12038 if self.result_ok {
12039 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12040 let _ = unsafe { Box::from_raw(self.contents.result) };
12043 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12044 let _ = unsafe { Box::from_raw(self.contents.err) };
12049 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12050 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12051 let contents = if o.result_ok {
12052 let result = unsafe { o.contents.result };
12053 unsafe { o.contents.result = core::ptr::null_mut() };
12054 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12056 let err = unsafe { o.contents.err };
12057 unsafe { o.contents.err = core::ptr::null_mut(); }
12058 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12062 result_ok: o.result_ok,
12066 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12067 fn clone(&self) -> Self {
12068 if self.result_ok {
12069 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12070 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12073 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12074 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12080 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12081 /// but with all dynamically-allocated buffers duplicated in new buffers.
12082 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12084 /// The contents of CResult_NonePeerHandleErrorZ
12085 pub union CResult_NonePeerHandleErrorZPtr {
12086 /// Note that this value is always NULL, as there are no contents in the OK variant
12087 pub result: *mut core::ffi::c_void,
12088 /// A pointer to the contents in the error state.
12089 /// Reading from this pointer when `result_ok` is set is undefined.
12090 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12093 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12094 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12096 pub struct CResult_NonePeerHandleErrorZ {
12097 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12098 /// `err` or `result` depending on the state of `result_ok`.
12099 pub contents: CResult_NonePeerHandleErrorZPtr,
12100 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12101 pub result_ok: bool,
12104 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12105 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12106 CResult_NonePeerHandleErrorZ {
12107 contents: CResult_NonePeerHandleErrorZPtr {
12108 result: core::ptr::null_mut(),
12114 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12115 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12116 CResult_NonePeerHandleErrorZ {
12117 contents: CResult_NonePeerHandleErrorZPtr {
12118 err: Box::into_raw(Box::new(e)),
12123 /// Checks if the given object is currently in the success state
12125 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12129 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12130 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12131 impl Drop for CResult_NonePeerHandleErrorZ {
12132 fn drop(&mut self) {
12133 if self.result_ok {
12135 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12136 let _ = unsafe { Box::from_raw(self.contents.err) };
12141 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12142 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12143 let contents = if o.result_ok {
12144 let _ = unsafe { Box::from_raw(o.contents.result) };
12145 o.contents.result = core::ptr::null_mut();
12146 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12148 let err = unsafe { o.contents.err };
12149 unsafe { o.contents.err = core::ptr::null_mut(); }
12150 CResult_NonePeerHandleErrorZPtr { err }
12154 result_ok: o.result_ok,
12158 impl Clone for CResult_NonePeerHandleErrorZ {
12159 fn clone(&self) -> Self {
12160 if self.result_ok {
12161 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12162 result: core::ptr::null_mut()
12165 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12166 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12172 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12173 /// but with all dynamically-allocated buffers duplicated in new buffers.
12174 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12176 /// The contents of CResult_boolPeerHandleErrorZ
12177 pub union CResult_boolPeerHandleErrorZPtr {
12178 /// A pointer to the contents in the success state.
12179 /// Reading from this pointer when `result_ok` is not set is undefined.
12180 pub result: *mut bool,
12181 /// A pointer to the contents in the error state.
12182 /// Reading from this pointer when `result_ok` is set is undefined.
12183 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12186 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12187 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12189 pub struct CResult_boolPeerHandleErrorZ {
12190 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12191 /// `err` or `result` depending on the state of `result_ok`.
12192 pub contents: CResult_boolPeerHandleErrorZPtr,
12193 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12194 pub result_ok: bool,
12197 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12198 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12199 CResult_boolPeerHandleErrorZ {
12200 contents: CResult_boolPeerHandleErrorZPtr {
12201 result: Box::into_raw(Box::new(o)),
12207 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12208 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12209 CResult_boolPeerHandleErrorZ {
12210 contents: CResult_boolPeerHandleErrorZPtr {
12211 err: Box::into_raw(Box::new(e)),
12216 /// Checks if the given object is currently in the success state
12218 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12222 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12223 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12224 impl Drop for CResult_boolPeerHandleErrorZ {
12225 fn drop(&mut self) {
12226 if self.result_ok {
12227 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12228 let _ = unsafe { Box::from_raw(self.contents.result) };
12231 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12232 let _ = unsafe { Box::from_raw(self.contents.err) };
12237 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12238 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12239 let contents = if o.result_ok {
12240 let result = unsafe { o.contents.result };
12241 unsafe { o.contents.result = core::ptr::null_mut() };
12242 CResult_boolPeerHandleErrorZPtr { result }
12244 let err = unsafe { o.contents.err };
12245 unsafe { o.contents.err = core::ptr::null_mut(); }
12246 CResult_boolPeerHandleErrorZPtr { err }
12250 result_ok: o.result_ok,
12254 impl Clone for CResult_boolPeerHandleErrorZ {
12255 fn clone(&self) -> Self {
12256 if self.result_ok {
12257 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12258 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12261 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12262 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12268 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12269 /// but with all dynamically-allocated buffers duplicated in new buffers.
12270 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12272 /// The contents of CResult_TxOutUtxoLookupErrorZ
12273 pub union CResult_TxOutUtxoLookupErrorZPtr {
12274 /// A pointer to the contents in the success state.
12275 /// Reading from this pointer when `result_ok` is not set is undefined.
12276 pub result: *mut crate::c_types::TxOut,
12277 /// A pointer to the contents in the error state.
12278 /// Reading from this pointer when `result_ok` is set is undefined.
12279 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
12282 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
12283 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
12284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12285 pub struct CResult_TxOutUtxoLookupErrorZ {
12286 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
12287 /// `err` or `result` depending on the state of `result_ok`.
12288 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
12289 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
12290 pub result_ok: bool,
12293 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
12294 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
12295 CResult_TxOutUtxoLookupErrorZ {
12296 contents: CResult_TxOutUtxoLookupErrorZPtr {
12297 result: Box::into_raw(Box::new(o)),
12303 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
12304 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
12305 CResult_TxOutUtxoLookupErrorZ {
12306 contents: CResult_TxOutUtxoLookupErrorZPtr {
12307 err: Box::into_raw(Box::new(e)),
12312 /// Checks if the given object is currently in the success state
12314 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
12318 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
12319 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
12320 impl Drop for CResult_TxOutUtxoLookupErrorZ {
12321 fn drop(&mut self) {
12322 if self.result_ok {
12323 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12324 let _ = unsafe { Box::from_raw(self.contents.result) };
12327 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12328 let _ = unsafe { Box::from_raw(self.contents.err) };
12333 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
12334 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
12335 let contents = if o.result_ok {
12336 let result = unsafe { o.contents.result };
12337 unsafe { o.contents.result = core::ptr::null_mut() };
12338 CResult_TxOutUtxoLookupErrorZPtr { result }
12340 let err = unsafe { o.contents.err };
12341 unsafe { o.contents.err = core::ptr::null_mut(); }
12342 CResult_TxOutUtxoLookupErrorZPtr { err }
12346 result_ok: o.result_ok,
12350 impl Clone for CResult_TxOutUtxoLookupErrorZ {
12351 fn clone(&self) -> Self {
12352 if self.result_ok {
12353 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
12354 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
12357 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
12358 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
12364 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
12365 /// but with all dynamically-allocated buffers duplicated in new buffers.
12366 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
12368 /// The contents of CResult_NoneSendErrorZ
12369 pub union CResult_NoneSendErrorZPtr {
12370 /// Note that this value is always NULL, as there are no contents in the OK variant
12371 pub result: *mut core::ffi::c_void,
12372 /// A pointer to the contents in the error state.
12373 /// Reading from this pointer when `result_ok` is set is undefined.
12374 pub err: *mut crate::lightning::onion_message::messenger::SendError,
12377 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12378 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12380 pub struct CResult_NoneSendErrorZ {
12381 /// The contents of this CResult_NoneSendErrorZ, accessible via either
12382 /// `err` or `result` depending on the state of `result_ok`.
12383 pub contents: CResult_NoneSendErrorZPtr,
12384 /// Whether this CResult_NoneSendErrorZ represents a success state.
12385 pub result_ok: bool,
12388 /// Creates a new CResult_NoneSendErrorZ in the success state.
12389 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12390 CResult_NoneSendErrorZ {
12391 contents: CResult_NoneSendErrorZPtr {
12392 result: core::ptr::null_mut(),
12398 /// Creates a new CResult_NoneSendErrorZ in the error state.
12399 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12400 CResult_NoneSendErrorZ {
12401 contents: CResult_NoneSendErrorZPtr {
12402 err: Box::into_raw(Box::new(e)),
12407 /// Checks if the given object is currently in the success state
12409 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12413 /// Frees any resources used by the CResult_NoneSendErrorZ.
12414 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12415 impl Drop for CResult_NoneSendErrorZ {
12416 fn drop(&mut self) {
12417 if self.result_ok {
12419 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12420 let _ = unsafe { Box::from_raw(self.contents.err) };
12425 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12426 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12427 let contents = if o.result_ok {
12428 let _ = unsafe { Box::from_raw(o.contents.result) };
12429 o.contents.result = core::ptr::null_mut();
12430 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12432 let err = unsafe { o.contents.err };
12433 unsafe { o.contents.err = core::ptr::null_mut(); }
12434 CResult_NoneSendErrorZPtr { err }
12438 result_ok: o.result_ok,
12443 /// The contents of CResult_SiPrefixParseErrorZ
12444 pub union CResult_SiPrefixParseErrorZPtr {
12445 /// A pointer to the contents in the success state.
12446 /// Reading from this pointer when `result_ok` is not set is undefined.
12447 pub result: *mut crate::lightning_invoice::SiPrefix,
12448 /// A pointer to the contents in the error state.
12449 /// Reading from this pointer when `result_ok` is set is undefined.
12450 pub err: *mut crate::lightning_invoice::ParseError,
12453 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
12454 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
12455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12456 pub struct CResult_SiPrefixParseErrorZ {
12457 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
12458 /// `err` or `result` depending on the state of `result_ok`.
12459 pub contents: CResult_SiPrefixParseErrorZPtr,
12460 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
12461 pub result_ok: bool,
12464 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
12465 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
12466 CResult_SiPrefixParseErrorZ {
12467 contents: CResult_SiPrefixParseErrorZPtr {
12468 result: Box::into_raw(Box::new(o)),
12474 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
12475 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
12476 CResult_SiPrefixParseErrorZ {
12477 contents: CResult_SiPrefixParseErrorZPtr {
12478 err: Box::into_raw(Box::new(e)),
12483 /// Checks if the given object is currently in the success state
12485 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
12489 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
12490 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
12491 impl Drop for CResult_SiPrefixParseErrorZ {
12492 fn drop(&mut self) {
12493 if self.result_ok {
12494 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12495 let _ = unsafe { Box::from_raw(self.contents.result) };
12498 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12499 let _ = unsafe { Box::from_raw(self.contents.err) };
12504 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
12505 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
12506 let contents = if o.result_ok {
12507 let result = unsafe { o.contents.result };
12508 unsafe { o.contents.result = core::ptr::null_mut() };
12509 CResult_SiPrefixParseErrorZPtr { result }
12511 let err = unsafe { o.contents.err };
12512 unsafe { o.contents.err = core::ptr::null_mut(); }
12513 CResult_SiPrefixParseErrorZPtr { err }
12517 result_ok: o.result_ok,
12521 impl Clone for CResult_SiPrefixParseErrorZ {
12522 fn clone(&self) -> Self {
12523 if self.result_ok {
12524 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
12525 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
12528 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
12529 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
12535 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
12536 /// but with all dynamically-allocated buffers duplicated in new buffers.
12537 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
12539 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
12540 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
12541 /// A pointer to the contents in the success state.
12542 /// Reading from this pointer when `result_ok` is not set is undefined.
12543 pub result: *mut crate::lightning_invoice::Invoice,
12544 /// A pointer to the contents in the error state.
12545 /// Reading from this pointer when `result_ok` is set is undefined.
12546 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
12549 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
12550 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
12551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12552 pub struct CResult_InvoiceParseOrSemanticErrorZ {
12553 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
12554 /// `err` or `result` depending on the state of `result_ok`.
12555 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
12556 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
12557 pub result_ok: bool,
12560 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
12561 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
12562 CResult_InvoiceParseOrSemanticErrorZ {
12563 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12564 result: Box::into_raw(Box::new(o)),
12570 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
12571 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
12572 CResult_InvoiceParseOrSemanticErrorZ {
12573 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12574 err: Box::into_raw(Box::new(e)),
12579 /// Checks if the given object is currently in the success state
12581 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
12585 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
12586 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
12587 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
12588 fn drop(&mut self) {
12589 if self.result_ok {
12590 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12591 let _ = unsafe { Box::from_raw(self.contents.result) };
12594 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12595 let _ = unsafe { Box::from_raw(self.contents.err) };
12600 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
12601 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
12602 let contents = if o.result_ok {
12603 let result = unsafe { o.contents.result };
12604 unsafe { o.contents.result = core::ptr::null_mut() };
12605 CResult_InvoiceParseOrSemanticErrorZPtr { result }
12607 let err = unsafe { o.contents.err };
12608 unsafe { o.contents.err = core::ptr::null_mut(); }
12609 CResult_InvoiceParseOrSemanticErrorZPtr { err }
12613 result_ok: o.result_ok,
12617 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
12618 fn clone(&self) -> Self {
12619 if self.result_ok {
12620 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12621 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12624 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12625 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
12631 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
12632 /// but with all dynamically-allocated buffers duplicated in new buffers.
12633 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
12635 /// The contents of CResult_SignedRawInvoiceParseErrorZ
12636 pub union CResult_SignedRawInvoiceParseErrorZPtr {
12637 /// A pointer to the contents in the success state.
12638 /// Reading from this pointer when `result_ok` is not set is undefined.
12639 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
12640 /// A pointer to the contents in the error state.
12641 /// Reading from this pointer when `result_ok` is set is undefined.
12642 pub err: *mut crate::lightning_invoice::ParseError,
12645 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
12646 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
12647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12648 pub struct CResult_SignedRawInvoiceParseErrorZ {
12649 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
12650 /// `err` or `result` depending on the state of `result_ok`.
12651 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
12652 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
12653 pub result_ok: bool,
12656 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
12657 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
12658 CResult_SignedRawInvoiceParseErrorZ {
12659 contents: CResult_SignedRawInvoiceParseErrorZPtr {
12660 result: Box::into_raw(Box::new(o)),
12666 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
12667 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
12668 CResult_SignedRawInvoiceParseErrorZ {
12669 contents: CResult_SignedRawInvoiceParseErrorZPtr {
12670 err: Box::into_raw(Box::new(e)),
12675 /// Checks if the given object is currently in the success state
12677 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
12681 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
12682 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
12683 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
12684 fn drop(&mut self) {
12685 if self.result_ok {
12686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12687 let _ = unsafe { Box::from_raw(self.contents.result) };
12690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12691 let _ = unsafe { Box::from_raw(self.contents.err) };
12696 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
12697 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
12698 let contents = if o.result_ok {
12699 let result = unsafe { o.contents.result };
12700 unsafe { o.contents.result = core::ptr::null_mut() };
12701 CResult_SignedRawInvoiceParseErrorZPtr { result }
12703 let err = unsafe { o.contents.err };
12704 unsafe { o.contents.err = core::ptr::null_mut(); }
12705 CResult_SignedRawInvoiceParseErrorZPtr { err }
12709 result_ok: o.result_ok,
12713 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
12714 fn clone(&self) -> Self {
12715 if self.result_ok {
12716 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
12717 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
12720 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
12721 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
12727 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
12728 /// but with all dynamically-allocated buffers duplicated in new buffers.
12729 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
12731 /// A tuple of 3 elements. See the individual fields for the types contained.
12732 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12733 /// The element at position 0
12734 pub a: crate::lightning_invoice::RawInvoice,
12735 /// The element at position 1
12736 pub b: crate::c_types::ThirtyTwoBytes,
12737 /// The element at position 2
12738 pub c: crate::lightning_invoice::InvoiceSignature,
12740 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12741 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
12749 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12750 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
12751 (self.a, self.b, self.c)
12754 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12755 fn clone(&self) -> Self {
12757 a: Clone::clone(&self.a),
12758 b: Clone::clone(&self.b),
12759 c: Clone::clone(&self.c),
12764 /// Creates a new tuple which has the same data as `orig`
12765 /// but with all dynamically-allocated buffers duplicated in new buffers.
12766 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
12767 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
12769 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 {
12770 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
12774 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
12775 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
12777 /// The contents of CResult_PayeePubKeyErrorZ
12778 pub union CResult_PayeePubKeyErrorZPtr {
12779 /// A pointer to the contents in the success state.
12780 /// Reading from this pointer when `result_ok` is not set is undefined.
12781 pub result: *mut crate::lightning_invoice::PayeePubKey,
12782 /// A pointer to the contents in the error state.
12783 /// Reading from this pointer when `result_ok` is set is undefined.
12784 pub err: *mut crate::c_types::Secp256k1Error,
12787 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
12788 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
12789 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12790 pub struct CResult_PayeePubKeyErrorZ {
12791 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
12792 /// `err` or `result` depending on the state of `result_ok`.
12793 pub contents: CResult_PayeePubKeyErrorZPtr,
12794 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
12795 pub result_ok: bool,
12798 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
12799 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
12800 CResult_PayeePubKeyErrorZ {
12801 contents: CResult_PayeePubKeyErrorZPtr {
12802 result: Box::into_raw(Box::new(o)),
12808 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
12809 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
12810 CResult_PayeePubKeyErrorZ {
12811 contents: CResult_PayeePubKeyErrorZPtr {
12812 err: Box::into_raw(Box::new(e)),
12817 /// Checks if the given object is currently in the success state
12819 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
12823 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
12824 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
12825 impl Drop for CResult_PayeePubKeyErrorZ {
12826 fn drop(&mut self) {
12827 if self.result_ok {
12828 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12829 let _ = unsafe { Box::from_raw(self.contents.result) };
12832 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12833 let _ = unsafe { Box::from_raw(self.contents.err) };
12838 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
12839 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
12840 let contents = if o.result_ok {
12841 let result = unsafe { o.contents.result };
12842 unsafe { o.contents.result = core::ptr::null_mut() };
12843 CResult_PayeePubKeyErrorZPtr { result }
12845 let err = unsafe { o.contents.err };
12846 unsafe { o.contents.err = core::ptr::null_mut(); }
12847 CResult_PayeePubKeyErrorZPtr { err }
12851 result_ok: o.result_ok,
12855 impl Clone for CResult_PayeePubKeyErrorZ {
12856 fn clone(&self) -> Self {
12857 if self.result_ok {
12858 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
12859 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
12862 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
12863 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
12869 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
12870 /// but with all dynamically-allocated buffers duplicated in new buffers.
12871 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
12873 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
12874 /// This corresponds to std::vector in C++
12875 pub struct CVec_PrivateRouteZ {
12876 /// The elements in the array.
12877 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12878 pub data: *mut crate::lightning_invoice::PrivateRoute,
12879 /// The number of elements pointed to by `data`.
12882 impl CVec_PrivateRouteZ {
12883 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
12884 if self.datalen == 0 { return Vec::new(); }
12885 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12886 self.data = core::ptr::null_mut();
12890 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
12891 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12894 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
12895 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
12896 let datalen = v.len();
12897 let data = Box::into_raw(v.into_boxed_slice());
12898 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12902 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12903 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
12904 impl Drop for CVec_PrivateRouteZ {
12905 fn drop(&mut self) {
12906 if self.datalen == 0 { return; }
12907 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12910 impl Clone for CVec_PrivateRouteZ {
12911 fn clone(&self) -> Self {
12912 let mut res = Vec::new();
12913 if self.datalen == 0 { return Self::from(res); }
12914 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12919 /// The contents of CResult_PositiveTimestampCreationErrorZ
12920 pub union CResult_PositiveTimestampCreationErrorZPtr {
12921 /// A pointer to the contents in the success state.
12922 /// Reading from this pointer when `result_ok` is not set is undefined.
12923 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
12924 /// A pointer to the contents in the error state.
12925 /// Reading from this pointer when `result_ok` is set is undefined.
12926 pub err: *mut crate::lightning_invoice::CreationError,
12929 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
12930 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
12931 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12932 pub struct CResult_PositiveTimestampCreationErrorZ {
12933 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
12934 /// `err` or `result` depending on the state of `result_ok`.
12935 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
12936 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
12937 pub result_ok: bool,
12940 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
12941 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
12942 CResult_PositiveTimestampCreationErrorZ {
12943 contents: CResult_PositiveTimestampCreationErrorZPtr {
12944 result: Box::into_raw(Box::new(o)),
12950 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
12951 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
12952 CResult_PositiveTimestampCreationErrorZ {
12953 contents: CResult_PositiveTimestampCreationErrorZPtr {
12954 err: Box::into_raw(Box::new(e)),
12959 /// Checks if the given object is currently in the success state
12961 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
12965 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
12966 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
12967 impl Drop for CResult_PositiveTimestampCreationErrorZ {
12968 fn drop(&mut self) {
12969 if self.result_ok {
12970 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12971 let _ = unsafe { Box::from_raw(self.contents.result) };
12974 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12975 let _ = unsafe { Box::from_raw(self.contents.err) };
12980 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
12981 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
12982 let contents = if o.result_ok {
12983 let result = unsafe { o.contents.result };
12984 unsafe { o.contents.result = core::ptr::null_mut() };
12985 CResult_PositiveTimestampCreationErrorZPtr { result }
12987 let err = unsafe { o.contents.err };
12988 unsafe { o.contents.err = core::ptr::null_mut(); }
12989 CResult_PositiveTimestampCreationErrorZPtr { err }
12993 result_ok: o.result_ok,
12997 impl Clone for CResult_PositiveTimestampCreationErrorZ {
12998 fn clone(&self) -> Self {
12999 if self.result_ok {
13000 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
13001 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
13004 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
13005 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13011 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
13012 /// but with all dynamically-allocated buffers duplicated in new buffers.
13013 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
13015 /// The contents of CResult_NoneSemanticErrorZ
13016 pub union CResult_NoneSemanticErrorZPtr {
13017 /// Note that this value is always NULL, as there are no contents in the OK variant
13018 pub result: *mut core::ffi::c_void,
13019 /// A pointer to the contents in the error state.
13020 /// Reading from this pointer when `result_ok` is set is undefined.
13021 pub err: *mut crate::lightning_invoice::SemanticError,
13024 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
13025 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
13026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13027 pub struct CResult_NoneSemanticErrorZ {
13028 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
13029 /// `err` or `result` depending on the state of `result_ok`.
13030 pub contents: CResult_NoneSemanticErrorZPtr,
13031 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
13032 pub result_ok: bool,
13035 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
13036 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
13037 CResult_NoneSemanticErrorZ {
13038 contents: CResult_NoneSemanticErrorZPtr {
13039 result: core::ptr::null_mut(),
13045 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
13046 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
13047 CResult_NoneSemanticErrorZ {
13048 contents: CResult_NoneSemanticErrorZPtr {
13049 err: Box::into_raw(Box::new(e)),
13054 /// Checks if the given object is currently in the success state
13056 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
13060 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
13061 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
13062 impl Drop for CResult_NoneSemanticErrorZ {
13063 fn drop(&mut self) {
13064 if self.result_ok {
13066 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13067 let _ = unsafe { Box::from_raw(self.contents.err) };
13072 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
13073 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
13074 let contents = if o.result_ok {
13075 let _ = unsafe { Box::from_raw(o.contents.result) };
13076 o.contents.result = core::ptr::null_mut();
13077 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
13079 let err = unsafe { o.contents.err };
13080 unsafe { o.contents.err = core::ptr::null_mut(); }
13081 CResult_NoneSemanticErrorZPtr { err }
13085 result_ok: o.result_ok,
13089 impl Clone for CResult_NoneSemanticErrorZ {
13090 fn clone(&self) -> Self {
13091 if self.result_ok {
13092 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
13093 result: core::ptr::null_mut()
13096 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
13097 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
13103 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
13104 /// but with all dynamically-allocated buffers duplicated in new buffers.
13105 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
13107 /// The contents of CResult_InvoiceSemanticErrorZ
13108 pub union CResult_InvoiceSemanticErrorZPtr {
13109 /// A pointer to the contents in the success state.
13110 /// Reading from this pointer when `result_ok` is not set is undefined.
13111 pub result: *mut crate::lightning_invoice::Invoice,
13112 /// A pointer to the contents in the error state.
13113 /// Reading from this pointer when `result_ok` is set is undefined.
13114 pub err: *mut crate::lightning_invoice::SemanticError,
13117 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
13118 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
13119 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13120 pub struct CResult_InvoiceSemanticErrorZ {
13121 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
13122 /// `err` or `result` depending on the state of `result_ok`.
13123 pub contents: CResult_InvoiceSemanticErrorZPtr,
13124 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
13125 pub result_ok: bool,
13128 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
13129 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
13130 CResult_InvoiceSemanticErrorZ {
13131 contents: CResult_InvoiceSemanticErrorZPtr {
13132 result: Box::into_raw(Box::new(o)),
13138 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
13139 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
13140 CResult_InvoiceSemanticErrorZ {
13141 contents: CResult_InvoiceSemanticErrorZPtr {
13142 err: Box::into_raw(Box::new(e)),
13147 /// Checks if the given object is currently in the success state
13149 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
13153 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
13154 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
13155 impl Drop for CResult_InvoiceSemanticErrorZ {
13156 fn drop(&mut self) {
13157 if self.result_ok {
13158 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13159 let _ = unsafe { Box::from_raw(self.contents.result) };
13162 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13163 let _ = unsafe { Box::from_raw(self.contents.err) };
13168 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
13169 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
13170 let contents = if o.result_ok {
13171 let result = unsafe { o.contents.result };
13172 unsafe { o.contents.result = core::ptr::null_mut() };
13173 CResult_InvoiceSemanticErrorZPtr { result }
13175 let err = unsafe { o.contents.err };
13176 unsafe { o.contents.err = core::ptr::null_mut(); }
13177 CResult_InvoiceSemanticErrorZPtr { err }
13181 result_ok: o.result_ok,
13185 impl Clone for CResult_InvoiceSemanticErrorZ {
13186 fn clone(&self) -> Self {
13187 if self.result_ok {
13188 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
13189 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
13192 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
13193 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
13199 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
13200 /// but with all dynamically-allocated buffers duplicated in new buffers.
13201 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
13203 /// The contents of CResult_DescriptionCreationErrorZ
13204 pub union CResult_DescriptionCreationErrorZPtr {
13205 /// A pointer to the contents in the success state.
13206 /// Reading from this pointer when `result_ok` is not set is undefined.
13207 pub result: *mut crate::lightning_invoice::Description,
13208 /// A pointer to the contents in the error state.
13209 /// Reading from this pointer when `result_ok` is set is undefined.
13210 pub err: *mut crate::lightning_invoice::CreationError,
13213 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
13214 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
13215 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13216 pub struct CResult_DescriptionCreationErrorZ {
13217 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
13218 /// `err` or `result` depending on the state of `result_ok`.
13219 pub contents: CResult_DescriptionCreationErrorZPtr,
13220 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
13221 pub result_ok: bool,
13224 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
13225 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
13226 CResult_DescriptionCreationErrorZ {
13227 contents: CResult_DescriptionCreationErrorZPtr {
13228 result: Box::into_raw(Box::new(o)),
13234 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
13235 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
13236 CResult_DescriptionCreationErrorZ {
13237 contents: CResult_DescriptionCreationErrorZPtr {
13238 err: Box::into_raw(Box::new(e)),
13243 /// Checks if the given object is currently in the success state
13245 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
13249 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
13250 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
13251 impl Drop for CResult_DescriptionCreationErrorZ {
13252 fn drop(&mut self) {
13253 if self.result_ok {
13254 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13255 let _ = unsafe { Box::from_raw(self.contents.result) };
13258 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13259 let _ = unsafe { Box::from_raw(self.contents.err) };
13264 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
13265 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
13266 let contents = if o.result_ok {
13267 let result = unsafe { o.contents.result };
13268 unsafe { o.contents.result = core::ptr::null_mut() };
13269 CResult_DescriptionCreationErrorZPtr { result }
13271 let err = unsafe { o.contents.err };
13272 unsafe { o.contents.err = core::ptr::null_mut(); }
13273 CResult_DescriptionCreationErrorZPtr { err }
13277 result_ok: o.result_ok,
13281 impl Clone for CResult_DescriptionCreationErrorZ {
13282 fn clone(&self) -> Self {
13283 if self.result_ok {
13284 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
13285 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
13288 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
13289 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13295 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
13296 /// but with all dynamically-allocated buffers duplicated in new buffers.
13297 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
13299 /// The contents of CResult_PrivateRouteCreationErrorZ
13300 pub union CResult_PrivateRouteCreationErrorZPtr {
13301 /// A pointer to the contents in the success state.
13302 /// Reading from this pointer when `result_ok` is not set is undefined.
13303 pub result: *mut crate::lightning_invoice::PrivateRoute,
13304 /// A pointer to the contents in the error state.
13305 /// Reading from this pointer when `result_ok` is set is undefined.
13306 pub err: *mut crate::lightning_invoice::CreationError,
13309 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
13310 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
13311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13312 pub struct CResult_PrivateRouteCreationErrorZ {
13313 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
13314 /// `err` or `result` depending on the state of `result_ok`.
13315 pub contents: CResult_PrivateRouteCreationErrorZPtr,
13316 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
13317 pub result_ok: bool,
13320 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
13321 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
13322 CResult_PrivateRouteCreationErrorZ {
13323 contents: CResult_PrivateRouteCreationErrorZPtr {
13324 result: Box::into_raw(Box::new(o)),
13330 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
13331 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
13332 CResult_PrivateRouteCreationErrorZ {
13333 contents: CResult_PrivateRouteCreationErrorZPtr {
13334 err: Box::into_raw(Box::new(e)),
13339 /// Checks if the given object is currently in the success state
13341 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
13345 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
13346 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
13347 impl Drop for CResult_PrivateRouteCreationErrorZ {
13348 fn drop(&mut self) {
13349 if self.result_ok {
13350 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13351 let _ = unsafe { Box::from_raw(self.contents.result) };
13354 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13355 let _ = unsafe { Box::from_raw(self.contents.err) };
13360 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
13361 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
13362 let contents = if o.result_ok {
13363 let result = unsafe { o.contents.result };
13364 unsafe { o.contents.result = core::ptr::null_mut() };
13365 CResult_PrivateRouteCreationErrorZPtr { result }
13367 let err = unsafe { o.contents.err };
13368 unsafe { o.contents.err = core::ptr::null_mut(); }
13369 CResult_PrivateRouteCreationErrorZPtr { err }
13373 result_ok: o.result_ok,
13377 impl Clone for CResult_PrivateRouteCreationErrorZ {
13378 fn clone(&self) -> Self {
13379 if self.result_ok {
13380 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
13381 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
13384 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
13385 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13391 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
13392 /// but with all dynamically-allocated buffers duplicated in new buffers.
13393 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
13395 /// The contents of CResult_u32GraphSyncErrorZ
13396 pub union CResult_u32GraphSyncErrorZPtr {
13397 /// A pointer to the contents in the success state.
13398 /// Reading from this pointer when `result_ok` is not set is undefined.
13399 pub result: *mut u32,
13400 /// A pointer to the contents in the error state.
13401 /// Reading from this pointer when `result_ok` is set is undefined.
13402 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
13405 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13406 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
13407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13408 pub struct CResult_u32GraphSyncErrorZ {
13409 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13410 /// `err` or `result` depending on the state of `result_ok`.
13411 pub contents: CResult_u32GraphSyncErrorZPtr,
13412 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
13413 pub result_ok: bool,
13416 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
13417 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
13418 CResult_u32GraphSyncErrorZ {
13419 contents: CResult_u32GraphSyncErrorZPtr {
13420 result: Box::into_raw(Box::new(o)),
13426 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
13427 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
13428 CResult_u32GraphSyncErrorZ {
13429 contents: CResult_u32GraphSyncErrorZPtr {
13430 err: Box::into_raw(Box::new(e)),
13435 /// Checks if the given object is currently in the success state
13437 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
13441 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
13442 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
13443 impl Drop for CResult_u32GraphSyncErrorZ {
13444 fn drop(&mut self) {
13445 if self.result_ok {
13446 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13447 let _ = unsafe { Box::from_raw(self.contents.result) };
13450 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13451 let _ = unsafe { Box::from_raw(self.contents.err) };
13456 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
13457 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
13458 let contents = if o.result_ok {
13459 let result = unsafe { o.contents.result };
13460 unsafe { o.contents.result = core::ptr::null_mut() };
13461 CResult_u32GraphSyncErrorZPtr { result }
13463 let err = unsafe { o.contents.err };
13464 unsafe { o.contents.err = core::ptr::null_mut(); }
13465 CResult_u32GraphSyncErrorZPtr { err }
13469 result_ok: o.result_ok,
13474 /// The contents of CResult_NetAddressDecodeErrorZ
13475 pub union CResult_NetAddressDecodeErrorZPtr {
13476 /// A pointer to the contents in the success state.
13477 /// Reading from this pointer when `result_ok` is not set is undefined.
13478 pub result: *mut crate::lightning::ln::msgs::NetAddress,
13479 /// A pointer to the contents in the error state.
13480 /// Reading from this pointer when `result_ok` is set is undefined.
13481 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13484 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
13485 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
13486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13487 pub struct CResult_NetAddressDecodeErrorZ {
13488 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
13489 /// `err` or `result` depending on the state of `result_ok`.
13490 pub contents: CResult_NetAddressDecodeErrorZPtr,
13491 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
13492 pub result_ok: bool,
13495 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
13496 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
13497 CResult_NetAddressDecodeErrorZ {
13498 contents: CResult_NetAddressDecodeErrorZPtr {
13499 result: Box::into_raw(Box::new(o)),
13505 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
13506 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
13507 CResult_NetAddressDecodeErrorZ {
13508 contents: CResult_NetAddressDecodeErrorZPtr {
13509 err: Box::into_raw(Box::new(e)),
13514 /// Checks if the given object is currently in the success state
13516 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
13520 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
13521 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
13522 impl Drop for CResult_NetAddressDecodeErrorZ {
13523 fn drop(&mut self) {
13524 if self.result_ok {
13525 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13526 let _ = unsafe { Box::from_raw(self.contents.result) };
13529 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13530 let _ = unsafe { Box::from_raw(self.contents.err) };
13535 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
13536 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
13537 let contents = if o.result_ok {
13538 let result = unsafe { o.contents.result };
13539 unsafe { o.contents.result = core::ptr::null_mut() };
13540 CResult_NetAddressDecodeErrorZPtr { result }
13542 let err = unsafe { o.contents.err };
13543 unsafe { o.contents.err = core::ptr::null_mut(); }
13544 CResult_NetAddressDecodeErrorZPtr { err }
13548 result_ok: o.result_ok,
13552 impl Clone for CResult_NetAddressDecodeErrorZ {
13553 fn clone(&self) -> Self {
13554 if self.result_ok {
13555 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
13556 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
13559 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
13560 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13566 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
13567 /// but with all dynamically-allocated buffers duplicated in new buffers.
13568 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
13570 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
13571 /// This corresponds to std::vector in C++
13572 pub struct CVec_UpdateAddHTLCZ {
13573 /// The elements in the array.
13574 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13575 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13576 /// The number of elements pointed to by `data`.
13579 impl CVec_UpdateAddHTLCZ {
13580 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
13581 if self.datalen == 0 { return Vec::new(); }
13582 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13583 self.data = core::ptr::null_mut();
13587 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
13588 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13591 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
13592 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
13593 let datalen = v.len();
13594 let data = Box::into_raw(v.into_boxed_slice());
13595 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13599 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13600 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
13601 impl Drop for CVec_UpdateAddHTLCZ {
13602 fn drop(&mut self) {
13603 if self.datalen == 0 { return; }
13604 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13607 impl Clone for CVec_UpdateAddHTLCZ {
13608 fn clone(&self) -> Self {
13609 let mut res = Vec::new();
13610 if self.datalen == 0 { return Self::from(res); }
13611 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13616 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
13617 /// This corresponds to std::vector in C++
13618 pub struct CVec_UpdateFulfillHTLCZ {
13619 /// The elements in the array.
13620 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13621 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13622 /// The number of elements pointed to by `data`.
13625 impl CVec_UpdateFulfillHTLCZ {
13626 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
13627 if self.datalen == 0 { return Vec::new(); }
13628 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13629 self.data = core::ptr::null_mut();
13633 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13634 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13637 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13638 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13639 let datalen = v.len();
13640 let data = Box::into_raw(v.into_boxed_slice());
13641 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13645 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13646 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13647 impl Drop for CVec_UpdateFulfillHTLCZ {
13648 fn drop(&mut self) {
13649 if self.datalen == 0 { return; }
13650 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13653 impl Clone for CVec_UpdateFulfillHTLCZ {
13654 fn clone(&self) -> Self {
13655 let mut res = Vec::new();
13656 if self.datalen == 0 { return Self::from(res); }
13657 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13662 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13663 /// This corresponds to std::vector in C++
13664 pub struct CVec_UpdateFailHTLCZ {
13665 /// The elements in the array.
13666 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13667 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13668 /// The number of elements pointed to by `data`.
13671 impl CVec_UpdateFailHTLCZ {
13672 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13673 if self.datalen == 0 { return Vec::new(); }
13674 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13675 self.data = core::ptr::null_mut();
13679 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13680 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13683 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13684 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13685 let datalen = v.len();
13686 let data = Box::into_raw(v.into_boxed_slice());
13687 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13691 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13692 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13693 impl Drop for CVec_UpdateFailHTLCZ {
13694 fn drop(&mut self) {
13695 if self.datalen == 0 { return; }
13696 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13699 impl Clone for CVec_UpdateFailHTLCZ {
13700 fn clone(&self) -> Self {
13701 let mut res = Vec::new();
13702 if self.datalen == 0 { return Self::from(res); }
13703 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13708 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13709 /// This corresponds to std::vector in C++
13710 pub struct CVec_UpdateFailMalformedHTLCZ {
13711 /// The elements in the array.
13712 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13713 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13714 /// The number of elements pointed to by `data`.
13717 impl CVec_UpdateFailMalformedHTLCZ {
13718 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13719 if self.datalen == 0 { return Vec::new(); }
13720 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13721 self.data = core::ptr::null_mut();
13725 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13726 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13729 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13730 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13731 let datalen = v.len();
13732 let data = Box::into_raw(v.into_boxed_slice());
13733 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13737 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13738 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13739 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13740 fn drop(&mut self) {
13741 if self.datalen == 0 { return; }
13742 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13745 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13746 fn clone(&self) -> Self {
13747 let mut res = Vec::new();
13748 if self.datalen == 0 { return Self::from(res); }
13749 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13754 /// The contents of CResult_AcceptChannelDecodeErrorZ
13755 pub union CResult_AcceptChannelDecodeErrorZPtr {
13756 /// A pointer to the contents in the success state.
13757 /// Reading from this pointer when `result_ok` is not set is undefined.
13758 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13759 /// A pointer to the contents in the error state.
13760 /// Reading from this pointer when `result_ok` is set is undefined.
13761 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13764 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13765 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13766 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13767 pub struct CResult_AcceptChannelDecodeErrorZ {
13768 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13769 /// `err` or `result` depending on the state of `result_ok`.
13770 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13771 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13772 pub result_ok: bool,
13775 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13776 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13777 CResult_AcceptChannelDecodeErrorZ {
13778 contents: CResult_AcceptChannelDecodeErrorZPtr {
13779 result: Box::into_raw(Box::new(o)),
13785 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13786 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13787 CResult_AcceptChannelDecodeErrorZ {
13788 contents: CResult_AcceptChannelDecodeErrorZPtr {
13789 err: Box::into_raw(Box::new(e)),
13794 /// Checks if the given object is currently in the success state
13796 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13800 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13801 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13802 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13803 fn drop(&mut self) {
13804 if self.result_ok {
13805 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13806 let _ = unsafe { Box::from_raw(self.contents.result) };
13809 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13810 let _ = unsafe { Box::from_raw(self.contents.err) };
13815 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13816 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13817 let contents = if o.result_ok {
13818 let result = unsafe { o.contents.result };
13819 unsafe { o.contents.result = core::ptr::null_mut() };
13820 CResult_AcceptChannelDecodeErrorZPtr { result }
13822 let err = unsafe { o.contents.err };
13823 unsafe { o.contents.err = core::ptr::null_mut(); }
13824 CResult_AcceptChannelDecodeErrorZPtr { err }
13828 result_ok: o.result_ok,
13832 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13833 fn clone(&self) -> Self {
13834 if self.result_ok {
13835 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13836 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13839 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13840 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13846 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13847 /// but with all dynamically-allocated buffers duplicated in new buffers.
13848 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13850 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13851 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13852 /// A pointer to the contents in the success state.
13853 /// Reading from this pointer when `result_ok` is not set is undefined.
13854 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13855 /// A pointer to the contents in the error state.
13856 /// Reading from this pointer when `result_ok` is set is undefined.
13857 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13860 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13861 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13863 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13864 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13865 /// `err` or `result` depending on the state of `result_ok`.
13866 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13867 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13868 pub result_ok: bool,
13871 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13872 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13873 CResult_AnnouncementSignaturesDecodeErrorZ {
13874 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13875 result: Box::into_raw(Box::new(o)),
13881 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13882 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13883 CResult_AnnouncementSignaturesDecodeErrorZ {
13884 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13885 err: Box::into_raw(Box::new(e)),
13890 /// Checks if the given object is currently in the success state
13892 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13896 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13897 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13898 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13899 fn drop(&mut self) {
13900 if self.result_ok {
13901 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13902 let _ = unsafe { Box::from_raw(self.contents.result) };
13905 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13906 let _ = unsafe { Box::from_raw(self.contents.err) };
13911 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13912 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13913 let contents = if o.result_ok {
13914 let result = unsafe { o.contents.result };
13915 unsafe { o.contents.result = core::ptr::null_mut() };
13916 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13918 let err = unsafe { o.contents.err };
13919 unsafe { o.contents.err = core::ptr::null_mut(); }
13920 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13924 result_ok: o.result_ok,
13928 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13929 fn clone(&self) -> Self {
13930 if self.result_ok {
13931 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13932 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13935 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13936 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13942 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13943 /// but with all dynamically-allocated buffers duplicated in new buffers.
13944 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13946 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13947 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13948 /// A pointer to the contents in the success state.
13949 /// Reading from this pointer when `result_ok` is not set is undefined.
13950 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13951 /// A pointer to the contents in the error state.
13952 /// Reading from this pointer when `result_ok` is set is undefined.
13953 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13956 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13957 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13959 pub struct CResult_ChannelReestablishDecodeErrorZ {
13960 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13961 /// `err` or `result` depending on the state of `result_ok`.
13962 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13963 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13964 pub result_ok: bool,
13967 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13968 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13969 CResult_ChannelReestablishDecodeErrorZ {
13970 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13971 result: Box::into_raw(Box::new(o)),
13977 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13978 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13979 CResult_ChannelReestablishDecodeErrorZ {
13980 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13981 err: Box::into_raw(Box::new(e)),
13986 /// Checks if the given object is currently in the success state
13988 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13992 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13993 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13994 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13995 fn drop(&mut self) {
13996 if self.result_ok {
13997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13998 let _ = unsafe { Box::from_raw(self.contents.result) };
14001 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14002 let _ = unsafe { Box::from_raw(self.contents.err) };
14007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14008 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14009 let contents = if o.result_ok {
14010 let result = unsafe { o.contents.result };
14011 unsafe { o.contents.result = core::ptr::null_mut() };
14012 CResult_ChannelReestablishDecodeErrorZPtr { result }
14014 let err = unsafe { o.contents.err };
14015 unsafe { o.contents.err = core::ptr::null_mut(); }
14016 CResult_ChannelReestablishDecodeErrorZPtr { err }
14020 result_ok: o.result_ok,
14024 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14025 fn clone(&self) -> Self {
14026 if self.result_ok {
14027 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14028 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14031 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14032 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14038 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14039 /// but with all dynamically-allocated buffers duplicated in new buffers.
14040 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14042 /// The contents of CResult_ClosingSignedDecodeErrorZ
14043 pub union CResult_ClosingSignedDecodeErrorZPtr {
14044 /// A pointer to the contents in the success state.
14045 /// Reading from this pointer when `result_ok` is not set is undefined.
14046 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14047 /// A pointer to the contents in the error state.
14048 /// Reading from this pointer when `result_ok` is set is undefined.
14049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14052 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14053 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14055 pub struct CResult_ClosingSignedDecodeErrorZ {
14056 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14057 /// `err` or `result` depending on the state of `result_ok`.
14058 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14059 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14060 pub result_ok: bool,
14063 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14064 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14065 CResult_ClosingSignedDecodeErrorZ {
14066 contents: CResult_ClosingSignedDecodeErrorZPtr {
14067 result: Box::into_raw(Box::new(o)),
14073 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14074 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14075 CResult_ClosingSignedDecodeErrorZ {
14076 contents: CResult_ClosingSignedDecodeErrorZPtr {
14077 err: Box::into_raw(Box::new(e)),
14082 /// Checks if the given object is currently in the success state
14084 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14088 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14089 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14090 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14091 fn drop(&mut self) {
14092 if self.result_ok {
14093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14094 let _ = unsafe { Box::from_raw(self.contents.result) };
14097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14098 let _ = unsafe { Box::from_raw(self.contents.err) };
14103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14104 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14105 let contents = if o.result_ok {
14106 let result = unsafe { o.contents.result };
14107 unsafe { o.contents.result = core::ptr::null_mut() };
14108 CResult_ClosingSignedDecodeErrorZPtr { result }
14110 let err = unsafe { o.contents.err };
14111 unsafe { o.contents.err = core::ptr::null_mut(); }
14112 CResult_ClosingSignedDecodeErrorZPtr { err }
14116 result_ok: o.result_ok,
14120 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14121 fn clone(&self) -> Self {
14122 if self.result_ok {
14123 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14124 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14127 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14128 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14134 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14135 /// but with all dynamically-allocated buffers duplicated in new buffers.
14136 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14138 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14139 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14140 /// A pointer to the contents in the success state.
14141 /// Reading from this pointer when `result_ok` is not set is undefined.
14142 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14143 /// A pointer to the contents in the error state.
14144 /// Reading from this pointer when `result_ok` is set is undefined.
14145 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14148 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14149 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14151 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14152 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14153 /// `err` or `result` depending on the state of `result_ok`.
14154 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14155 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14156 pub result_ok: bool,
14159 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14160 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14161 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14162 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14163 result: Box::into_raw(Box::new(o)),
14169 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14170 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14171 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14172 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14173 err: Box::into_raw(Box::new(e)),
14178 /// Checks if the given object is currently in the success state
14180 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14184 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14185 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14186 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14187 fn drop(&mut self) {
14188 if self.result_ok {
14189 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14190 let _ = unsafe { Box::from_raw(self.contents.result) };
14193 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14194 let _ = unsafe { Box::from_raw(self.contents.err) };
14199 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14200 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14201 let contents = if o.result_ok {
14202 let result = unsafe { o.contents.result };
14203 unsafe { o.contents.result = core::ptr::null_mut() };
14204 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14206 let err = unsafe { o.contents.err };
14207 unsafe { o.contents.err = core::ptr::null_mut(); }
14208 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14212 result_ok: o.result_ok,
14216 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14217 fn clone(&self) -> Self {
14218 if self.result_ok {
14219 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14220 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
14223 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14224 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14230 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
14231 /// but with all dynamically-allocated buffers duplicated in new buffers.
14232 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
14234 /// The contents of CResult_CommitmentSignedDecodeErrorZ
14235 pub union CResult_CommitmentSignedDecodeErrorZPtr {
14236 /// A pointer to the contents in the success state.
14237 /// Reading from this pointer when `result_ok` is not set is undefined.
14238 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
14239 /// A pointer to the contents in the error state.
14240 /// Reading from this pointer when `result_ok` is set is undefined.
14241 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14244 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
14245 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14247 pub struct CResult_CommitmentSignedDecodeErrorZ {
14248 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
14249 /// `err` or `result` depending on the state of `result_ok`.
14250 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
14251 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
14252 pub result_ok: bool,
14255 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
14256 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
14257 CResult_CommitmentSignedDecodeErrorZ {
14258 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14259 result: Box::into_raw(Box::new(o)),
14265 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
14266 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
14267 CResult_CommitmentSignedDecodeErrorZ {
14268 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14269 err: Box::into_raw(Box::new(e)),
14274 /// Checks if the given object is currently in the success state
14276 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
14280 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
14281 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
14282 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
14283 fn drop(&mut self) {
14284 if self.result_ok {
14285 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14286 let _ = unsafe { Box::from_raw(self.contents.result) };
14289 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14290 let _ = unsafe { Box::from_raw(self.contents.err) };
14295 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
14296 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14297 let contents = if o.result_ok {
14298 let result = unsafe { o.contents.result };
14299 unsafe { o.contents.result = core::ptr::null_mut() };
14300 CResult_CommitmentSignedDecodeErrorZPtr { result }
14302 let err = unsafe { o.contents.err };
14303 unsafe { o.contents.err = core::ptr::null_mut(); }
14304 CResult_CommitmentSignedDecodeErrorZPtr { err }
14308 result_ok: o.result_ok,
14312 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
14313 fn clone(&self) -> Self {
14314 if self.result_ok {
14315 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
14316 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
14319 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
14320 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14326 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
14327 /// but with all dynamically-allocated buffers duplicated in new buffers.
14328 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
14330 /// The contents of CResult_FundingCreatedDecodeErrorZ
14331 pub union CResult_FundingCreatedDecodeErrorZPtr {
14332 /// A pointer to the contents in the success state.
14333 /// Reading from this pointer when `result_ok` is not set is undefined.
14334 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
14335 /// A pointer to the contents in the error state.
14336 /// Reading from this pointer when `result_ok` is set is undefined.
14337 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14340 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
14341 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
14342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14343 pub struct CResult_FundingCreatedDecodeErrorZ {
14344 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
14345 /// `err` or `result` depending on the state of `result_ok`.
14346 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
14347 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
14348 pub result_ok: bool,
14351 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
14352 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
14353 CResult_FundingCreatedDecodeErrorZ {
14354 contents: CResult_FundingCreatedDecodeErrorZPtr {
14355 result: Box::into_raw(Box::new(o)),
14361 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
14362 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
14363 CResult_FundingCreatedDecodeErrorZ {
14364 contents: CResult_FundingCreatedDecodeErrorZPtr {
14365 err: Box::into_raw(Box::new(e)),
14370 /// Checks if the given object is currently in the success state
14372 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
14376 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
14377 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
14378 impl Drop for CResult_FundingCreatedDecodeErrorZ {
14379 fn drop(&mut self) {
14380 if self.result_ok {
14381 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14382 let _ = unsafe { Box::from_raw(self.contents.result) };
14385 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14386 let _ = unsafe { Box::from_raw(self.contents.err) };
14391 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
14392 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
14393 let contents = if o.result_ok {
14394 let result = unsafe { o.contents.result };
14395 unsafe { o.contents.result = core::ptr::null_mut() };
14396 CResult_FundingCreatedDecodeErrorZPtr { result }
14398 let err = unsafe { o.contents.err };
14399 unsafe { o.contents.err = core::ptr::null_mut(); }
14400 CResult_FundingCreatedDecodeErrorZPtr { err }
14404 result_ok: o.result_ok,
14408 impl Clone for CResult_FundingCreatedDecodeErrorZ {
14409 fn clone(&self) -> Self {
14410 if self.result_ok {
14411 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
14412 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
14415 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
14416 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14422 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
14423 /// but with all dynamically-allocated buffers duplicated in new buffers.
14424 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
14426 /// The contents of CResult_FundingSignedDecodeErrorZ
14427 pub union CResult_FundingSignedDecodeErrorZPtr {
14428 /// A pointer to the contents in the success state.
14429 /// Reading from this pointer when `result_ok` is not set is undefined.
14430 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
14431 /// A pointer to the contents in the error state.
14432 /// Reading from this pointer when `result_ok` is set is undefined.
14433 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14436 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
14437 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14438 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14439 pub struct CResult_FundingSignedDecodeErrorZ {
14440 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
14441 /// `err` or `result` depending on the state of `result_ok`.
14442 pub contents: CResult_FundingSignedDecodeErrorZPtr,
14443 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
14444 pub result_ok: bool,
14447 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
14448 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
14449 CResult_FundingSignedDecodeErrorZ {
14450 contents: CResult_FundingSignedDecodeErrorZPtr {
14451 result: Box::into_raw(Box::new(o)),
14457 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
14458 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
14459 CResult_FundingSignedDecodeErrorZ {
14460 contents: CResult_FundingSignedDecodeErrorZPtr {
14461 err: Box::into_raw(Box::new(e)),
14466 /// Checks if the given object is currently in the success state
14468 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
14472 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
14473 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
14474 impl Drop for CResult_FundingSignedDecodeErrorZ {
14475 fn drop(&mut self) {
14476 if self.result_ok {
14477 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14478 let _ = unsafe { Box::from_raw(self.contents.result) };
14481 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14482 let _ = unsafe { Box::from_raw(self.contents.err) };
14487 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
14488 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14489 let contents = if o.result_ok {
14490 let result = unsafe { o.contents.result };
14491 unsafe { o.contents.result = core::ptr::null_mut() };
14492 CResult_FundingSignedDecodeErrorZPtr { result }
14494 let err = unsafe { o.contents.err };
14495 unsafe { o.contents.err = core::ptr::null_mut(); }
14496 CResult_FundingSignedDecodeErrorZPtr { err }
14500 result_ok: o.result_ok,
14504 impl Clone for CResult_FundingSignedDecodeErrorZ {
14505 fn clone(&self) -> Self {
14506 if self.result_ok {
14507 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
14508 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
14511 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
14512 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14518 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
14519 /// but with all dynamically-allocated buffers duplicated in new buffers.
14520 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
14522 /// The contents of CResult_ChannelReadyDecodeErrorZ
14523 pub union CResult_ChannelReadyDecodeErrorZPtr {
14524 /// A pointer to the contents in the success state.
14525 /// Reading from this pointer when `result_ok` is not set is undefined.
14526 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
14527 /// A pointer to the contents in the error state.
14528 /// Reading from this pointer when `result_ok` is set is undefined.
14529 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14532 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
14533 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
14534 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14535 pub struct CResult_ChannelReadyDecodeErrorZ {
14536 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
14537 /// `err` or `result` depending on the state of `result_ok`.
14538 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
14539 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
14540 pub result_ok: bool,
14543 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
14544 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
14545 CResult_ChannelReadyDecodeErrorZ {
14546 contents: CResult_ChannelReadyDecodeErrorZPtr {
14547 result: Box::into_raw(Box::new(o)),
14553 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
14554 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
14555 CResult_ChannelReadyDecodeErrorZ {
14556 contents: CResult_ChannelReadyDecodeErrorZPtr {
14557 err: Box::into_raw(Box::new(e)),
14562 /// Checks if the given object is currently in the success state
14564 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
14568 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
14569 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
14570 impl Drop for CResult_ChannelReadyDecodeErrorZ {
14571 fn drop(&mut self) {
14572 if self.result_ok {
14573 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14574 let _ = unsafe { Box::from_raw(self.contents.result) };
14577 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14578 let _ = unsafe { Box::from_raw(self.contents.err) };
14583 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
14584 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
14585 let contents = if o.result_ok {
14586 let result = unsafe { o.contents.result };
14587 unsafe { o.contents.result = core::ptr::null_mut() };
14588 CResult_ChannelReadyDecodeErrorZPtr { result }
14590 let err = unsafe { o.contents.err };
14591 unsafe { o.contents.err = core::ptr::null_mut(); }
14592 CResult_ChannelReadyDecodeErrorZPtr { err }
14596 result_ok: o.result_ok,
14600 impl Clone for CResult_ChannelReadyDecodeErrorZ {
14601 fn clone(&self) -> Self {
14602 if self.result_ok {
14603 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
14604 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
14607 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
14608 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14614 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
14615 /// but with all dynamically-allocated buffers duplicated in new buffers.
14616 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
14618 /// The contents of CResult_InitDecodeErrorZ
14619 pub union CResult_InitDecodeErrorZPtr {
14620 /// A pointer to the contents in the success state.
14621 /// Reading from this pointer when `result_ok` is not set is undefined.
14622 pub result: *mut crate::lightning::ln::msgs::Init,
14623 /// A pointer to the contents in the error state.
14624 /// Reading from this pointer when `result_ok` is set is undefined.
14625 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14628 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
14629 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
14630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14631 pub struct CResult_InitDecodeErrorZ {
14632 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
14633 /// `err` or `result` depending on the state of `result_ok`.
14634 pub contents: CResult_InitDecodeErrorZPtr,
14635 /// Whether this CResult_InitDecodeErrorZ represents a success state.
14636 pub result_ok: bool,
14639 /// Creates a new CResult_InitDecodeErrorZ in the success state.
14640 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
14641 CResult_InitDecodeErrorZ {
14642 contents: CResult_InitDecodeErrorZPtr {
14643 result: Box::into_raw(Box::new(o)),
14649 /// Creates a new CResult_InitDecodeErrorZ in the error state.
14650 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
14651 CResult_InitDecodeErrorZ {
14652 contents: CResult_InitDecodeErrorZPtr {
14653 err: Box::into_raw(Box::new(e)),
14658 /// Checks if the given object is currently in the success state
14660 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
14664 /// Frees any resources used by the CResult_InitDecodeErrorZ.
14665 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
14666 impl Drop for CResult_InitDecodeErrorZ {
14667 fn drop(&mut self) {
14668 if self.result_ok {
14669 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14670 let _ = unsafe { Box::from_raw(self.contents.result) };
14673 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14674 let _ = unsafe { Box::from_raw(self.contents.err) };
14679 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
14680 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
14681 let contents = if o.result_ok {
14682 let result = unsafe { o.contents.result };
14683 unsafe { o.contents.result = core::ptr::null_mut() };
14684 CResult_InitDecodeErrorZPtr { result }
14686 let err = unsafe { o.contents.err };
14687 unsafe { o.contents.err = core::ptr::null_mut(); }
14688 CResult_InitDecodeErrorZPtr { err }
14692 result_ok: o.result_ok,
14696 impl Clone for CResult_InitDecodeErrorZ {
14697 fn clone(&self) -> Self {
14698 if self.result_ok {
14699 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
14700 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
14703 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
14704 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14710 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14711 /// but with all dynamically-allocated buffers duplicated in new buffers.
14712 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
14714 /// The contents of CResult_OpenChannelDecodeErrorZ
14715 pub union CResult_OpenChannelDecodeErrorZPtr {
14716 /// A pointer to the contents in the success state.
14717 /// Reading from this pointer when `result_ok` is not set is undefined.
14718 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
14719 /// A pointer to the contents in the error state.
14720 /// Reading from this pointer when `result_ok` is set is undefined.
14721 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14724 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
14725 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14727 pub struct CResult_OpenChannelDecodeErrorZ {
14728 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
14729 /// `err` or `result` depending on the state of `result_ok`.
14730 pub contents: CResult_OpenChannelDecodeErrorZPtr,
14731 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
14732 pub result_ok: bool,
14735 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14736 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
14737 CResult_OpenChannelDecodeErrorZ {
14738 contents: CResult_OpenChannelDecodeErrorZPtr {
14739 result: Box::into_raw(Box::new(o)),
14745 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14746 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14747 CResult_OpenChannelDecodeErrorZ {
14748 contents: CResult_OpenChannelDecodeErrorZPtr {
14749 err: Box::into_raw(Box::new(e)),
14754 /// Checks if the given object is currently in the success state
14756 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14760 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14761 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14762 impl Drop for CResult_OpenChannelDecodeErrorZ {
14763 fn drop(&mut self) {
14764 if self.result_ok {
14765 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14766 let _ = unsafe { Box::from_raw(self.contents.result) };
14769 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14770 let _ = unsafe { Box::from_raw(self.contents.err) };
14775 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14776 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14777 let contents = if o.result_ok {
14778 let result = unsafe { o.contents.result };
14779 unsafe { o.contents.result = core::ptr::null_mut() };
14780 CResult_OpenChannelDecodeErrorZPtr { result }
14782 let err = unsafe { o.contents.err };
14783 unsafe { o.contents.err = core::ptr::null_mut(); }
14784 CResult_OpenChannelDecodeErrorZPtr { err }
14788 result_ok: o.result_ok,
14792 impl Clone for CResult_OpenChannelDecodeErrorZ {
14793 fn clone(&self) -> Self {
14794 if self.result_ok {
14795 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14796 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14799 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14800 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14806 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14807 /// but with all dynamically-allocated buffers duplicated in new buffers.
14808 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14810 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14811 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14812 /// A pointer to the contents in the success state.
14813 /// Reading from this pointer when `result_ok` is not set is undefined.
14814 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14815 /// A pointer to the contents in the error state.
14816 /// Reading from this pointer when `result_ok` is set is undefined.
14817 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14820 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14821 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14823 pub struct CResult_RevokeAndACKDecodeErrorZ {
14824 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14825 /// `err` or `result` depending on the state of `result_ok`.
14826 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14827 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14828 pub result_ok: bool,
14831 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14832 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14833 CResult_RevokeAndACKDecodeErrorZ {
14834 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14835 result: Box::into_raw(Box::new(o)),
14841 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14842 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14843 CResult_RevokeAndACKDecodeErrorZ {
14844 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14845 err: Box::into_raw(Box::new(e)),
14850 /// Checks if the given object is currently in the success state
14852 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14856 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14857 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14858 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14859 fn drop(&mut self) {
14860 if self.result_ok {
14861 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14862 let _ = unsafe { Box::from_raw(self.contents.result) };
14865 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14866 let _ = unsafe { Box::from_raw(self.contents.err) };
14871 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14872 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14873 let contents = if o.result_ok {
14874 let result = unsafe { o.contents.result };
14875 unsafe { o.contents.result = core::ptr::null_mut() };
14876 CResult_RevokeAndACKDecodeErrorZPtr { result }
14878 let err = unsafe { o.contents.err };
14879 unsafe { o.contents.err = core::ptr::null_mut(); }
14880 CResult_RevokeAndACKDecodeErrorZPtr { err }
14884 result_ok: o.result_ok,
14888 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14889 fn clone(&self) -> Self {
14890 if self.result_ok {
14891 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14892 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14895 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14896 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14902 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14903 /// but with all dynamically-allocated buffers duplicated in new buffers.
14904 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14906 /// The contents of CResult_ShutdownDecodeErrorZ
14907 pub union CResult_ShutdownDecodeErrorZPtr {
14908 /// A pointer to the contents in the success state.
14909 /// Reading from this pointer when `result_ok` is not set is undefined.
14910 pub result: *mut crate::lightning::ln::msgs::Shutdown,
14911 /// A pointer to the contents in the error state.
14912 /// Reading from this pointer when `result_ok` is set is undefined.
14913 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14916 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14917 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14918 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14919 pub struct CResult_ShutdownDecodeErrorZ {
14920 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14921 /// `err` or `result` depending on the state of `result_ok`.
14922 pub contents: CResult_ShutdownDecodeErrorZPtr,
14923 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14924 pub result_ok: bool,
14927 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14928 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14929 CResult_ShutdownDecodeErrorZ {
14930 contents: CResult_ShutdownDecodeErrorZPtr {
14931 result: Box::into_raw(Box::new(o)),
14937 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14938 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14939 CResult_ShutdownDecodeErrorZ {
14940 contents: CResult_ShutdownDecodeErrorZPtr {
14941 err: Box::into_raw(Box::new(e)),
14946 /// Checks if the given object is currently in the success state
14948 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14952 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14953 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14954 impl Drop for CResult_ShutdownDecodeErrorZ {
14955 fn drop(&mut self) {
14956 if self.result_ok {
14957 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14958 let _ = unsafe { Box::from_raw(self.contents.result) };
14961 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14962 let _ = unsafe { Box::from_raw(self.contents.err) };
14967 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14968 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14969 let contents = if o.result_ok {
14970 let result = unsafe { o.contents.result };
14971 unsafe { o.contents.result = core::ptr::null_mut() };
14972 CResult_ShutdownDecodeErrorZPtr { result }
14974 let err = unsafe { o.contents.err };
14975 unsafe { o.contents.err = core::ptr::null_mut(); }
14976 CResult_ShutdownDecodeErrorZPtr { err }
14980 result_ok: o.result_ok,
14984 impl Clone for CResult_ShutdownDecodeErrorZ {
14985 fn clone(&self) -> Self {
14986 if self.result_ok {
14987 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14988 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14991 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14992 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14998 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14999 /// but with all dynamically-allocated buffers duplicated in new buffers.
15000 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15002 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15003 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15004 /// A pointer to the contents in the success state.
15005 /// Reading from this pointer when `result_ok` is not set is undefined.
15006 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15007 /// A pointer to the contents in the error state.
15008 /// Reading from this pointer when `result_ok` is set is undefined.
15009 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15012 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15013 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15015 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15016 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15017 /// `err` or `result` depending on the state of `result_ok`.
15018 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15019 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15020 pub result_ok: bool,
15023 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15024 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15025 CResult_UpdateFailHTLCDecodeErrorZ {
15026 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15027 result: Box::into_raw(Box::new(o)),
15033 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15034 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15035 CResult_UpdateFailHTLCDecodeErrorZ {
15036 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15037 err: Box::into_raw(Box::new(e)),
15042 /// Checks if the given object is currently in the success state
15044 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15048 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15049 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15050 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15051 fn drop(&mut self) {
15052 if self.result_ok {
15053 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15054 let _ = unsafe { Box::from_raw(self.contents.result) };
15057 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15058 let _ = unsafe { Box::from_raw(self.contents.err) };
15063 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15064 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15065 let contents = if o.result_ok {
15066 let result = unsafe { o.contents.result };
15067 unsafe { o.contents.result = core::ptr::null_mut() };
15068 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15070 let err = unsafe { o.contents.err };
15071 unsafe { o.contents.err = core::ptr::null_mut(); }
15072 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15076 result_ok: o.result_ok,
15080 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15081 fn clone(&self) -> Self {
15082 if self.result_ok {
15083 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15084 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15087 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15088 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15094 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15095 /// but with all dynamically-allocated buffers duplicated in new buffers.
15096 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15098 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15099 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15100 /// A pointer to the contents in the success state.
15101 /// Reading from this pointer when `result_ok` is not set is undefined.
15102 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15103 /// A pointer to the contents in the error state.
15104 /// Reading from this pointer when `result_ok` is set is undefined.
15105 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15108 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15109 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15110 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15111 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15112 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15113 /// `err` or `result` depending on the state of `result_ok`.
15114 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15115 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15116 pub result_ok: bool,
15119 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15120 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15121 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15122 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15123 result: Box::into_raw(Box::new(o)),
15129 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15130 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15131 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15132 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15133 err: Box::into_raw(Box::new(e)),
15138 /// Checks if the given object is currently in the success state
15140 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15144 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15145 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15146 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15147 fn drop(&mut self) {
15148 if self.result_ok {
15149 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15150 let _ = unsafe { Box::from_raw(self.contents.result) };
15153 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15154 let _ = unsafe { Box::from_raw(self.contents.err) };
15159 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15160 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15161 let contents = if o.result_ok {
15162 let result = unsafe { o.contents.result };
15163 unsafe { o.contents.result = core::ptr::null_mut() };
15164 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15166 let err = unsafe { o.contents.err };
15167 unsafe { o.contents.err = core::ptr::null_mut(); }
15168 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15172 result_ok: o.result_ok,
15176 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15177 fn clone(&self) -> Self {
15178 if self.result_ok {
15179 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15180 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15183 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15184 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15190 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15191 /// but with all dynamically-allocated buffers duplicated in new buffers.
15192 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
15194 /// The contents of CResult_UpdateFeeDecodeErrorZ
15195 pub union CResult_UpdateFeeDecodeErrorZPtr {
15196 /// A pointer to the contents in the success state.
15197 /// Reading from this pointer when `result_ok` is not set is undefined.
15198 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
15199 /// A pointer to the contents in the error state.
15200 /// Reading from this pointer when `result_ok` is set is undefined.
15201 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15204 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15205 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15207 pub struct CResult_UpdateFeeDecodeErrorZ {
15208 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15209 /// `err` or `result` depending on the state of `result_ok`.
15210 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
15211 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
15212 pub result_ok: bool,
15215 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
15216 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
15217 CResult_UpdateFeeDecodeErrorZ {
15218 contents: CResult_UpdateFeeDecodeErrorZPtr {
15219 result: Box::into_raw(Box::new(o)),
15225 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
15226 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
15227 CResult_UpdateFeeDecodeErrorZ {
15228 contents: CResult_UpdateFeeDecodeErrorZPtr {
15229 err: Box::into_raw(Box::new(e)),
15234 /// Checks if the given object is currently in the success state
15236 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
15240 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
15241 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
15242 impl Drop for CResult_UpdateFeeDecodeErrorZ {
15243 fn drop(&mut self) {
15244 if self.result_ok {
15245 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15246 let _ = unsafe { Box::from_raw(self.contents.result) };
15249 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15250 let _ = unsafe { Box::from_raw(self.contents.err) };
15255 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
15256 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
15257 let contents = if o.result_ok {
15258 let result = unsafe { o.contents.result };
15259 unsafe { o.contents.result = core::ptr::null_mut() };
15260 CResult_UpdateFeeDecodeErrorZPtr { result }
15262 let err = unsafe { o.contents.err };
15263 unsafe { o.contents.err = core::ptr::null_mut(); }
15264 CResult_UpdateFeeDecodeErrorZPtr { err }
15268 result_ok: o.result_ok,
15272 impl Clone for CResult_UpdateFeeDecodeErrorZ {
15273 fn clone(&self) -> Self {
15274 if self.result_ok {
15275 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
15276 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
15279 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
15280 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15286 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
15287 /// but with all dynamically-allocated buffers duplicated in new buffers.
15288 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
15290 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
15291 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15292 /// A pointer to the contents in the success state.
15293 /// Reading from this pointer when `result_ok` is not set is undefined.
15294 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15295 /// A pointer to the contents in the error state.
15296 /// Reading from this pointer when `result_ok` is set is undefined.
15297 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15300 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
15301 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15303 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
15304 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
15305 /// `err` or `result` depending on the state of `result_ok`.
15306 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
15307 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
15308 pub result_ok: bool,
15311 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
15312 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
15313 CResult_UpdateFulfillHTLCDecodeErrorZ {
15314 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15315 result: Box::into_raw(Box::new(o)),
15321 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
15322 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
15323 CResult_UpdateFulfillHTLCDecodeErrorZ {
15324 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15325 err: Box::into_raw(Box::new(e)),
15330 /// Checks if the given object is currently in the success state
15332 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
15336 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
15337 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
15338 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
15339 fn drop(&mut self) {
15340 if self.result_ok {
15341 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15342 let _ = unsafe { Box::from_raw(self.contents.result) };
15345 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15346 let _ = unsafe { Box::from_raw(self.contents.err) };
15351 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
15352 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15353 let contents = if o.result_ok {
15354 let result = unsafe { o.contents.result };
15355 unsafe { o.contents.result = core::ptr::null_mut() };
15356 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
15358 let err = unsafe { o.contents.err };
15359 unsafe { o.contents.err = core::ptr::null_mut(); }
15360 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
15364 result_ok: o.result_ok,
15368 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
15369 fn clone(&self) -> Self {
15370 if self.result_ok {
15371 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15372 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
15375 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15376 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15382 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15383 /// but with all dynamically-allocated buffers duplicated in new buffers.
15384 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
15386 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
15387 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
15388 /// A pointer to the contents in the success state.
15389 /// Reading from this pointer when `result_ok` is not set is undefined.
15390 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15391 /// A pointer to the contents in the error state.
15392 /// Reading from this pointer when `result_ok` is set is undefined.
15393 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15396 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
15397 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15399 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
15400 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
15401 /// `err` or `result` depending on the state of `result_ok`.
15402 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
15403 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
15404 pub result_ok: bool,
15407 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15408 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
15409 CResult_UpdateAddHTLCDecodeErrorZ {
15410 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15411 result: Box::into_raw(Box::new(o)),
15417 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15418 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
15419 CResult_UpdateAddHTLCDecodeErrorZ {
15420 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15421 err: Box::into_raw(Box::new(e)),
15426 /// Checks if the given object is currently in the success state
15428 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
15432 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15433 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
15434 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
15435 fn drop(&mut self) {
15436 if self.result_ok {
15437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15438 let _ = unsafe { Box::from_raw(self.contents.result) };
15441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15442 let _ = unsafe { Box::from_raw(self.contents.err) };
15447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
15448 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15449 let contents = if o.result_ok {
15450 let result = unsafe { o.contents.result };
15451 unsafe { o.contents.result = core::ptr::null_mut() };
15452 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
15454 let err = unsafe { o.contents.err };
15455 unsafe { o.contents.err = core::ptr::null_mut(); }
15456 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
15460 result_ok: o.result_ok,
15464 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
15465 fn clone(&self) -> Self {
15466 if self.result_ok {
15467 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15468 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
15471 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15472 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15478 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15479 /// but with all dynamically-allocated buffers duplicated in new buffers.
15480 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
15482 /// The contents of CResult_OnionMessageDecodeErrorZ
15483 pub union CResult_OnionMessageDecodeErrorZPtr {
15484 /// A pointer to the contents in the success state.
15485 /// Reading from this pointer when `result_ok` is not set is undefined.
15486 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
15487 /// A pointer to the contents in the error state.
15488 /// Reading from this pointer when `result_ok` is set is undefined.
15489 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15492 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
15493 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15495 pub struct CResult_OnionMessageDecodeErrorZ {
15496 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
15497 /// `err` or `result` depending on the state of `result_ok`.
15498 pub contents: CResult_OnionMessageDecodeErrorZPtr,
15499 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
15500 pub result_ok: bool,
15503 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
15504 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
15505 CResult_OnionMessageDecodeErrorZ {
15506 contents: CResult_OnionMessageDecodeErrorZPtr {
15507 result: Box::into_raw(Box::new(o)),
15513 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
15514 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
15515 CResult_OnionMessageDecodeErrorZ {
15516 contents: CResult_OnionMessageDecodeErrorZPtr {
15517 err: Box::into_raw(Box::new(e)),
15522 /// Checks if the given object is currently in the success state
15524 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
15528 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
15529 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
15530 impl Drop for CResult_OnionMessageDecodeErrorZ {
15531 fn drop(&mut self) {
15532 if self.result_ok {
15533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15534 let _ = unsafe { Box::from_raw(self.contents.result) };
15537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15538 let _ = unsafe { Box::from_raw(self.contents.err) };
15543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
15544 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15545 let contents = if o.result_ok {
15546 let result = unsafe { o.contents.result };
15547 unsafe { o.contents.result = core::ptr::null_mut() };
15548 CResult_OnionMessageDecodeErrorZPtr { result }
15550 let err = unsafe { o.contents.err };
15551 unsafe { o.contents.err = core::ptr::null_mut(); }
15552 CResult_OnionMessageDecodeErrorZPtr { err }
15556 result_ok: o.result_ok,
15560 impl Clone for CResult_OnionMessageDecodeErrorZ {
15561 fn clone(&self) -> Self {
15562 if self.result_ok {
15563 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
15564 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
15567 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
15568 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15574 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
15575 /// but with all dynamically-allocated buffers duplicated in new buffers.
15576 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
15578 /// The contents of CResult_PingDecodeErrorZ
15579 pub union CResult_PingDecodeErrorZPtr {
15580 /// A pointer to the contents in the success state.
15581 /// Reading from this pointer when `result_ok` is not set is undefined.
15582 pub result: *mut crate::lightning::ln::msgs::Ping,
15583 /// A pointer to the contents in the error state.
15584 /// Reading from this pointer when `result_ok` is set is undefined.
15585 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15588 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
15589 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
15590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15591 pub struct CResult_PingDecodeErrorZ {
15592 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
15593 /// `err` or `result` depending on the state of `result_ok`.
15594 pub contents: CResult_PingDecodeErrorZPtr,
15595 /// Whether this CResult_PingDecodeErrorZ represents a success state.
15596 pub result_ok: bool,
15599 /// Creates a new CResult_PingDecodeErrorZ in the success state.
15600 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
15601 CResult_PingDecodeErrorZ {
15602 contents: CResult_PingDecodeErrorZPtr {
15603 result: Box::into_raw(Box::new(o)),
15609 /// Creates a new CResult_PingDecodeErrorZ in the error state.
15610 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
15611 CResult_PingDecodeErrorZ {
15612 contents: CResult_PingDecodeErrorZPtr {
15613 err: Box::into_raw(Box::new(e)),
15618 /// Checks if the given object is currently in the success state
15620 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
15624 /// Frees any resources used by the CResult_PingDecodeErrorZ.
15625 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
15626 impl Drop for CResult_PingDecodeErrorZ {
15627 fn drop(&mut self) {
15628 if self.result_ok {
15629 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15630 let _ = unsafe { Box::from_raw(self.contents.result) };
15633 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15634 let _ = unsafe { Box::from_raw(self.contents.err) };
15639 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
15640 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
15641 let contents = if o.result_ok {
15642 let result = unsafe { o.contents.result };
15643 unsafe { o.contents.result = core::ptr::null_mut() };
15644 CResult_PingDecodeErrorZPtr { result }
15646 let err = unsafe { o.contents.err };
15647 unsafe { o.contents.err = core::ptr::null_mut(); }
15648 CResult_PingDecodeErrorZPtr { err }
15652 result_ok: o.result_ok,
15656 impl Clone for CResult_PingDecodeErrorZ {
15657 fn clone(&self) -> Self {
15658 if self.result_ok {
15659 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
15660 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
15663 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
15664 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15670 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15671 /// but with all dynamically-allocated buffers duplicated in new buffers.
15672 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
15674 /// The contents of CResult_PongDecodeErrorZ
15675 pub union CResult_PongDecodeErrorZPtr {
15676 /// A pointer to the contents in the success state.
15677 /// Reading from this pointer when `result_ok` is not set is undefined.
15678 pub result: *mut crate::lightning::ln::msgs::Pong,
15679 /// A pointer to the contents in the error state.
15680 /// Reading from this pointer when `result_ok` is set is undefined.
15681 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15684 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15685 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15687 pub struct CResult_PongDecodeErrorZ {
15688 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
15689 /// `err` or `result` depending on the state of `result_ok`.
15690 pub contents: CResult_PongDecodeErrorZPtr,
15691 /// Whether this CResult_PongDecodeErrorZ represents a success state.
15692 pub result_ok: bool,
15695 /// Creates a new CResult_PongDecodeErrorZ in the success state.
15696 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
15697 CResult_PongDecodeErrorZ {
15698 contents: CResult_PongDecodeErrorZPtr {
15699 result: Box::into_raw(Box::new(o)),
15705 /// Creates a new CResult_PongDecodeErrorZ in the error state.
15706 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
15707 CResult_PongDecodeErrorZ {
15708 contents: CResult_PongDecodeErrorZPtr {
15709 err: Box::into_raw(Box::new(e)),
15714 /// Checks if the given object is currently in the success state
15716 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
15720 /// Frees any resources used by the CResult_PongDecodeErrorZ.
15721 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
15722 impl Drop for CResult_PongDecodeErrorZ {
15723 fn drop(&mut self) {
15724 if self.result_ok {
15725 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15726 let _ = unsafe { Box::from_raw(self.contents.result) };
15729 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15730 let _ = unsafe { Box::from_raw(self.contents.err) };
15735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
15736 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
15737 let contents = if o.result_ok {
15738 let result = unsafe { o.contents.result };
15739 unsafe { o.contents.result = core::ptr::null_mut() };
15740 CResult_PongDecodeErrorZPtr { result }
15742 let err = unsafe { o.contents.err };
15743 unsafe { o.contents.err = core::ptr::null_mut(); }
15744 CResult_PongDecodeErrorZPtr { err }
15748 result_ok: o.result_ok,
15752 impl Clone for CResult_PongDecodeErrorZ {
15753 fn clone(&self) -> Self {
15754 if self.result_ok {
15755 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15756 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15759 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15760 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15766 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15767 /// but with all dynamically-allocated buffers duplicated in new buffers.
15768 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15770 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15771 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15772 /// A pointer to the contents in the success state.
15773 /// Reading from this pointer when `result_ok` is not set is undefined.
15774 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15775 /// A pointer to the contents in the error state.
15776 /// Reading from this pointer when `result_ok` is set is undefined.
15777 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15780 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15781 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15783 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15784 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15785 /// `err` or `result` depending on the state of `result_ok`.
15786 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15787 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15788 pub result_ok: bool,
15791 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15792 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15793 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15794 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15795 result: Box::into_raw(Box::new(o)),
15801 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15802 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15803 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15804 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15805 err: Box::into_raw(Box::new(e)),
15810 /// Checks if the given object is currently in the success state
15812 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15816 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15817 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15818 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15819 fn drop(&mut self) {
15820 if self.result_ok {
15821 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15822 let _ = unsafe { Box::from_raw(self.contents.result) };
15825 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15826 let _ = unsafe { Box::from_raw(self.contents.err) };
15831 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15832 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15833 let contents = if o.result_ok {
15834 let result = unsafe { o.contents.result };
15835 unsafe { o.contents.result = core::ptr::null_mut() };
15836 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15838 let err = unsafe { o.contents.err };
15839 unsafe { o.contents.err = core::ptr::null_mut(); }
15840 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15844 result_ok: o.result_ok,
15848 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15849 fn clone(&self) -> Self {
15850 if self.result_ok {
15851 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15852 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15855 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15856 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15862 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15863 /// but with all dynamically-allocated buffers duplicated in new buffers.
15864 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15866 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15867 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15868 /// A pointer to the contents in the success state.
15869 /// Reading from this pointer when `result_ok` is not set is undefined.
15870 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15871 /// A pointer to the contents in the error state.
15872 /// Reading from this pointer when `result_ok` is set is undefined.
15873 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15876 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15877 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15879 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15880 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15881 /// `err` or `result` depending on the state of `result_ok`.
15882 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15883 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15884 pub result_ok: bool,
15887 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15888 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15889 CResult_ChannelAnnouncementDecodeErrorZ {
15890 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15891 result: Box::into_raw(Box::new(o)),
15897 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15898 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15899 CResult_ChannelAnnouncementDecodeErrorZ {
15900 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15901 err: Box::into_raw(Box::new(e)),
15906 /// Checks if the given object is currently in the success state
15908 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15912 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15913 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15914 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15915 fn drop(&mut self) {
15916 if self.result_ok {
15917 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15918 let _ = unsafe { Box::from_raw(self.contents.result) };
15921 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15922 let _ = unsafe { Box::from_raw(self.contents.err) };
15927 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15928 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15929 let contents = if o.result_ok {
15930 let result = unsafe { o.contents.result };
15931 unsafe { o.contents.result = core::ptr::null_mut() };
15932 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15934 let err = unsafe { o.contents.err };
15935 unsafe { o.contents.err = core::ptr::null_mut(); }
15936 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15940 result_ok: o.result_ok,
15944 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15945 fn clone(&self) -> Self {
15946 if self.result_ok {
15947 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15948 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15951 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15952 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15958 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15959 /// but with all dynamically-allocated buffers duplicated in new buffers.
15960 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15962 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15963 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15964 /// A pointer to the contents in the success state.
15965 /// Reading from this pointer when `result_ok` is not set is undefined.
15966 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15967 /// A pointer to the contents in the error state.
15968 /// Reading from this pointer when `result_ok` is set is undefined.
15969 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15972 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15973 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15975 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15976 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15977 /// `err` or `result` depending on the state of `result_ok`.
15978 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15979 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15980 pub result_ok: bool,
15983 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15984 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15985 CResult_UnsignedChannelUpdateDecodeErrorZ {
15986 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15987 result: Box::into_raw(Box::new(o)),
15993 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15994 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15995 CResult_UnsignedChannelUpdateDecodeErrorZ {
15996 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15997 err: Box::into_raw(Box::new(e)),
16002 /// Checks if the given object is currently in the success state
16004 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16008 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16009 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16010 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16011 fn drop(&mut self) {
16012 if self.result_ok {
16013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16014 let _ = unsafe { Box::from_raw(self.contents.result) };
16017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16018 let _ = unsafe { Box::from_raw(self.contents.err) };
16023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16024 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16025 let contents = if o.result_ok {
16026 let result = unsafe { o.contents.result };
16027 unsafe { o.contents.result = core::ptr::null_mut() };
16028 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16030 let err = unsafe { o.contents.err };
16031 unsafe { o.contents.err = core::ptr::null_mut(); }
16032 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16036 result_ok: o.result_ok,
16040 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16041 fn clone(&self) -> Self {
16042 if self.result_ok {
16043 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16044 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16047 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16048 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16054 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16055 /// but with all dynamically-allocated buffers duplicated in new buffers.
16056 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16058 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16059 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16060 /// A pointer to the contents in the success state.
16061 /// Reading from this pointer when `result_ok` is not set is undefined.
16062 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16063 /// A pointer to the contents in the error state.
16064 /// Reading from this pointer when `result_ok` is set is undefined.
16065 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16068 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16069 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16071 pub struct CResult_ChannelUpdateDecodeErrorZ {
16072 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16073 /// `err` or `result` depending on the state of `result_ok`.
16074 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16075 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16076 pub result_ok: bool,
16079 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16080 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16081 CResult_ChannelUpdateDecodeErrorZ {
16082 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16083 result: Box::into_raw(Box::new(o)),
16089 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16090 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16091 CResult_ChannelUpdateDecodeErrorZ {
16092 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16093 err: Box::into_raw(Box::new(e)),
16098 /// Checks if the given object is currently in the success state
16100 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16104 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16105 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16106 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16107 fn drop(&mut self) {
16108 if self.result_ok {
16109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16110 let _ = unsafe { Box::from_raw(self.contents.result) };
16113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16114 let _ = unsafe { Box::from_raw(self.contents.err) };
16119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16121 let contents = if o.result_ok {
16122 let result = unsafe { o.contents.result };
16123 unsafe { o.contents.result = core::ptr::null_mut() };
16124 CResult_ChannelUpdateDecodeErrorZPtr { result }
16126 let err = unsafe { o.contents.err };
16127 unsafe { o.contents.err = core::ptr::null_mut(); }
16128 CResult_ChannelUpdateDecodeErrorZPtr { err }
16132 result_ok: o.result_ok,
16136 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16137 fn clone(&self) -> Self {
16138 if self.result_ok {
16139 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16140 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16143 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16144 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16150 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16151 /// but with all dynamically-allocated buffers duplicated in new buffers.
16152 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16154 /// The contents of CResult_ErrorMessageDecodeErrorZ
16155 pub union CResult_ErrorMessageDecodeErrorZPtr {
16156 /// A pointer to the contents in the success state.
16157 /// Reading from this pointer when `result_ok` is not set is undefined.
16158 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16159 /// A pointer to the contents in the error state.
16160 /// Reading from this pointer when `result_ok` is set is undefined.
16161 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16164 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16165 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16167 pub struct CResult_ErrorMessageDecodeErrorZ {
16168 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16169 /// `err` or `result` depending on the state of `result_ok`.
16170 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16171 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16172 pub result_ok: bool,
16175 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16176 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16177 CResult_ErrorMessageDecodeErrorZ {
16178 contents: CResult_ErrorMessageDecodeErrorZPtr {
16179 result: Box::into_raw(Box::new(o)),
16185 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16186 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16187 CResult_ErrorMessageDecodeErrorZ {
16188 contents: CResult_ErrorMessageDecodeErrorZPtr {
16189 err: Box::into_raw(Box::new(e)),
16194 /// Checks if the given object is currently in the success state
16196 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
16200 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16201 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
16202 impl Drop for CResult_ErrorMessageDecodeErrorZ {
16203 fn drop(&mut self) {
16204 if self.result_ok {
16205 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16206 let _ = unsafe { Box::from_raw(self.contents.result) };
16209 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16210 let _ = unsafe { Box::from_raw(self.contents.err) };
16215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
16216 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16217 let contents = if o.result_ok {
16218 let result = unsafe { o.contents.result };
16219 unsafe { o.contents.result = core::ptr::null_mut() };
16220 CResult_ErrorMessageDecodeErrorZPtr { result }
16222 let err = unsafe { o.contents.err };
16223 unsafe { o.contents.err = core::ptr::null_mut(); }
16224 CResult_ErrorMessageDecodeErrorZPtr { err }
16228 result_ok: o.result_ok,
16232 impl Clone for CResult_ErrorMessageDecodeErrorZ {
16233 fn clone(&self) -> Self {
16234 if self.result_ok {
16235 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
16236 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
16239 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
16240 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16246 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16247 /// but with all dynamically-allocated buffers duplicated in new buffers.
16248 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
16250 /// The contents of CResult_WarningMessageDecodeErrorZ
16251 pub union CResult_WarningMessageDecodeErrorZPtr {
16252 /// A pointer to the contents in the success state.
16253 /// Reading from this pointer when `result_ok` is not set is undefined.
16254 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
16255 /// A pointer to the contents in the error state.
16256 /// Reading from this pointer when `result_ok` is set is undefined.
16257 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16260 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
16261 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16263 pub struct CResult_WarningMessageDecodeErrorZ {
16264 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
16265 /// `err` or `result` depending on the state of `result_ok`.
16266 pub contents: CResult_WarningMessageDecodeErrorZPtr,
16267 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
16268 pub result_ok: bool,
16271 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16272 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
16273 CResult_WarningMessageDecodeErrorZ {
16274 contents: CResult_WarningMessageDecodeErrorZPtr {
16275 result: Box::into_raw(Box::new(o)),
16281 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16282 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
16283 CResult_WarningMessageDecodeErrorZ {
16284 contents: CResult_WarningMessageDecodeErrorZPtr {
16285 err: Box::into_raw(Box::new(e)),
16290 /// Checks if the given object is currently in the success state
16292 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
16296 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16297 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
16298 impl Drop for CResult_WarningMessageDecodeErrorZ {
16299 fn drop(&mut self) {
16300 if self.result_ok {
16301 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16302 let _ = unsafe { Box::from_raw(self.contents.result) };
16305 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16306 let _ = unsafe { Box::from_raw(self.contents.err) };
16311 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
16312 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16313 let contents = if o.result_ok {
16314 let result = unsafe { o.contents.result };
16315 unsafe { o.contents.result = core::ptr::null_mut() };
16316 CResult_WarningMessageDecodeErrorZPtr { result }
16318 let err = unsafe { o.contents.err };
16319 unsafe { o.contents.err = core::ptr::null_mut(); }
16320 CResult_WarningMessageDecodeErrorZPtr { err }
16324 result_ok: o.result_ok,
16328 impl Clone for CResult_WarningMessageDecodeErrorZ {
16329 fn clone(&self) -> Self {
16330 if self.result_ok {
16331 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
16332 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
16335 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
16336 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16342 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16343 /// but with all dynamically-allocated buffers duplicated in new buffers.
16344 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
16346 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
16347 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16348 /// A pointer to the contents in the success state.
16349 /// Reading from this pointer when `result_ok` is not set is undefined.
16350 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
16351 /// A pointer to the contents in the error state.
16352 /// Reading from this pointer when `result_ok` is set is undefined.
16353 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16356 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16357 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16359 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16360 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
16361 /// `err` or `result` depending on the state of `result_ok`.
16362 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
16363 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
16364 pub result_ok: bool,
16367 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16368 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16369 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16370 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16371 result: Box::into_raw(Box::new(o)),
16377 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16378 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16379 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16380 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16381 err: Box::into_raw(Box::new(e)),
16386 /// Checks if the given object is currently in the success state
16388 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
16392 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16393 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
16394 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16395 fn drop(&mut self) {
16396 if self.result_ok {
16397 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16398 let _ = unsafe { Box::from_raw(self.contents.result) };
16401 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16402 let _ = unsafe { Box::from_raw(self.contents.err) };
16407 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16408 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16409 let contents = if o.result_ok {
16410 let result = unsafe { o.contents.result };
16411 unsafe { o.contents.result = core::ptr::null_mut() };
16412 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
16414 let err = unsafe { o.contents.err };
16415 unsafe { o.contents.err = core::ptr::null_mut(); }
16416 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
16420 result_ok: o.result_ok,
16424 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16425 fn clone(&self) -> Self {
16426 if self.result_ok {
16427 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16428 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16431 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16432 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16438 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16439 /// but with all dynamically-allocated buffers duplicated in new buffers.
16440 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16442 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
16443 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
16444 /// A pointer to the contents in the success state.
16445 /// Reading from this pointer when `result_ok` is not set is undefined.
16446 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
16447 /// A pointer to the contents in the error state.
16448 /// Reading from this pointer when `result_ok` is set is undefined.
16449 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16452 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16453 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16455 pub struct CResult_NodeAnnouncementDecodeErrorZ {
16456 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
16457 /// `err` or `result` depending on the state of `result_ok`.
16458 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
16459 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
16460 pub result_ok: bool,
16463 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16464 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
16465 CResult_NodeAnnouncementDecodeErrorZ {
16466 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16467 result: Box::into_raw(Box::new(o)),
16473 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16474 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
16475 CResult_NodeAnnouncementDecodeErrorZ {
16476 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16477 err: Box::into_raw(Box::new(e)),
16482 /// Checks if the given object is currently in the success state
16484 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
16488 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16489 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
16490 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
16491 fn drop(&mut self) {
16492 if self.result_ok {
16493 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16494 let _ = unsafe { Box::from_raw(self.contents.result) };
16497 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16498 let _ = unsafe { Box::from_raw(self.contents.err) };
16503 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
16504 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16505 let contents = if o.result_ok {
16506 let result = unsafe { o.contents.result };
16507 unsafe { o.contents.result = core::ptr::null_mut() };
16508 CResult_NodeAnnouncementDecodeErrorZPtr { result }
16510 let err = unsafe { o.contents.err };
16511 unsafe { o.contents.err = core::ptr::null_mut(); }
16512 CResult_NodeAnnouncementDecodeErrorZPtr { err }
16516 result_ok: o.result_ok,
16520 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
16521 fn clone(&self) -> Self {
16522 if self.result_ok {
16523 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16524 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16527 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16528 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16534 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16535 /// but with all dynamically-allocated buffers duplicated in new buffers.
16536 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16538 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
16539 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
16540 /// A pointer to the contents in the success state.
16541 /// Reading from this pointer when `result_ok` is not set is undefined.
16542 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
16543 /// A pointer to the contents in the error state.
16544 /// Reading from this pointer when `result_ok` is set is undefined.
16545 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16548 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
16549 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
16550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16551 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
16552 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
16553 /// `err` or `result` depending on the state of `result_ok`.
16554 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
16555 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
16556 pub result_ok: bool,
16559 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16560 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
16561 CResult_QueryShortChannelIdsDecodeErrorZ {
16562 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16563 result: Box::into_raw(Box::new(o)),
16569 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16570 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
16571 CResult_QueryShortChannelIdsDecodeErrorZ {
16572 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16573 err: Box::into_raw(Box::new(e)),
16578 /// Checks if the given object is currently in the success state
16580 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
16584 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16585 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
16586 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
16587 fn drop(&mut self) {
16588 if self.result_ok {
16589 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16590 let _ = unsafe { Box::from_raw(self.contents.result) };
16593 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16594 let _ = unsafe { Box::from_raw(self.contents.err) };
16599 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
16600 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
16601 let contents = if o.result_ok {
16602 let result = unsafe { o.contents.result };
16603 unsafe { o.contents.result = core::ptr::null_mut() };
16604 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
16606 let err = unsafe { o.contents.err };
16607 unsafe { o.contents.err = core::ptr::null_mut(); }
16608 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
16612 result_ok: o.result_ok,
16616 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
16617 fn clone(&self) -> Self {
16618 if self.result_ok {
16619 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16620 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
16623 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16624 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16630 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16631 /// but with all dynamically-allocated buffers duplicated in new buffers.
16632 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
16634 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16635 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16636 /// A pointer to the contents in the success state.
16637 /// Reading from this pointer when `result_ok` is not set is undefined.
16638 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
16639 /// A pointer to the contents in the error state.
16640 /// Reading from this pointer when `result_ok` is set is undefined.
16641 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16644 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16645 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16647 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16648 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16649 /// `err` or `result` depending on the state of `result_ok`.
16650 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
16651 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16652 pub result_ok: bool,
16655 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16656 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16657 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16658 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16659 result: Box::into_raw(Box::new(o)),
16665 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16666 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16667 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16668 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16669 err: Box::into_raw(Box::new(e)),
16674 /// Checks if the given object is currently in the success state
16676 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
16680 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16681 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
16682 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16683 fn drop(&mut self) {
16684 if self.result_ok {
16685 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16686 let _ = unsafe { Box::from_raw(self.contents.result) };
16689 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16690 let _ = unsafe { Box::from_raw(self.contents.err) };
16695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16696 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
16697 let contents = if o.result_ok {
16698 let result = unsafe { o.contents.result };
16699 unsafe { o.contents.result = core::ptr::null_mut() };
16700 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
16702 let err = unsafe { o.contents.err };
16703 unsafe { o.contents.err = core::ptr::null_mut(); }
16704 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
16708 result_ok: o.result_ok,
16712 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16713 fn clone(&self) -> Self {
16714 if self.result_ok {
16715 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16716 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
16719 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16720 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16726 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16727 /// but with all dynamically-allocated buffers duplicated in new buffers.
16728 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
16730 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
16731 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
16732 /// A pointer to the contents in the success state.
16733 /// Reading from this pointer when `result_ok` is not set is undefined.
16734 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
16735 /// A pointer to the contents in the error state.
16736 /// Reading from this pointer when `result_ok` is set is undefined.
16737 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16740 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16741 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16743 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16744 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16745 /// `err` or `result` depending on the state of `result_ok`.
16746 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16747 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16748 pub result_ok: bool,
16751 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16752 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16753 CResult_QueryChannelRangeDecodeErrorZ {
16754 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16755 result: Box::into_raw(Box::new(o)),
16761 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16762 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16763 CResult_QueryChannelRangeDecodeErrorZ {
16764 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16765 err: Box::into_raw(Box::new(e)),
16770 /// Checks if the given object is currently in the success state
16772 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16776 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16777 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16778 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16779 fn drop(&mut self) {
16780 if self.result_ok {
16781 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16782 let _ = unsafe { Box::from_raw(self.contents.result) };
16785 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16786 let _ = unsafe { Box::from_raw(self.contents.err) };
16791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16792 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16793 let contents = if o.result_ok {
16794 let result = unsafe { o.contents.result };
16795 unsafe { o.contents.result = core::ptr::null_mut() };
16796 CResult_QueryChannelRangeDecodeErrorZPtr { result }
16798 let err = unsafe { o.contents.err };
16799 unsafe { o.contents.err = core::ptr::null_mut(); }
16800 CResult_QueryChannelRangeDecodeErrorZPtr { err }
16804 result_ok: o.result_ok,
16808 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16809 fn clone(&self) -> Self {
16810 if self.result_ok {
16811 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16812 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16815 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16816 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16822 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16823 /// but with all dynamically-allocated buffers duplicated in new buffers.
16824 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16826 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16827 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16828 /// A pointer to the contents in the success state.
16829 /// Reading from this pointer when `result_ok` is not set is undefined.
16830 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16831 /// A pointer to the contents in the error state.
16832 /// Reading from this pointer when `result_ok` is set is undefined.
16833 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16836 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16837 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16839 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16840 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16841 /// `err` or `result` depending on the state of `result_ok`.
16842 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16843 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16844 pub result_ok: bool,
16847 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16848 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16849 CResult_ReplyChannelRangeDecodeErrorZ {
16850 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16851 result: Box::into_raw(Box::new(o)),
16857 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16858 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16859 CResult_ReplyChannelRangeDecodeErrorZ {
16860 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16861 err: Box::into_raw(Box::new(e)),
16866 /// Checks if the given object is currently in the success state
16868 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16872 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16873 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16874 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16875 fn drop(&mut self) {
16876 if self.result_ok {
16877 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16878 let _ = unsafe { Box::from_raw(self.contents.result) };
16881 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16882 let _ = unsafe { Box::from_raw(self.contents.err) };
16887 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16888 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16889 let contents = if o.result_ok {
16890 let result = unsafe { o.contents.result };
16891 unsafe { o.contents.result = core::ptr::null_mut() };
16892 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16894 let err = unsafe { o.contents.err };
16895 unsafe { o.contents.err = core::ptr::null_mut(); }
16896 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16900 result_ok: o.result_ok,
16904 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16905 fn clone(&self) -> Self {
16906 if self.result_ok {
16907 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16908 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16911 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16912 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16918 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16919 /// but with all dynamically-allocated buffers duplicated in new buffers.
16920 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16922 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16923 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16924 /// A pointer to the contents in the success state.
16925 /// Reading from this pointer when `result_ok` is not set is undefined.
16926 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16927 /// A pointer to the contents in the error state.
16928 /// Reading from this pointer when `result_ok` is set is undefined.
16929 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16932 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16933 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16934 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16935 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16936 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16937 /// `err` or `result` depending on the state of `result_ok`.
16938 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16939 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16940 pub result_ok: bool,
16943 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16944 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16945 CResult_GossipTimestampFilterDecodeErrorZ {
16946 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16947 result: Box::into_raw(Box::new(o)),
16953 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16954 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16955 CResult_GossipTimestampFilterDecodeErrorZ {
16956 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16957 err: Box::into_raw(Box::new(e)),
16962 /// Checks if the given object is currently in the success state
16964 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16968 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16969 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16970 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16971 fn drop(&mut self) {
16972 if self.result_ok {
16973 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16974 let _ = unsafe { Box::from_raw(self.contents.result) };
16977 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16978 let _ = unsafe { Box::from_raw(self.contents.err) };
16983 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16984 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16985 let contents = if o.result_ok {
16986 let result = unsafe { o.contents.result };
16987 unsafe { o.contents.result = core::ptr::null_mut() };
16988 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16990 let err = unsafe { o.contents.err };
16991 unsafe { o.contents.err = core::ptr::null_mut(); }
16992 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16996 result_ok: o.result_ok,
17000 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17001 fn clone(&self) -> Self {
17002 if self.result_ok {
17003 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17004 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17007 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17008 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17014 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17015 /// but with all dynamically-allocated buffers duplicated in new buffers.
17016 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17018 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17019 /// This corresponds to std::vector in C++
17020 pub struct CVec_PhantomRouteHintsZ {
17021 /// The elements in the array.
17022 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17023 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17024 /// The number of elements pointed to by `data`.
17027 impl CVec_PhantomRouteHintsZ {
17028 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17029 if self.datalen == 0 { return Vec::new(); }
17030 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17031 self.data = core::ptr::null_mut();
17035 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17036 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17039 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17040 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17041 let datalen = v.len();
17042 let data = Box::into_raw(v.into_boxed_slice());
17043 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17047 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17048 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17049 impl Drop for CVec_PhantomRouteHintsZ {
17050 fn drop(&mut self) {
17051 if self.datalen == 0 { return; }
17052 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17055 impl Clone for CVec_PhantomRouteHintsZ {
17056 fn clone(&self) -> Self {
17057 let mut res = Vec::new();
17058 if self.datalen == 0 { return Self::from(res); }
17059 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17064 /// The contents of CResult_InvoiceSignOrCreationErrorZ
17065 pub union CResult_InvoiceSignOrCreationErrorZPtr {
17066 /// A pointer to the contents in the success state.
17067 /// Reading from this pointer when `result_ok` is not set is undefined.
17068 pub result: *mut crate::lightning_invoice::Invoice,
17069 /// A pointer to the contents in the error state.
17070 /// Reading from this pointer when `result_ok` is set is undefined.
17071 pub err: *mut crate::lightning_invoice::SignOrCreationError,
17074 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17075 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17077 pub struct CResult_InvoiceSignOrCreationErrorZ {
17078 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
17079 /// `err` or `result` depending on the state of `result_ok`.
17080 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
17081 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
17082 pub result_ok: bool,
17085 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
17086 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
17087 CResult_InvoiceSignOrCreationErrorZ {
17088 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17089 result: Box::into_raw(Box::new(o)),
17095 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
17096 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
17097 CResult_InvoiceSignOrCreationErrorZ {
17098 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17099 err: Box::into_raw(Box::new(e)),
17104 /// Checks if the given object is currently in the success state
17106 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
17110 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
17111 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
17112 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
17113 fn drop(&mut self) {
17114 if self.result_ok {
17115 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17116 let _ = unsafe { Box::from_raw(self.contents.result) };
17119 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17120 let _ = unsafe { Box::from_raw(self.contents.err) };
17125 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
17126 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17127 let contents = if o.result_ok {
17128 let result = unsafe { o.contents.result };
17129 unsafe { o.contents.result = core::ptr::null_mut() };
17130 CResult_InvoiceSignOrCreationErrorZPtr { result }
17132 let err = unsafe { o.contents.err };
17133 unsafe { o.contents.err = core::ptr::null_mut(); }
17134 CResult_InvoiceSignOrCreationErrorZPtr { err }
17138 result_ok: o.result_ok,
17142 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
17143 fn clone(&self) -> Self {
17144 if self.result_ok {
17145 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17146 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
17149 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17150 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17156 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
17157 /// but with all dynamically-allocated buffers duplicated in new buffers.
17158 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17160 /// An enum which can either contain a crate::lightning::chain::Filter or not
17161 pub enum COption_FilterZ {
17162 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
17163 Some(crate::lightning::chain::Filter),
17164 /// When we're in this state, this COption_FilterZ contains nothing
17167 impl COption_FilterZ {
17168 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
17169 if let Self::None = self { false } else { true }
17171 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
17174 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
17175 if let Self::Some(v) = self { v } else { unreachable!() }
17179 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
17180 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
17181 COption_FilterZ::Some(o)
17184 /// Constructs a new COption_FilterZ containing nothing
17185 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
17186 COption_FilterZ::None
17189 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
17190 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
17192 /// The contents of CResult_LockedChannelMonitorNoneZ
17193 pub union CResult_LockedChannelMonitorNoneZPtr {
17194 /// A pointer to the contents in the success state.
17195 /// Reading from this pointer when `result_ok` is not set is undefined.
17196 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
17197 /// Note that this value is always NULL, as there are no contents in the Err variant
17198 pub err: *mut core::ffi::c_void,
17201 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
17202 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
17203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17204 pub struct CResult_LockedChannelMonitorNoneZ {
17205 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
17206 /// `err` or `result` depending on the state of `result_ok`.
17207 pub contents: CResult_LockedChannelMonitorNoneZPtr,
17208 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
17209 pub result_ok: bool,
17212 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
17213 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
17214 CResult_LockedChannelMonitorNoneZ {
17215 contents: CResult_LockedChannelMonitorNoneZPtr {
17216 result: Box::into_raw(Box::new(o)),
17222 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
17223 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
17224 CResult_LockedChannelMonitorNoneZ {
17225 contents: CResult_LockedChannelMonitorNoneZPtr {
17226 err: core::ptr::null_mut(),
17231 /// Checks if the given object is currently in the success state
17233 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
17237 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
17238 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
17239 impl Drop for CResult_LockedChannelMonitorNoneZ {
17240 fn drop(&mut self) {
17241 if self.result_ok {
17242 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17243 let _ = unsafe { Box::from_raw(self.contents.result) };
17249 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
17250 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
17251 let contents = if o.result_ok {
17252 let result = unsafe { o.contents.result };
17253 unsafe { o.contents.result = core::ptr::null_mut() };
17254 CResult_LockedChannelMonitorNoneZPtr { result }
17256 let _ = unsafe { Box::from_raw(o.contents.err) };
17257 o.contents.err = core::ptr::null_mut();
17258 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
17262 result_ok: o.result_ok,
17267 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
17268 /// This corresponds to std::vector in C++
17269 pub struct CVec_OutPointZ {
17270 /// The elements in the array.
17271 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17272 pub data: *mut crate::lightning::chain::transaction::OutPoint,
17273 /// The number of elements pointed to by `data`.
17276 impl CVec_OutPointZ {
17277 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
17278 if self.datalen == 0 { return Vec::new(); }
17279 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17280 self.data = core::ptr::null_mut();
17284 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
17285 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17288 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
17289 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
17290 let datalen = v.len();
17291 let data = Box::into_raw(v.into_boxed_slice());
17292 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17296 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17297 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
17298 impl Drop for CVec_OutPointZ {
17299 fn drop(&mut self) {
17300 if self.datalen == 0 { return; }
17301 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17304 impl Clone for CVec_OutPointZ {
17305 fn clone(&self) -> Self {
17306 let mut res = Vec::new();
17307 if self.datalen == 0 { return Self::from(res); }
17308 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17313 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
17314 /// This corresponds to std::vector in C++
17315 pub struct CVec_MonitorUpdateIdZ {
17316 /// The elements in the array.
17317 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17318 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
17319 /// The number of elements pointed to by `data`.
17322 impl CVec_MonitorUpdateIdZ {
17323 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
17324 if self.datalen == 0 { return Vec::new(); }
17325 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17326 self.data = core::ptr::null_mut();
17330 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
17331 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17334 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
17335 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
17336 let datalen = v.len();
17337 let data = Box::into_raw(v.into_boxed_slice());
17338 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17342 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17343 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
17344 impl Drop for CVec_MonitorUpdateIdZ {
17345 fn drop(&mut self) {
17346 if self.datalen == 0 { return; }
17347 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17350 impl Clone for CVec_MonitorUpdateIdZ {
17351 fn clone(&self) -> Self {
17352 let mut res = Vec::new();
17353 if self.datalen == 0 { return Self::from(res); }
17354 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17359 /// A tuple of 2 elements. See the individual fields for the types contained.
17360 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17361 /// The element at position 0
17362 pub a: crate::lightning::chain::transaction::OutPoint,
17363 /// The element at position 1
17364 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
17366 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17367 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
17374 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17375 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
17379 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17380 fn clone(&self) -> Self {
17382 a: Clone::clone(&self.a),
17383 b: Clone::clone(&self.b),
17388 /// Creates a new tuple which has the same data as `orig`
17389 /// but with all dynamically-allocated buffers duplicated in new buffers.
17390 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
17391 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
17393 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17394 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
17398 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
17399 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
17401 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
17402 /// This corresponds to std::vector in C++
17403 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17404 /// The elements in the array.
17405 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17406 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
17407 /// The number of elements pointed to by `data`.
17410 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17411 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
17412 if self.datalen == 0 { return Vec::new(); }
17413 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17414 self.data = core::ptr::null_mut();
17418 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
17419 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17422 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17423 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
17424 let datalen = v.len();
17425 let data = Box::into_raw(v.into_boxed_slice());
17426 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17430 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17431 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
17432 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17433 fn drop(&mut self) {
17434 if self.datalen == 0 { return; }
17435 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17438 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17439 fn clone(&self) -> Self {
17440 let mut res = Vec::new();
17441 if self.datalen == 0 { return Self::from(res); }
17442 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });