2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4 /// A pointer to the contents in the success state.
5 /// Reading from this pointer when `result_ok` is not set is undefined.
6 pub result: *mut crate::c_types::SecretKey,
7 /// A pointer to the contents in the error state.
8 /// Reading from this pointer when `result_ok` is set is undefined.
9 pub err: *mut crate::c_types::Secp256k1Error,
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17 /// `err` or `result` depending on the state of `result_ok`.
18 pub contents: CResult_SecretKeyErrorZPtr,
19 /// Whether this CResult_SecretKeyErrorZ represents a success state.
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25 CResult_SecretKeyErrorZ {
26 contents: CResult_SecretKeyErrorZPtr {
27 result: Box::into_raw(Box::new(o)),
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35 CResult_SecretKeyErrorZ {
36 contents: CResult_SecretKeyErrorZPtr {
37 err: Box::into_raw(Box::new(e)),
42 /// Checks if the given object is currently in the success state
44 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
48 /// Frees any resources used by the CResult_SecretKeyErrorZ.
49 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
50 impl Drop for CResult_SecretKeyErrorZ {
53 if unsafe { !(self.contents.result as *mut ()).is_null() } {
54 let _ = unsafe { Box::from_raw(self.contents.result) };
57 if unsafe { !(self.contents.err as *mut ()).is_null() } {
58 let _ = unsafe { Box::from_raw(self.contents.err) };
63 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
64 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
65 let contents = if o.result_ok {
66 let result = unsafe { o.contents.result };
67 unsafe { o.contents.result = std::ptr::null_mut() };
68 CResult_SecretKeyErrorZPtr { result }
70 let err = unsafe { o.contents.err };
71 unsafe { o.contents.err = std::ptr::null_mut(); }
72 CResult_SecretKeyErrorZPtr { err }
76 result_ok: o.result_ok,
81 /// The contents of CResult_PublicKeyErrorZ
82 pub union CResult_PublicKeyErrorZPtr {
83 /// A pointer to the contents in the success state.
84 /// Reading from this pointer when `result_ok` is not set is undefined.
85 pub result: *mut crate::c_types::PublicKey,
86 /// A pointer to the contents in the error state.
87 /// Reading from this pointer when `result_ok` is set is undefined.
88 pub err: *mut crate::c_types::Secp256k1Error,
91 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
92 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
93 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
94 pub struct CResult_PublicKeyErrorZ {
95 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
96 /// `err` or `result` depending on the state of `result_ok`.
97 pub contents: CResult_PublicKeyErrorZPtr,
98 /// Whether this CResult_PublicKeyErrorZ represents a success state.
102 /// Creates a new CResult_PublicKeyErrorZ in the success state.
103 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
104 CResult_PublicKeyErrorZ {
105 contents: CResult_PublicKeyErrorZPtr {
106 result: Box::into_raw(Box::new(o)),
112 /// Creates a new CResult_PublicKeyErrorZ in the error state.
113 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
114 CResult_PublicKeyErrorZ {
115 contents: CResult_PublicKeyErrorZPtr {
116 err: Box::into_raw(Box::new(e)),
121 /// Checks if the given object is currently in the success state
123 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
127 /// Frees any resources used by the CResult_PublicKeyErrorZ.
128 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
129 impl Drop for CResult_PublicKeyErrorZ {
132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
133 let _ = unsafe { Box::from_raw(self.contents.result) };
136 if unsafe { !(self.contents.err as *mut ()).is_null() } {
137 let _ = unsafe { Box::from_raw(self.contents.err) };
142 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
143 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
144 let contents = if o.result_ok {
145 let result = unsafe { o.contents.result };
146 unsafe { o.contents.result = std::ptr::null_mut() };
147 CResult_PublicKeyErrorZPtr { result }
149 let err = unsafe { o.contents.err };
150 unsafe { o.contents.err = std::ptr::null_mut(); }
151 CResult_PublicKeyErrorZPtr { err }
155 result_ok: o.result_ok,
159 impl Clone for CResult_PublicKeyErrorZ {
160 fn clone(&self) -> Self {
162 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
163 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
166 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
167 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
173 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
174 /// but with all dynamically-allocated buffers duplicated in new buffers.
175 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
177 /// The contents of CResult_TxCreationKeysDecodeErrorZ
178 pub union CResult_TxCreationKeysDecodeErrorZPtr {
179 /// A pointer to the contents in the success state.
180 /// Reading from this pointer when `result_ok` is not set is undefined.
181 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
182 /// A pointer to the contents in the error state.
183 /// Reading from this pointer when `result_ok` is set is undefined.
184 pub err: *mut crate::lightning::ln::msgs::DecodeError,
187 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
188 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
190 pub struct CResult_TxCreationKeysDecodeErrorZ {
191 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
192 /// `err` or `result` depending on the state of `result_ok`.
193 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
194 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
200 CResult_TxCreationKeysDecodeErrorZ {
201 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202 result: Box::into_raw(Box::new(o)),
208 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
210 CResult_TxCreationKeysDecodeErrorZ {
211 contents: CResult_TxCreationKeysDecodeErrorZPtr {
212 err: Box::into_raw(Box::new(e)),
217 /// Checks if the given object is currently in the success state
219 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
223 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
224 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
225 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
228 if unsafe { !(self.contents.result as *mut ()).is_null() } {
229 let _ = unsafe { Box::from_raw(self.contents.result) };
232 if unsafe { !(self.contents.err as *mut ()).is_null() } {
233 let _ = unsafe { Box::from_raw(self.contents.err) };
238 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
239 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
240 let contents = if o.result_ok {
241 let result = unsafe { o.contents.result };
242 unsafe { o.contents.result = std::ptr::null_mut() };
243 CResult_TxCreationKeysDecodeErrorZPtr { result }
245 let err = unsafe { o.contents.err };
246 unsafe { o.contents.err = std::ptr::null_mut(); }
247 CResult_TxCreationKeysDecodeErrorZPtr { err }
251 result_ok: o.result_ok,
255 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
256 fn clone(&self) -> Self {
258 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
259 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
262 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
263 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
269 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
270 /// but with all dynamically-allocated buffers duplicated in new buffers.
271 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
273 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
274 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
275 /// A pointer to the contents in the success state.
276 /// Reading from this pointer when `result_ok` is not set is undefined.
277 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
278 /// A pointer to the contents in the error state.
279 /// Reading from this pointer when `result_ok` is set is undefined.
280 pub err: *mut crate::lightning::ln::msgs::DecodeError,
283 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
284 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
286 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
287 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
288 /// `err` or `result` depending on the state of `result_ok`.
289 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
290 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
294 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
295 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
296 CResult_ChannelPublicKeysDecodeErrorZ {
297 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
298 result: Box::into_raw(Box::new(o)),
304 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
305 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
306 CResult_ChannelPublicKeysDecodeErrorZ {
307 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
308 err: Box::into_raw(Box::new(e)),
313 /// Checks if the given object is currently in the success state
315 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
319 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
320 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
321 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
324 if unsafe { !(self.contents.result as *mut ()).is_null() } {
325 let _ = unsafe { Box::from_raw(self.contents.result) };
328 if unsafe { !(self.contents.err as *mut ()).is_null() } {
329 let _ = unsafe { Box::from_raw(self.contents.err) };
334 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
335 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
336 let contents = if o.result_ok {
337 let result = unsafe { o.contents.result };
338 unsafe { o.contents.result = std::ptr::null_mut() };
339 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
341 let err = unsafe { o.contents.err };
342 unsafe { o.contents.err = std::ptr::null_mut(); }
343 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
347 result_ok: o.result_ok,
351 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
352 fn clone(&self) -> Self {
354 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
355 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
358 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
359 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
365 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
366 /// but with all dynamically-allocated buffers duplicated in new buffers.
367 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
369 /// The contents of CResult_TxCreationKeysErrorZ
370 pub union CResult_TxCreationKeysErrorZPtr {
371 /// A pointer to the contents in the success state.
372 /// Reading from this pointer when `result_ok` is not set is undefined.
373 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
374 /// A pointer to the contents in the error state.
375 /// Reading from this pointer when `result_ok` is set is undefined.
376 pub err: *mut crate::c_types::Secp256k1Error,
379 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
380 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
382 pub struct CResult_TxCreationKeysErrorZ {
383 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
384 /// `err` or `result` depending on the state of `result_ok`.
385 pub contents: CResult_TxCreationKeysErrorZPtr,
386 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
390 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
392 CResult_TxCreationKeysErrorZ {
393 contents: CResult_TxCreationKeysErrorZPtr {
394 result: Box::into_raw(Box::new(o)),
400 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
401 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
402 CResult_TxCreationKeysErrorZ {
403 contents: CResult_TxCreationKeysErrorZPtr {
404 err: Box::into_raw(Box::new(e)),
409 /// Checks if the given object is currently in the success state
411 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
415 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
416 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
417 impl Drop for CResult_TxCreationKeysErrorZ {
420 if unsafe { !(self.contents.result as *mut ()).is_null() } {
421 let _ = unsafe { Box::from_raw(self.contents.result) };
424 if unsafe { !(self.contents.err as *mut ()).is_null() } {
425 let _ = unsafe { Box::from_raw(self.contents.err) };
430 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
431 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
432 let contents = if o.result_ok {
433 let result = unsafe { o.contents.result };
434 unsafe { o.contents.result = std::ptr::null_mut() };
435 CResult_TxCreationKeysErrorZPtr { result }
437 let err = unsafe { o.contents.err };
438 unsafe { o.contents.err = std::ptr::null_mut(); }
439 CResult_TxCreationKeysErrorZPtr { err }
443 result_ok: o.result_ok,
447 impl Clone for CResult_TxCreationKeysErrorZ {
448 fn clone(&self) -> Self {
450 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
451 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
454 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
455 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
461 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
462 /// but with all dynamically-allocated buffers duplicated in new buffers.
463 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
466 /// An enum which can either contain a u32 or not
467 pub enum COption_u32Z {
468 /// When we're in this state, this COption_u32Z contains a u32
470 /// When we're in this state, this COption_u32Z contains nothing
474 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
475 if let Self::Some(_) = self { true } else { false }
477 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
480 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
481 if let Self::Some(v) = self { v } else { unreachable!() }
485 /// Constructs a new COption_u32Z containing a u32
486 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
487 COption_u32Z::Some(o)
490 /// Constructs a new COption_u32Z containing nothing
491 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
495 /// Frees any resources associated with the u32, if we are in the Some state
496 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
498 /// Creates a new COption_u32Z which has the same data as `orig`
499 /// but with all dynamically-allocated buffers duplicated in new buffers.
500 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
502 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
503 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
504 /// A pointer to the contents in the success state.
505 /// Reading from this pointer when `result_ok` is not set is undefined.
506 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
507 /// A pointer to the contents in the error state.
508 /// Reading from this pointer when `result_ok` is set is undefined.
509 pub err: *mut crate::lightning::ln::msgs::DecodeError,
512 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
513 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
515 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
516 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
517 /// `err` or `result` depending on the state of `result_ok`.
518 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
519 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
523 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
524 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
525 CResult_HTLCOutputInCommitmentDecodeErrorZ {
526 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
527 result: Box::into_raw(Box::new(o)),
533 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
534 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
535 CResult_HTLCOutputInCommitmentDecodeErrorZ {
536 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
537 err: Box::into_raw(Box::new(e)),
542 /// Checks if the given object is currently in the success state
544 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
548 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
549 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
550 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
553 if unsafe { !(self.contents.result as *mut ()).is_null() } {
554 let _ = unsafe { Box::from_raw(self.contents.result) };
557 if unsafe { !(self.contents.err as *mut ()).is_null() } {
558 let _ = unsafe { Box::from_raw(self.contents.err) };
563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
564 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
565 let contents = if o.result_ok {
566 let result = unsafe { o.contents.result };
567 unsafe { o.contents.result = std::ptr::null_mut() };
568 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
570 let err = unsafe { o.contents.err };
571 unsafe { o.contents.err = std::ptr::null_mut(); }
572 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
576 result_ok: o.result_ok,
580 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
581 fn clone(&self) -> Self {
583 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
584 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
587 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
588 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
594 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
595 /// but with all dynamically-allocated buffers duplicated in new buffers.
596 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
598 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
599 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
600 /// A pointer to the contents in the success state.
601 /// Reading from this pointer when `result_ok` is not set is undefined.
602 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
603 /// A pointer to the contents in the error state.
604 /// Reading from this pointer when `result_ok` is set is undefined.
605 pub err: *mut crate::lightning::ln::msgs::DecodeError,
608 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
609 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
611 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
612 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
613 /// `err` or `result` depending on the state of `result_ok`.
614 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
615 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
619 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
620 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
621 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
622 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
623 result: Box::into_raw(Box::new(o)),
629 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
630 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
631 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
632 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
633 err: Box::into_raw(Box::new(e)),
638 /// Checks if the given object is currently in the success state
640 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
644 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
645 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
646 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
649 if unsafe { !(self.contents.result as *mut ()).is_null() } {
650 let _ = unsafe { Box::from_raw(self.contents.result) };
653 if unsafe { !(self.contents.err as *mut ()).is_null() } {
654 let _ = unsafe { Box::from_raw(self.contents.err) };
659 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
660 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
661 let contents = if o.result_ok {
662 let result = unsafe { o.contents.result };
663 unsafe { o.contents.result = std::ptr::null_mut() };
664 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
666 let err = unsafe { o.contents.err };
667 unsafe { o.contents.err = std::ptr::null_mut(); }
668 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
672 result_ok: o.result_ok,
676 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
677 fn clone(&self) -> Self {
679 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
680 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
683 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
684 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
690 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
691 /// but with all dynamically-allocated buffers duplicated in new buffers.
692 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
694 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
695 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
696 /// A pointer to the contents in the success state.
697 /// Reading from this pointer when `result_ok` is not set is undefined.
698 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
699 /// A pointer to the contents in the error state.
700 /// Reading from this pointer when `result_ok` is set is undefined.
701 pub err: *mut crate::lightning::ln::msgs::DecodeError,
704 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
705 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
707 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
708 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
709 /// `err` or `result` depending on the state of `result_ok`.
710 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
711 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
715 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
716 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
717 CResult_ChannelTransactionParametersDecodeErrorZ {
718 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
719 result: Box::into_raw(Box::new(o)),
725 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
726 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
727 CResult_ChannelTransactionParametersDecodeErrorZ {
728 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
729 err: Box::into_raw(Box::new(e)),
734 /// Checks if the given object is currently in the success state
736 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
740 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
741 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
742 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
745 if unsafe { !(self.contents.result as *mut ()).is_null() } {
746 let _ = unsafe { Box::from_raw(self.contents.result) };
749 if unsafe { !(self.contents.err as *mut ()).is_null() } {
750 let _ = unsafe { Box::from_raw(self.contents.err) };
755 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
756 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
757 let contents = if o.result_ok {
758 let result = unsafe { o.contents.result };
759 unsafe { o.contents.result = std::ptr::null_mut() };
760 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
762 let err = unsafe { o.contents.err };
763 unsafe { o.contents.err = std::ptr::null_mut(); }
764 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
768 result_ok: o.result_ok,
772 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
773 fn clone(&self) -> Self {
775 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
776 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
779 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
780 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
786 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
787 /// but with all dynamically-allocated buffers duplicated in new buffers.
788 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
790 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
791 /// This corresponds to std::vector in C++
792 pub struct CVec_SignatureZ {
793 /// The elements in the array.
794 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
795 pub data: *mut crate::c_types::Signature,
796 /// The number of elements pointed to by `data`.
799 impl CVec_SignatureZ {
800 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
801 if self.datalen == 0 { return Vec::new(); }
802 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
803 self.data = std::ptr::null_mut();
807 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
808 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
811 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
812 fn from(v: Vec<crate::c_types::Signature>) -> Self {
813 let datalen = v.len();
814 let data = Box::into_raw(v.into_boxed_slice());
815 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
819 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
820 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
821 impl Drop for CVec_SignatureZ {
823 if self.datalen == 0 { return; }
824 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
827 impl Clone for CVec_SignatureZ {
828 fn clone(&self) -> Self {
829 let mut res = Vec::new();
830 if self.datalen == 0 { return Self::from(res); }
831 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
836 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
837 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
838 /// A pointer to the contents in the success state.
839 /// Reading from this pointer when `result_ok` is not set is undefined.
840 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
841 /// A pointer to the contents in the error state.
842 /// Reading from this pointer when `result_ok` is set is undefined.
843 pub err: *mut crate::lightning::ln::msgs::DecodeError,
846 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
847 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
848 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
849 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
850 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
851 /// `err` or `result` depending on the state of `result_ok`.
852 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
853 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
857 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
858 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
859 CResult_HolderCommitmentTransactionDecodeErrorZ {
860 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
861 result: Box::into_raw(Box::new(o)),
867 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
868 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
869 CResult_HolderCommitmentTransactionDecodeErrorZ {
870 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
871 err: Box::into_raw(Box::new(e)),
876 /// Checks if the given object is currently in the success state
878 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
882 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
883 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
884 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
887 if unsafe { !(self.contents.result as *mut ()).is_null() } {
888 let _ = unsafe { Box::from_raw(self.contents.result) };
891 if unsafe { !(self.contents.err as *mut ()).is_null() } {
892 let _ = unsafe { Box::from_raw(self.contents.err) };
897 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
898 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
899 let contents = if o.result_ok {
900 let result = unsafe { o.contents.result };
901 unsafe { o.contents.result = std::ptr::null_mut() };
902 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
904 let err = unsafe { o.contents.err };
905 unsafe { o.contents.err = std::ptr::null_mut(); }
906 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
910 result_ok: o.result_ok,
914 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
915 fn clone(&self) -> Self {
917 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
918 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
921 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
922 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
928 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
929 /// but with all dynamically-allocated buffers duplicated in new buffers.
930 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
932 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
933 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
934 /// A pointer to the contents in the success state.
935 /// Reading from this pointer when `result_ok` is not set is undefined.
936 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
937 /// A pointer to the contents in the error state.
938 /// Reading from this pointer when `result_ok` is set is undefined.
939 pub err: *mut crate::lightning::ln::msgs::DecodeError,
942 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
943 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
945 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
946 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
947 /// `err` or `result` depending on the state of `result_ok`.
948 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
949 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
953 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
954 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
955 CResult_BuiltCommitmentTransactionDecodeErrorZ {
956 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
957 result: Box::into_raw(Box::new(o)),
963 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
964 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
965 CResult_BuiltCommitmentTransactionDecodeErrorZ {
966 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
967 err: Box::into_raw(Box::new(e)),
972 /// Checks if the given object is currently in the success state
974 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
978 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
979 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
980 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
983 if unsafe { !(self.contents.result as *mut ()).is_null() } {
984 let _ = unsafe { Box::from_raw(self.contents.result) };
987 if unsafe { !(self.contents.err as *mut ()).is_null() } {
988 let _ = unsafe { Box::from_raw(self.contents.err) };
993 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
994 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
995 let contents = if o.result_ok {
996 let result = unsafe { o.contents.result };
997 unsafe { o.contents.result = std::ptr::null_mut() };
998 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1000 let err = unsafe { o.contents.err };
1001 unsafe { o.contents.err = std::ptr::null_mut(); }
1002 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1006 result_ok: o.result_ok,
1010 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1011 fn clone(&self) -> Self {
1013 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1014 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1017 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1018 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1024 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1025 /// but with all dynamically-allocated buffers duplicated in new buffers.
1026 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1028 /// The contents of CResult_TrustedClosingTransactionNoneZ
1029 pub union CResult_TrustedClosingTransactionNoneZPtr {
1030 /// A pointer to the contents in the success state.
1031 /// Reading from this pointer when `result_ok` is not set is undefined.
1032 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1033 /// Note that this value is always NULL, as there are no contents in the Err variant
1034 pub err: *mut std::ffi::c_void,
1037 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1038 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1039 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1040 pub struct CResult_TrustedClosingTransactionNoneZ {
1041 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1042 /// `err` or `result` depending on the state of `result_ok`.
1043 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1044 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1045 pub result_ok: bool,
1048 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1049 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1050 CResult_TrustedClosingTransactionNoneZ {
1051 contents: CResult_TrustedClosingTransactionNoneZPtr {
1052 result: Box::into_raw(Box::new(o)),
1058 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1059 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1060 CResult_TrustedClosingTransactionNoneZ {
1061 contents: CResult_TrustedClosingTransactionNoneZPtr {
1062 err: std::ptr::null_mut(),
1067 /// Checks if the given object is currently in the success state
1069 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1073 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1074 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1075 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1076 fn drop(&mut self) {
1078 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1079 let _ = unsafe { Box::from_raw(self.contents.result) };
1085 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1086 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1087 let contents = if o.result_ok {
1088 let result = unsafe { o.contents.result };
1089 unsafe { o.contents.result = std::ptr::null_mut() };
1090 CResult_TrustedClosingTransactionNoneZPtr { result }
1092 let _ = unsafe { Box::from_raw(o.contents.err) };
1093 o.contents.err = std::ptr::null_mut();
1094 CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1098 result_ok: o.result_ok,
1103 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1104 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1105 /// A pointer to the contents in the success state.
1106 /// Reading from this pointer when `result_ok` is not set is undefined.
1107 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1108 /// A pointer to the contents in the error state.
1109 /// Reading from this pointer when `result_ok` is set is undefined.
1110 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1113 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1114 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1115 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1116 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1117 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1118 /// `err` or `result` depending on the state of `result_ok`.
1119 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1120 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1121 pub result_ok: bool,
1124 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1125 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1126 CResult_CommitmentTransactionDecodeErrorZ {
1127 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1128 result: Box::into_raw(Box::new(o)),
1134 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1135 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1136 CResult_CommitmentTransactionDecodeErrorZ {
1137 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1138 err: Box::into_raw(Box::new(e)),
1143 /// Checks if the given object is currently in the success state
1145 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1149 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1150 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1151 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1152 fn drop(&mut self) {
1154 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1155 let _ = unsafe { Box::from_raw(self.contents.result) };
1158 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1159 let _ = unsafe { Box::from_raw(self.contents.err) };
1164 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1165 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1166 let contents = if o.result_ok {
1167 let result = unsafe { o.contents.result };
1168 unsafe { o.contents.result = std::ptr::null_mut() };
1169 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1171 let err = unsafe { o.contents.err };
1172 unsafe { o.contents.err = std::ptr::null_mut(); }
1173 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1177 result_ok: o.result_ok,
1181 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1182 fn clone(&self) -> Self {
1184 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1185 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1188 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1189 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1195 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1196 /// but with all dynamically-allocated buffers duplicated in new buffers.
1197 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1199 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1200 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1201 /// A pointer to the contents in the success state.
1202 /// Reading from this pointer when `result_ok` is not set is undefined.
1203 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1204 /// Note that this value is always NULL, as there are no contents in the Err variant
1205 pub err: *mut std::ffi::c_void,
1208 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1209 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1211 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1212 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1213 /// `err` or `result` depending on the state of `result_ok`.
1214 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1215 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1216 pub result_ok: bool,
1219 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1220 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1221 CResult_TrustedCommitmentTransactionNoneZ {
1222 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1223 result: Box::into_raw(Box::new(o)),
1229 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1230 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1231 CResult_TrustedCommitmentTransactionNoneZ {
1232 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1233 err: std::ptr::null_mut(),
1238 /// Checks if the given object is currently in the success state
1240 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1244 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1245 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1246 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1247 fn drop(&mut self) {
1249 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1250 let _ = unsafe { Box::from_raw(self.contents.result) };
1256 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1257 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1258 let contents = if o.result_ok {
1259 let result = unsafe { o.contents.result };
1260 unsafe { o.contents.result = std::ptr::null_mut() };
1261 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1263 let _ = unsafe { Box::from_raw(o.contents.err) };
1264 o.contents.err = std::ptr::null_mut();
1265 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1269 result_ok: o.result_ok,
1274 /// The contents of CResult_CVec_SignatureZNoneZ
1275 pub union CResult_CVec_SignatureZNoneZPtr {
1276 /// A pointer to the contents in the success state.
1277 /// Reading from this pointer when `result_ok` is not set is undefined.
1278 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1279 /// Note that this value is always NULL, as there are no contents in the Err variant
1280 pub err: *mut std::ffi::c_void,
1283 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1284 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1286 pub struct CResult_CVec_SignatureZNoneZ {
1287 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1288 /// `err` or `result` depending on the state of `result_ok`.
1289 pub contents: CResult_CVec_SignatureZNoneZPtr,
1290 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1291 pub result_ok: bool,
1294 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1295 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1296 CResult_CVec_SignatureZNoneZ {
1297 contents: CResult_CVec_SignatureZNoneZPtr {
1298 result: Box::into_raw(Box::new(o)),
1304 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1305 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1306 CResult_CVec_SignatureZNoneZ {
1307 contents: CResult_CVec_SignatureZNoneZPtr {
1308 err: std::ptr::null_mut(),
1313 /// Checks if the given object is currently in the success state
1315 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1319 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1320 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1321 impl Drop for CResult_CVec_SignatureZNoneZ {
1322 fn drop(&mut self) {
1324 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1325 let _ = unsafe { Box::from_raw(self.contents.result) };
1331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1332 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1333 let contents = if o.result_ok {
1334 let result = unsafe { o.contents.result };
1335 unsafe { o.contents.result = std::ptr::null_mut() };
1336 CResult_CVec_SignatureZNoneZPtr { result }
1338 let _ = unsafe { Box::from_raw(o.contents.err) };
1339 o.contents.err = std::ptr::null_mut();
1340 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1344 result_ok: o.result_ok,
1348 impl Clone for CResult_CVec_SignatureZNoneZ {
1349 fn clone(&self) -> Self {
1351 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1352 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1355 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1356 err: std::ptr::null_mut()
1362 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1363 /// but with all dynamically-allocated buffers duplicated in new buffers.
1364 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1366 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1367 pub union CResult_ShutdownScriptDecodeErrorZPtr {
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::script::ShutdownScript,
1371 /// A pointer to the contents in the error state.
1372 /// Reading from this pointer when `result_ok` is set is undefined.
1373 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1376 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1377 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1379 pub struct CResult_ShutdownScriptDecodeErrorZ {
1380 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1381 /// `err` or `result` depending on the state of `result_ok`.
1382 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1383 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1384 pub result_ok: bool,
1387 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1388 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1389 CResult_ShutdownScriptDecodeErrorZ {
1390 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1391 result: Box::into_raw(Box::new(o)),
1397 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1398 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1399 CResult_ShutdownScriptDecodeErrorZ {
1400 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1401 err: Box::into_raw(Box::new(e)),
1406 /// Checks if the given object is currently in the success state
1408 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1412 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1413 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1414 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1415 fn drop(&mut self) {
1417 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1418 let _ = unsafe { Box::from_raw(self.contents.result) };
1421 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1422 let _ = unsafe { Box::from_raw(self.contents.err) };
1427 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1428 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1429 let contents = if o.result_ok {
1430 let result = unsafe { o.contents.result };
1431 unsafe { o.contents.result = std::ptr::null_mut() };
1432 CResult_ShutdownScriptDecodeErrorZPtr { result }
1434 let err = unsafe { o.contents.err };
1435 unsafe { o.contents.err = std::ptr::null_mut(); }
1436 CResult_ShutdownScriptDecodeErrorZPtr { err }
1440 result_ok: o.result_ok,
1444 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1445 fn clone(&self) -> Self {
1447 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1448 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1451 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1452 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1458 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1459 /// but with all dynamically-allocated buffers duplicated in new buffers.
1460 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1462 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1463 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1464 /// A pointer to the contents in the success state.
1465 /// Reading from this pointer when `result_ok` is not set is undefined.
1466 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1467 /// A pointer to the contents in the error state.
1468 /// Reading from this pointer when `result_ok` is set is undefined.
1469 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1472 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1473 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1475 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1476 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1477 /// `err` or `result` depending on the state of `result_ok`.
1478 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1479 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1480 pub result_ok: bool,
1483 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1484 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1485 CResult_ShutdownScriptInvalidShutdownScriptZ {
1486 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1487 result: Box::into_raw(Box::new(o)),
1493 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1494 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1495 CResult_ShutdownScriptInvalidShutdownScriptZ {
1496 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1497 err: Box::into_raw(Box::new(e)),
1502 /// Checks if the given object is currently in the success state
1504 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1508 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1509 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1510 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1511 fn drop(&mut self) {
1513 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1514 let _ = unsafe { Box::from_raw(self.contents.result) };
1517 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1518 let _ = unsafe { Box::from_raw(self.contents.err) };
1523 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1524 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1525 let contents = if o.result_ok {
1526 let result = unsafe { o.contents.result };
1527 unsafe { o.contents.result = std::ptr::null_mut() };
1528 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1530 let err = unsafe { o.contents.err };
1531 unsafe { o.contents.err = std::ptr::null_mut(); }
1532 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1536 result_ok: o.result_ok,
1541 /// The contents of CResult_NoneErrorZ
1542 pub union CResult_NoneErrorZPtr {
1543 /// Note that this value is always NULL, as there are no contents in the OK variant
1544 pub result: *mut std::ffi::c_void,
1545 /// A pointer to the contents in the error state.
1546 /// Reading from this pointer when `result_ok` is set is undefined.
1547 pub err: *mut crate::c_types::IOError,
1550 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1551 /// containing a () on success and a crate::c_types::IOError on failure.
1552 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1553 pub struct CResult_NoneErrorZ {
1554 /// The contents of this CResult_NoneErrorZ, accessible via either
1555 /// `err` or `result` depending on the state of `result_ok`.
1556 pub contents: CResult_NoneErrorZPtr,
1557 /// Whether this CResult_NoneErrorZ represents a success state.
1558 pub result_ok: bool,
1561 /// Creates a new CResult_NoneErrorZ in the success state.
1562 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1563 CResult_NoneErrorZ {
1564 contents: CResult_NoneErrorZPtr {
1565 result: std::ptr::null_mut(),
1571 /// Creates a new CResult_NoneErrorZ in the error state.
1572 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1573 CResult_NoneErrorZ {
1574 contents: CResult_NoneErrorZPtr {
1575 err: Box::into_raw(Box::new(e)),
1580 /// Checks if the given object is currently in the success state
1582 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1586 /// Frees any resources used by the CResult_NoneErrorZ.
1587 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1588 impl Drop for CResult_NoneErrorZ {
1589 fn drop(&mut self) {
1592 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1593 let _ = unsafe { Box::from_raw(self.contents.err) };
1598 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1599 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1600 let contents = if o.result_ok {
1601 let _ = unsafe { Box::from_raw(o.contents.result) };
1602 o.contents.result = std::ptr::null_mut();
1603 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1605 let err = unsafe { o.contents.err };
1606 unsafe { o.contents.err = std::ptr::null_mut(); }
1607 CResult_NoneErrorZPtr { err }
1611 result_ok: o.result_ok,
1615 impl Clone for CResult_NoneErrorZ {
1616 fn clone(&self) -> Self {
1618 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1619 result: std::ptr::null_mut()
1622 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1623 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1629 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1630 /// but with all dynamically-allocated buffers duplicated in new buffers.
1631 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1633 /// The contents of CResult_RouteHopDecodeErrorZ
1634 pub union CResult_RouteHopDecodeErrorZPtr {
1635 /// A pointer to the contents in the success state.
1636 /// Reading from this pointer when `result_ok` is not set is undefined.
1637 pub result: *mut crate::lightning::routing::router::RouteHop,
1638 /// A pointer to the contents in the error state.
1639 /// Reading from this pointer when `result_ok` is set is undefined.
1640 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1643 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1644 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1645 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1646 pub struct CResult_RouteHopDecodeErrorZ {
1647 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1648 /// `err` or `result` depending on the state of `result_ok`.
1649 pub contents: CResult_RouteHopDecodeErrorZPtr,
1650 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1651 pub result_ok: bool,
1654 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1655 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1656 CResult_RouteHopDecodeErrorZ {
1657 contents: CResult_RouteHopDecodeErrorZPtr {
1658 result: Box::into_raw(Box::new(o)),
1664 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1665 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1666 CResult_RouteHopDecodeErrorZ {
1667 contents: CResult_RouteHopDecodeErrorZPtr {
1668 err: Box::into_raw(Box::new(e)),
1673 /// Checks if the given object is currently in the success state
1675 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1679 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1680 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1681 impl Drop for CResult_RouteHopDecodeErrorZ {
1682 fn drop(&mut self) {
1684 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1685 let _ = unsafe { Box::from_raw(self.contents.result) };
1688 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1689 let _ = unsafe { Box::from_raw(self.contents.err) };
1694 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1695 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1696 let contents = if o.result_ok {
1697 let result = unsafe { o.contents.result };
1698 unsafe { o.contents.result = std::ptr::null_mut() };
1699 CResult_RouteHopDecodeErrorZPtr { result }
1701 let err = unsafe { o.contents.err };
1702 unsafe { o.contents.err = std::ptr::null_mut(); }
1703 CResult_RouteHopDecodeErrorZPtr { err }
1707 result_ok: o.result_ok,
1711 impl Clone for CResult_RouteHopDecodeErrorZ {
1712 fn clone(&self) -> Self {
1714 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1715 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1718 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1719 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1725 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1726 /// but with all dynamically-allocated buffers duplicated in new buffers.
1727 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1729 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1730 /// This corresponds to std::vector in C++
1731 pub struct CVec_RouteHopZ {
1732 /// The elements in the array.
1733 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1734 pub data: *mut crate::lightning::routing::router::RouteHop,
1735 /// The number of elements pointed to by `data`.
1738 impl CVec_RouteHopZ {
1739 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1740 if self.datalen == 0 { return Vec::new(); }
1741 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1742 self.data = std::ptr::null_mut();
1746 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1747 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1750 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1751 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1752 let datalen = v.len();
1753 let data = Box::into_raw(v.into_boxed_slice());
1754 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1758 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1759 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1760 impl Drop for CVec_RouteHopZ {
1761 fn drop(&mut self) {
1762 if self.datalen == 0 { return; }
1763 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1766 impl Clone for CVec_RouteHopZ {
1767 fn clone(&self) -> Self {
1768 let mut res = Vec::new();
1769 if self.datalen == 0 { return Self::from(res); }
1770 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1775 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1776 /// This corresponds to std::vector in C++
1777 pub struct CVec_CVec_RouteHopZZ {
1778 /// The elements in the array.
1779 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1780 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1781 /// The number of elements pointed to by `data`.
1784 impl CVec_CVec_RouteHopZZ {
1785 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1786 if self.datalen == 0 { return Vec::new(); }
1787 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1788 self.data = std::ptr::null_mut();
1792 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1793 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1796 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1797 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1798 let datalen = v.len();
1799 let data = Box::into_raw(v.into_boxed_slice());
1800 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1804 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1805 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1806 impl Drop for CVec_CVec_RouteHopZZ {
1807 fn drop(&mut self) {
1808 if self.datalen == 0 { return; }
1809 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1812 impl Clone for CVec_CVec_RouteHopZZ {
1813 fn clone(&self) -> Self {
1814 let mut res = Vec::new();
1815 if self.datalen == 0 { return Self::from(res); }
1816 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1821 /// The contents of CResult_RouteDecodeErrorZ
1822 pub union CResult_RouteDecodeErrorZPtr {
1823 /// A pointer to the contents in the success state.
1824 /// Reading from this pointer when `result_ok` is not set is undefined.
1825 pub result: *mut crate::lightning::routing::router::Route,
1826 /// A pointer to the contents in the error state.
1827 /// Reading from this pointer when `result_ok` is set is undefined.
1828 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1831 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1832 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1834 pub struct CResult_RouteDecodeErrorZ {
1835 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1836 /// `err` or `result` depending on the state of `result_ok`.
1837 pub contents: CResult_RouteDecodeErrorZPtr,
1838 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1839 pub result_ok: bool,
1842 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1843 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1844 CResult_RouteDecodeErrorZ {
1845 contents: CResult_RouteDecodeErrorZPtr {
1846 result: Box::into_raw(Box::new(o)),
1852 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1853 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1854 CResult_RouteDecodeErrorZ {
1855 contents: CResult_RouteDecodeErrorZPtr {
1856 err: Box::into_raw(Box::new(e)),
1861 /// Checks if the given object is currently in the success state
1863 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
1867 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1868 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1869 impl Drop for CResult_RouteDecodeErrorZ {
1870 fn drop(&mut self) {
1872 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1873 let _ = unsafe { Box::from_raw(self.contents.result) };
1876 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1877 let _ = unsafe { Box::from_raw(self.contents.err) };
1882 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1883 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1884 let contents = if o.result_ok {
1885 let result = unsafe { o.contents.result };
1886 unsafe { o.contents.result = std::ptr::null_mut() };
1887 CResult_RouteDecodeErrorZPtr { result }
1889 let err = unsafe { o.contents.err };
1890 unsafe { o.contents.err = std::ptr::null_mut(); }
1891 CResult_RouteDecodeErrorZPtr { err }
1895 result_ok: o.result_ok,
1899 impl Clone for CResult_RouteDecodeErrorZ {
1900 fn clone(&self) -> Self {
1902 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1903 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1906 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1907 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1913 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1914 /// but with all dynamically-allocated buffers duplicated in new buffers.
1915 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1917 /// The contents of CResult_RouteParametersDecodeErrorZ
1918 pub union CResult_RouteParametersDecodeErrorZPtr {
1919 /// A pointer to the contents in the success state.
1920 /// Reading from this pointer when `result_ok` is not set is undefined.
1921 pub result: *mut crate::lightning::routing::router::RouteParameters,
1922 /// A pointer to the contents in the error state.
1923 /// Reading from this pointer when `result_ok` is set is undefined.
1924 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1927 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1928 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1930 pub struct CResult_RouteParametersDecodeErrorZ {
1931 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1932 /// `err` or `result` depending on the state of `result_ok`.
1933 pub contents: CResult_RouteParametersDecodeErrorZPtr,
1934 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1935 pub result_ok: bool,
1938 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1939 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1940 CResult_RouteParametersDecodeErrorZ {
1941 contents: CResult_RouteParametersDecodeErrorZPtr {
1942 result: Box::into_raw(Box::new(o)),
1948 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
1949 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
1950 CResult_RouteParametersDecodeErrorZ {
1951 contents: CResult_RouteParametersDecodeErrorZPtr {
1952 err: Box::into_raw(Box::new(e)),
1957 /// Checks if the given object is currently in the success state
1959 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
1963 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
1964 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
1965 impl Drop for CResult_RouteParametersDecodeErrorZ {
1966 fn drop(&mut self) {
1968 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1969 let _ = unsafe { Box::from_raw(self.contents.result) };
1972 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1973 let _ = unsafe { Box::from_raw(self.contents.err) };
1978 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
1979 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1980 let contents = if o.result_ok {
1981 let result = unsafe { o.contents.result };
1982 unsafe { o.contents.result = std::ptr::null_mut() };
1983 CResult_RouteParametersDecodeErrorZPtr { result }
1985 let err = unsafe { o.contents.err };
1986 unsafe { o.contents.err = std::ptr::null_mut(); }
1987 CResult_RouteParametersDecodeErrorZPtr { err }
1991 result_ok: o.result_ok,
1995 impl Clone for CResult_RouteParametersDecodeErrorZ {
1996 fn clone(&self) -> Self {
1998 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
1999 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2002 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2003 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2009 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2010 /// but with all dynamically-allocated buffers duplicated in new buffers.
2011 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2013 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2014 /// This corresponds to std::vector in C++
2015 pub struct CVec_RouteHintZ {
2016 /// The elements in the array.
2017 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2018 pub data: *mut crate::lightning::routing::router::RouteHint,
2019 /// The number of elements pointed to by `data`.
2022 impl CVec_RouteHintZ {
2023 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2024 if self.datalen == 0 { return Vec::new(); }
2025 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2026 self.data = std::ptr::null_mut();
2030 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2031 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2034 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2035 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2036 let datalen = v.len();
2037 let data = Box::into_raw(v.into_boxed_slice());
2038 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2042 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2043 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2044 impl Drop for CVec_RouteHintZ {
2045 fn drop(&mut self) {
2046 if self.datalen == 0 { return; }
2047 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2050 impl Clone for CVec_RouteHintZ {
2051 fn clone(&self) -> Self {
2052 let mut res = Vec::new();
2053 if self.datalen == 0 { return Self::from(res); }
2054 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2060 /// An enum which can either contain a u64 or not
2061 pub enum COption_u64Z {
2062 /// When we're in this state, this COption_u64Z contains a u64
2064 /// When we're in this state, this COption_u64Z contains nothing
2068 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2069 if let Self::Some(_) = self { true } else { false }
2071 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2074 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2075 if let Self::Some(v) = self { v } else { unreachable!() }
2079 /// Constructs a new COption_u64Z containing a u64
2080 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2081 COption_u64Z::Some(o)
2084 /// Constructs a new COption_u64Z containing nothing
2085 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2089 /// Frees any resources associated with the u64, if we are in the Some state
2090 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2092 /// Creates a new COption_u64Z which has the same data as `orig`
2093 /// but with all dynamically-allocated buffers duplicated in new buffers.
2094 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2096 /// The contents of CResult_PayeeDecodeErrorZ
2097 pub union CResult_PayeeDecodeErrorZPtr {
2098 /// A pointer to the contents in the success state.
2099 /// Reading from this pointer when `result_ok` is not set is undefined.
2100 pub result: *mut crate::lightning::routing::router::Payee,
2101 /// A pointer to the contents in the error state.
2102 /// Reading from this pointer when `result_ok` is set is undefined.
2103 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2106 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2107 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2109 pub struct CResult_PayeeDecodeErrorZ {
2110 /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2111 /// `err` or `result` depending on the state of `result_ok`.
2112 pub contents: CResult_PayeeDecodeErrorZPtr,
2113 /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2114 pub result_ok: bool,
2117 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2118 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2119 CResult_PayeeDecodeErrorZ {
2120 contents: CResult_PayeeDecodeErrorZPtr {
2121 result: Box::into_raw(Box::new(o)),
2127 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2128 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2129 CResult_PayeeDecodeErrorZ {
2130 contents: CResult_PayeeDecodeErrorZPtr {
2131 err: Box::into_raw(Box::new(e)),
2136 /// Checks if the given object is currently in the success state
2138 pub extern "C" fn CResult_PayeeDecodeErrorZ_is_ok(o: &CResult_PayeeDecodeErrorZ) -> bool {
2142 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2143 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2144 impl Drop for CResult_PayeeDecodeErrorZ {
2145 fn drop(&mut self) {
2147 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2148 let _ = unsafe { Box::from_raw(self.contents.result) };
2151 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2152 let _ = unsafe { Box::from_raw(self.contents.err) };
2157 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2158 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2159 let contents = if o.result_ok {
2160 let result = unsafe { o.contents.result };
2161 unsafe { o.contents.result = std::ptr::null_mut() };
2162 CResult_PayeeDecodeErrorZPtr { result }
2164 let err = unsafe { o.contents.err };
2165 unsafe { o.contents.err = std::ptr::null_mut(); }
2166 CResult_PayeeDecodeErrorZPtr { err }
2170 result_ok: o.result_ok,
2174 impl Clone for CResult_PayeeDecodeErrorZ {
2175 fn clone(&self) -> Self {
2177 Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2178 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2181 Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2182 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2188 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2189 /// but with all dynamically-allocated buffers duplicated in new buffers.
2190 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2192 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2193 /// This corresponds to std::vector in C++
2194 pub struct CVec_RouteHintHopZ {
2195 /// The elements in the array.
2196 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2197 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2198 /// The number of elements pointed to by `data`.
2201 impl CVec_RouteHintHopZ {
2202 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2203 if self.datalen == 0 { return Vec::new(); }
2204 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2205 self.data = std::ptr::null_mut();
2209 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2210 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2213 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2214 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2215 let datalen = v.len();
2216 let data = Box::into_raw(v.into_boxed_slice());
2217 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2221 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2222 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2223 impl Drop for CVec_RouteHintHopZ {
2224 fn drop(&mut self) {
2225 if self.datalen == 0 { return; }
2226 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2229 impl Clone for CVec_RouteHintHopZ {
2230 fn clone(&self) -> Self {
2231 let mut res = Vec::new();
2232 if self.datalen == 0 { return Self::from(res); }
2233 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2238 /// The contents of CResult_RouteHintDecodeErrorZ
2239 pub union CResult_RouteHintDecodeErrorZPtr {
2240 /// A pointer to the contents in the success state.
2241 /// Reading from this pointer when `result_ok` is not set is undefined.
2242 pub result: *mut crate::lightning::routing::router::RouteHint,
2243 /// A pointer to the contents in the error state.
2244 /// Reading from this pointer when `result_ok` is set is undefined.
2245 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2248 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2249 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2250 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2251 pub struct CResult_RouteHintDecodeErrorZ {
2252 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2253 /// `err` or `result` depending on the state of `result_ok`.
2254 pub contents: CResult_RouteHintDecodeErrorZPtr,
2255 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2256 pub result_ok: bool,
2259 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2260 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2261 CResult_RouteHintDecodeErrorZ {
2262 contents: CResult_RouteHintDecodeErrorZPtr {
2263 result: Box::into_raw(Box::new(o)),
2269 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2270 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2271 CResult_RouteHintDecodeErrorZ {
2272 contents: CResult_RouteHintDecodeErrorZPtr {
2273 err: Box::into_raw(Box::new(e)),
2278 /// Checks if the given object is currently in the success state
2280 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2284 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2285 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2286 impl Drop for CResult_RouteHintDecodeErrorZ {
2287 fn drop(&mut self) {
2289 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2290 let _ = unsafe { Box::from_raw(self.contents.result) };
2293 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2294 let _ = unsafe { Box::from_raw(self.contents.err) };
2299 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2300 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2301 let contents = if o.result_ok {
2302 let result = unsafe { o.contents.result };
2303 unsafe { o.contents.result = std::ptr::null_mut() };
2304 CResult_RouteHintDecodeErrorZPtr { result }
2306 let err = unsafe { o.contents.err };
2307 unsafe { o.contents.err = std::ptr::null_mut(); }
2308 CResult_RouteHintDecodeErrorZPtr { err }
2312 result_ok: o.result_ok,
2316 impl Clone for CResult_RouteHintDecodeErrorZ {
2317 fn clone(&self) -> Self {
2319 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2320 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2323 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2324 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2330 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2331 /// but with all dynamically-allocated buffers duplicated in new buffers.
2332 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2334 /// The contents of CResult_RouteHintHopDecodeErrorZ
2335 pub union CResult_RouteHintHopDecodeErrorZPtr {
2336 /// A pointer to the contents in the success state.
2337 /// Reading from this pointer when `result_ok` is not set is undefined.
2338 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2339 /// A pointer to the contents in the error state.
2340 /// Reading from this pointer when `result_ok` is set is undefined.
2341 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2344 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2345 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2347 pub struct CResult_RouteHintHopDecodeErrorZ {
2348 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2349 /// `err` or `result` depending on the state of `result_ok`.
2350 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2351 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2352 pub result_ok: bool,
2355 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2356 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2357 CResult_RouteHintHopDecodeErrorZ {
2358 contents: CResult_RouteHintHopDecodeErrorZPtr {
2359 result: Box::into_raw(Box::new(o)),
2365 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2366 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2367 CResult_RouteHintHopDecodeErrorZ {
2368 contents: CResult_RouteHintHopDecodeErrorZPtr {
2369 err: Box::into_raw(Box::new(e)),
2374 /// Checks if the given object is currently in the success state
2376 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2380 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2381 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2382 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2383 fn drop(&mut self) {
2385 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2386 let _ = unsafe { Box::from_raw(self.contents.result) };
2389 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2390 let _ = unsafe { Box::from_raw(self.contents.err) };
2395 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2396 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2397 let contents = if o.result_ok {
2398 let result = unsafe { o.contents.result };
2399 unsafe { o.contents.result = std::ptr::null_mut() };
2400 CResult_RouteHintHopDecodeErrorZPtr { result }
2402 let err = unsafe { o.contents.err };
2403 unsafe { o.contents.err = std::ptr::null_mut(); }
2404 CResult_RouteHintHopDecodeErrorZPtr { err }
2408 result_ok: o.result_ok,
2412 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2413 fn clone(&self) -> Self {
2415 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2416 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2419 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2420 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2426 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2427 /// but with all dynamically-allocated buffers duplicated in new buffers.
2428 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2430 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2431 /// This corresponds to std::vector in C++
2432 pub struct CVec_ChannelDetailsZ {
2433 /// The elements in the array.
2434 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2435 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2436 /// The number of elements pointed to by `data`.
2439 impl CVec_ChannelDetailsZ {
2440 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2441 if self.datalen == 0 { return Vec::new(); }
2442 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2443 self.data = std::ptr::null_mut();
2447 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2448 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2451 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2452 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2453 let datalen = v.len();
2454 let data = Box::into_raw(v.into_boxed_slice());
2455 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2459 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2460 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2461 impl Drop for CVec_ChannelDetailsZ {
2462 fn drop(&mut self) {
2463 if self.datalen == 0 { return; }
2464 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2467 impl Clone for CVec_ChannelDetailsZ {
2468 fn clone(&self) -> Self {
2469 let mut res = Vec::new();
2470 if self.datalen == 0 { return Self::from(res); }
2471 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2476 /// The contents of CResult_RouteLightningErrorZ
2477 pub union CResult_RouteLightningErrorZPtr {
2478 /// A pointer to the contents in the success state.
2479 /// Reading from this pointer when `result_ok` is not set is undefined.
2480 pub result: *mut crate::lightning::routing::router::Route,
2481 /// A pointer to the contents in the error state.
2482 /// Reading from this pointer when `result_ok` is set is undefined.
2483 pub err: *mut crate::lightning::ln::msgs::LightningError,
2486 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2487 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2488 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2489 pub struct CResult_RouteLightningErrorZ {
2490 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2491 /// `err` or `result` depending on the state of `result_ok`.
2492 pub contents: CResult_RouteLightningErrorZPtr,
2493 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2494 pub result_ok: bool,
2497 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2498 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2499 CResult_RouteLightningErrorZ {
2500 contents: CResult_RouteLightningErrorZPtr {
2501 result: Box::into_raw(Box::new(o)),
2507 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2508 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2509 CResult_RouteLightningErrorZ {
2510 contents: CResult_RouteLightningErrorZPtr {
2511 err: Box::into_raw(Box::new(e)),
2516 /// Checks if the given object is currently in the success state
2518 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2522 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2523 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2524 impl Drop for CResult_RouteLightningErrorZ {
2525 fn drop(&mut self) {
2527 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2528 let _ = unsafe { Box::from_raw(self.contents.result) };
2531 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2532 let _ = unsafe { Box::from_raw(self.contents.err) };
2537 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2538 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2539 let contents = if o.result_ok {
2540 let result = unsafe { o.contents.result };
2541 unsafe { o.contents.result = std::ptr::null_mut() };
2542 CResult_RouteLightningErrorZPtr { result }
2544 let err = unsafe { o.contents.err };
2545 unsafe { o.contents.err = std::ptr::null_mut(); }
2546 CResult_RouteLightningErrorZPtr { err }
2550 result_ok: o.result_ok,
2554 impl Clone for CResult_RouteLightningErrorZ {
2555 fn clone(&self) -> Self {
2557 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2558 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2561 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2562 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2568 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2569 /// but with all dynamically-allocated buffers duplicated in new buffers.
2570 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2572 /// The contents of CResult_TxOutAccessErrorZ
2573 pub union CResult_TxOutAccessErrorZPtr {
2574 /// A pointer to the contents in the success state.
2575 /// Reading from this pointer when `result_ok` is not set is undefined.
2576 pub result: *mut crate::c_types::TxOut,
2577 /// A pointer to the contents in the error state.
2578 /// Reading from this pointer when `result_ok` is set is undefined.
2579 pub err: *mut crate::lightning::chain::AccessError,
2582 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2583 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2585 pub struct CResult_TxOutAccessErrorZ {
2586 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2587 /// `err` or `result` depending on the state of `result_ok`.
2588 pub contents: CResult_TxOutAccessErrorZPtr,
2589 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2590 pub result_ok: bool,
2593 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2594 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2595 CResult_TxOutAccessErrorZ {
2596 contents: CResult_TxOutAccessErrorZPtr {
2597 result: Box::into_raw(Box::new(o)),
2603 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2604 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2605 CResult_TxOutAccessErrorZ {
2606 contents: CResult_TxOutAccessErrorZPtr {
2607 err: Box::into_raw(Box::new(e)),
2612 /// Checks if the given object is currently in the success state
2614 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2618 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2619 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2620 impl Drop for CResult_TxOutAccessErrorZ {
2621 fn drop(&mut self) {
2623 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2624 let _ = unsafe { Box::from_raw(self.contents.result) };
2627 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2628 let _ = unsafe { Box::from_raw(self.contents.err) };
2633 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2634 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2635 let contents = if o.result_ok {
2636 let result = unsafe { o.contents.result };
2637 unsafe { o.contents.result = std::ptr::null_mut() };
2638 CResult_TxOutAccessErrorZPtr { result }
2640 let err = unsafe { o.contents.err };
2641 unsafe { o.contents.err = std::ptr::null_mut(); }
2642 CResult_TxOutAccessErrorZPtr { err }
2646 result_ok: o.result_ok,
2650 impl Clone for CResult_TxOutAccessErrorZ {
2651 fn clone(&self) -> Self {
2653 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2654 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2657 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2658 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2664 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2665 /// but with all dynamically-allocated buffers duplicated in new buffers.
2666 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2668 /// A tuple of 2 elements. See the individual fields for the types contained.
2669 pub struct C2Tuple_usizeTransactionZ {
2670 /// The element at position 0
2672 /// The element at position 1
2673 pub b: crate::c_types::Transaction,
2675 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2676 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2683 impl C2Tuple_usizeTransactionZ {
2684 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2688 impl Clone for C2Tuple_usizeTransactionZ {
2689 fn clone(&self) -> Self {
2691 a: Clone::clone(&self.a),
2692 b: Clone::clone(&self.b),
2697 /// Creates a new tuple which has the same data as `orig`
2698 /// but with all dynamically-allocated buffers duplicated in new buffers.
2699 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2700 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2702 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2703 C2Tuple_usizeTransactionZ { a, b, }
2707 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2708 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2710 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2711 /// This corresponds to std::vector in C++
2712 pub struct CVec_C2Tuple_usizeTransactionZZ {
2713 /// The elements in the array.
2714 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2715 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2716 /// The number of elements pointed to by `data`.
2719 impl CVec_C2Tuple_usizeTransactionZZ {
2720 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2721 if self.datalen == 0 { return Vec::new(); }
2722 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2723 self.data = std::ptr::null_mut();
2727 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2728 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2731 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2732 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2733 let datalen = v.len();
2734 let data = Box::into_raw(v.into_boxed_slice());
2735 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2739 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2740 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2741 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2742 fn drop(&mut self) {
2743 if self.datalen == 0 { return; }
2744 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2747 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2748 fn clone(&self) -> Self {
2749 let mut res = Vec::new();
2750 if self.datalen == 0 { return Self::from(res); }
2751 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2756 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2757 /// This corresponds to std::vector in C++
2758 pub struct CVec_TxidZ {
2759 /// The elements in the array.
2760 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2761 pub data: *mut crate::c_types::ThirtyTwoBytes,
2762 /// The number of elements pointed to by `data`.
2766 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2767 if self.datalen == 0 { return Vec::new(); }
2768 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2769 self.data = std::ptr::null_mut();
2773 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2774 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2777 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2778 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2779 let datalen = v.len();
2780 let data = Box::into_raw(v.into_boxed_slice());
2781 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2785 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2786 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2787 impl Drop for CVec_TxidZ {
2788 fn drop(&mut self) {
2789 if self.datalen == 0 { return; }
2790 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2793 impl Clone for CVec_TxidZ {
2794 fn clone(&self) -> Self {
2795 let mut res = Vec::new();
2796 if self.datalen == 0 { return Self::from(res); }
2797 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2802 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2803 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2804 /// Note that this value is always NULL, as there are no contents in the OK variant
2805 pub result: *mut std::ffi::c_void,
2806 /// A pointer to the contents in the error state.
2807 /// Reading from this pointer when `result_ok` is set is undefined.
2808 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2811 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2812 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2814 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2815 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2816 /// `err` or `result` depending on the state of `result_ok`.
2817 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2818 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2819 pub result_ok: bool,
2822 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2823 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2824 CResult_NoneChannelMonitorUpdateErrZ {
2825 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2826 result: std::ptr::null_mut(),
2832 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2833 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2834 CResult_NoneChannelMonitorUpdateErrZ {
2835 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2836 err: Box::into_raw(Box::new(e)),
2841 /// Checks if the given object is currently in the success state
2843 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
2847 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2848 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2849 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2850 fn drop(&mut self) {
2853 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2854 let _ = unsafe { Box::from_raw(self.contents.err) };
2859 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2860 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2861 let contents = if o.result_ok {
2862 let _ = unsafe { Box::from_raw(o.contents.result) };
2863 o.contents.result = std::ptr::null_mut();
2864 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2866 let err = unsafe { o.contents.err };
2867 unsafe { o.contents.err = std::ptr::null_mut(); }
2868 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2872 result_ok: o.result_ok,
2876 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2877 fn clone(&self) -> Self {
2879 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2880 result: std::ptr::null_mut()
2883 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2884 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2890 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2891 /// but with all dynamically-allocated buffers duplicated in new buffers.
2892 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2894 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2895 /// This corresponds to std::vector in C++
2896 pub struct CVec_MonitorEventZ {
2897 /// The elements in the array.
2898 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2899 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2900 /// The number of elements pointed to by `data`.
2903 impl CVec_MonitorEventZ {
2904 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2905 if self.datalen == 0 { return Vec::new(); }
2906 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2907 self.data = std::ptr::null_mut();
2911 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2912 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2915 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2916 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2917 let datalen = v.len();
2918 let data = Box::into_raw(v.into_boxed_slice());
2919 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2923 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2924 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2925 impl Drop for CVec_MonitorEventZ {
2926 fn drop(&mut self) {
2927 if self.datalen == 0 { return; }
2928 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2931 impl Clone for CVec_MonitorEventZ {
2932 fn clone(&self) -> Self {
2933 let mut res = Vec::new();
2934 if self.datalen == 0 { return Self::from(res); }
2935 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2941 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2942 pub enum COption_C2Tuple_usizeTransactionZZ {
2943 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2944 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2945 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2948 impl COption_C2Tuple_usizeTransactionZZ {
2949 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2950 if let Self::Some(_) = self { true } else { false }
2952 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2955 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2956 if let Self::Some(v) = self { v } else { unreachable!() }
2960 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2961 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2962 COption_C2Tuple_usizeTransactionZZ::Some(o)
2965 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2966 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2967 COption_C2Tuple_usizeTransactionZZ::None
2970 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2971 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2973 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2974 /// but with all dynamically-allocated buffers duplicated in new buffers.
2975 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
2978 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2979 pub enum COption_ClosureReasonZ {
2980 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2981 Some(crate::lightning::util::events::ClosureReason),
2982 /// When we're in this state, this COption_ClosureReasonZ contains nothing
2985 impl COption_ClosureReasonZ {
2986 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2987 if let Self::Some(_) = self { true } else { false }
2989 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2992 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
2993 if let Self::Some(v) = self { v } else { unreachable!() }
2997 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
2998 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
2999 COption_ClosureReasonZ::Some(o)
3002 /// Constructs a new COption_ClosureReasonZ containing nothing
3003 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3004 COption_ClosureReasonZ::None
3007 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3008 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3010 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3011 /// but with all dynamically-allocated buffers duplicated in new buffers.
3012 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3014 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3015 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3016 /// A pointer to the contents in the success state.
3017 /// Reading from this pointer when `result_ok` is not set is undefined.
3018 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3019 /// A pointer to the contents in the error state.
3020 /// Reading from this pointer when `result_ok` is set is undefined.
3021 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3024 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3025 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3027 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3028 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3029 /// `err` or `result` depending on the state of `result_ok`.
3030 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3031 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3032 pub result_ok: bool,
3035 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3036 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3037 CResult_COption_ClosureReasonZDecodeErrorZ {
3038 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3039 result: Box::into_raw(Box::new(o)),
3045 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3046 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3047 CResult_COption_ClosureReasonZDecodeErrorZ {
3048 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3049 err: Box::into_raw(Box::new(e)),
3054 /// Checks if the given object is currently in the success state
3056 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3060 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3061 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3062 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3063 fn drop(&mut self) {
3065 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3066 let _ = unsafe { Box::from_raw(self.contents.result) };
3069 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3070 let _ = unsafe { Box::from_raw(self.contents.err) };
3075 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3076 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3077 let contents = if o.result_ok {
3078 let result = unsafe { o.contents.result };
3079 unsafe { o.contents.result = std::ptr::null_mut() };
3080 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3082 let err = unsafe { o.contents.err };
3083 unsafe { o.contents.err = std::ptr::null_mut(); }
3084 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3088 result_ok: o.result_ok,
3092 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3093 fn clone(&self) -> Self {
3095 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3096 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3099 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3100 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3106 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3107 /// but with all dynamically-allocated buffers duplicated in new buffers.
3108 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3111 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3112 pub enum COption_NetworkUpdateZ {
3113 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3114 Some(crate::lightning::routing::network_graph::NetworkUpdate),
3115 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3118 impl COption_NetworkUpdateZ {
3119 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3120 if let Self::Some(_) = self { true } else { false }
3122 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3125 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3126 if let Self::Some(v) = self { v } else { unreachable!() }
3130 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3131 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3132 COption_NetworkUpdateZ::Some(o)
3135 /// Constructs a new COption_NetworkUpdateZ containing nothing
3136 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3137 COption_NetworkUpdateZ::None
3140 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3141 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3143 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3144 /// but with all dynamically-allocated buffers duplicated in new buffers.
3145 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3147 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3148 /// This corresponds to std::vector in C++
3149 pub struct CVec_SpendableOutputDescriptorZ {
3150 /// The elements in the array.
3151 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3152 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3153 /// The number of elements pointed to by `data`.
3156 impl CVec_SpendableOutputDescriptorZ {
3157 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3158 if self.datalen == 0 { return Vec::new(); }
3159 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3160 self.data = std::ptr::null_mut();
3164 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3165 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3168 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3169 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3170 let datalen = v.len();
3171 let data = Box::into_raw(v.into_boxed_slice());
3172 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3176 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3177 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3178 impl Drop for CVec_SpendableOutputDescriptorZ {
3179 fn drop(&mut self) {
3180 if self.datalen == 0 { return; }
3181 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3184 impl Clone for CVec_SpendableOutputDescriptorZ {
3185 fn clone(&self) -> Self {
3186 let mut res = Vec::new();
3187 if self.datalen == 0 { return Self::from(res); }
3188 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3194 /// An enum which can either contain a crate::lightning::util::events::Event or not
3195 pub enum COption_EventZ {
3196 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3197 Some(crate::lightning::util::events::Event),
3198 /// When we're in this state, this COption_EventZ contains nothing
3201 impl COption_EventZ {
3202 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3203 if let Self::Some(_) = self { true } else { false }
3205 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3208 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3209 if let Self::Some(v) = self { v } else { unreachable!() }
3213 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3214 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3215 COption_EventZ::Some(o)
3218 /// Constructs a new COption_EventZ containing nothing
3219 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3220 COption_EventZ::None
3223 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3224 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3226 /// Creates a new COption_EventZ which has the same data as `orig`
3227 /// but with all dynamically-allocated buffers duplicated in new buffers.
3228 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3230 /// The contents of CResult_COption_EventZDecodeErrorZ
3231 pub union CResult_COption_EventZDecodeErrorZPtr {
3232 /// A pointer to the contents in the success state.
3233 /// Reading from this pointer when `result_ok` is not set is undefined.
3234 pub result: *mut crate::c_types::derived::COption_EventZ,
3235 /// A pointer to the contents in the error state.
3236 /// Reading from this pointer when `result_ok` is set is undefined.
3237 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3240 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3241 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3243 pub struct CResult_COption_EventZDecodeErrorZ {
3244 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3245 /// `err` or `result` depending on the state of `result_ok`.
3246 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3247 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3248 pub result_ok: bool,
3251 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3252 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3253 CResult_COption_EventZDecodeErrorZ {
3254 contents: CResult_COption_EventZDecodeErrorZPtr {
3255 result: Box::into_raw(Box::new(o)),
3261 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3262 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3263 CResult_COption_EventZDecodeErrorZ {
3264 contents: CResult_COption_EventZDecodeErrorZPtr {
3265 err: Box::into_raw(Box::new(e)),
3270 /// Checks if the given object is currently in the success state
3272 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3276 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3277 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3278 impl Drop for CResult_COption_EventZDecodeErrorZ {
3279 fn drop(&mut self) {
3281 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3282 let _ = unsafe { Box::from_raw(self.contents.result) };
3285 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3286 let _ = unsafe { Box::from_raw(self.contents.err) };
3291 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3292 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3293 let contents = if o.result_ok {
3294 let result = unsafe { o.contents.result };
3295 unsafe { o.contents.result = std::ptr::null_mut() };
3296 CResult_COption_EventZDecodeErrorZPtr { result }
3298 let err = unsafe { o.contents.err };
3299 unsafe { o.contents.err = std::ptr::null_mut(); }
3300 CResult_COption_EventZDecodeErrorZPtr { err }
3304 result_ok: o.result_ok,
3308 impl Clone for CResult_COption_EventZDecodeErrorZ {
3309 fn clone(&self) -> Self {
3311 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3312 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3315 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3316 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3322 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3323 /// but with all dynamically-allocated buffers duplicated in new buffers.
3324 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3326 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3327 /// This corresponds to std::vector in C++
3328 pub struct CVec_MessageSendEventZ {
3329 /// The elements in the array.
3330 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3331 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3332 /// The number of elements pointed to by `data`.
3335 impl CVec_MessageSendEventZ {
3336 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3337 if self.datalen == 0 { return Vec::new(); }
3338 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3339 self.data = std::ptr::null_mut();
3343 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3344 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3347 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3348 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3349 let datalen = v.len();
3350 let data = Box::into_raw(v.into_boxed_slice());
3351 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3355 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3356 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3357 impl Drop for CVec_MessageSendEventZ {
3358 fn drop(&mut self) {
3359 if self.datalen == 0 { return; }
3360 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3363 impl Clone for CVec_MessageSendEventZ {
3364 fn clone(&self) -> Self {
3365 let mut res = Vec::new();
3366 if self.datalen == 0 { return Self::from(res); }
3367 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3372 /// The contents of CResult_InitFeaturesDecodeErrorZ
3373 pub union CResult_InitFeaturesDecodeErrorZPtr {
3374 /// A pointer to the contents in the success state.
3375 /// Reading from this pointer when `result_ok` is not set is undefined.
3376 pub result: *mut crate::lightning::ln::features::InitFeatures,
3377 /// A pointer to the contents in the error state.
3378 /// Reading from this pointer when `result_ok` is set is undefined.
3379 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3382 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3383 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3385 pub struct CResult_InitFeaturesDecodeErrorZ {
3386 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3387 /// `err` or `result` depending on the state of `result_ok`.
3388 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3389 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3390 pub result_ok: bool,
3393 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
3394 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
3395 CResult_InitFeaturesDecodeErrorZ {
3396 contents: CResult_InitFeaturesDecodeErrorZPtr {
3397 result: Box::into_raw(Box::new(o)),
3403 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3404 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3405 CResult_InitFeaturesDecodeErrorZ {
3406 contents: CResult_InitFeaturesDecodeErrorZPtr {
3407 err: Box::into_raw(Box::new(e)),
3412 /// Checks if the given object is currently in the success state
3414 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
3418 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3419 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3420 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3421 fn drop(&mut self) {
3423 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3424 let _ = unsafe { Box::from_raw(self.contents.result) };
3427 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3428 let _ = unsafe { Box::from_raw(self.contents.err) };
3433 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3434 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3435 let contents = if o.result_ok {
3436 let result = unsafe { o.contents.result };
3437 unsafe { o.contents.result = std::ptr::null_mut() };
3438 CResult_InitFeaturesDecodeErrorZPtr { result }
3440 let err = unsafe { o.contents.err };
3441 unsafe { o.contents.err = std::ptr::null_mut(); }
3442 CResult_InitFeaturesDecodeErrorZPtr { err }
3446 result_ok: o.result_ok,
3451 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3452 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3453 /// A pointer to the contents in the success state.
3454 /// Reading from this pointer when `result_ok` is not set is undefined.
3455 pub result: *mut crate::lightning::ln::features::NodeFeatures,
3456 /// A pointer to the contents in the error state.
3457 /// Reading from this pointer when `result_ok` is set is undefined.
3458 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3461 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3462 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3463 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3464 pub struct CResult_NodeFeaturesDecodeErrorZ {
3465 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3466 /// `err` or `result` depending on the state of `result_ok`.
3467 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3468 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3469 pub result_ok: bool,
3472 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3473 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3474 CResult_NodeFeaturesDecodeErrorZ {
3475 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3476 result: Box::into_raw(Box::new(o)),
3482 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3483 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3484 CResult_NodeFeaturesDecodeErrorZ {
3485 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3486 err: Box::into_raw(Box::new(e)),
3491 /// Checks if the given object is currently in the success state
3493 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
3497 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3498 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3499 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3500 fn drop(&mut self) {
3502 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3503 let _ = unsafe { Box::from_raw(self.contents.result) };
3506 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3507 let _ = unsafe { Box::from_raw(self.contents.err) };
3512 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3513 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3514 let contents = if o.result_ok {
3515 let result = unsafe { o.contents.result };
3516 unsafe { o.contents.result = std::ptr::null_mut() };
3517 CResult_NodeFeaturesDecodeErrorZPtr { result }
3519 let err = unsafe { o.contents.err };
3520 unsafe { o.contents.err = std::ptr::null_mut(); }
3521 CResult_NodeFeaturesDecodeErrorZPtr { err }
3525 result_ok: o.result_ok,
3530 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3531 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3532 /// A pointer to the contents in the success state.
3533 /// Reading from this pointer when `result_ok` is not set is undefined.
3534 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3535 /// A pointer to the contents in the error state.
3536 /// Reading from this pointer when `result_ok` is set is undefined.
3537 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3540 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3541 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3542 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3543 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3544 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3545 /// `err` or `result` depending on the state of `result_ok`.
3546 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3547 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3548 pub result_ok: bool,
3551 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3552 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3553 CResult_ChannelFeaturesDecodeErrorZ {
3554 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3555 result: Box::into_raw(Box::new(o)),
3561 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3562 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3563 CResult_ChannelFeaturesDecodeErrorZ {
3564 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3565 err: Box::into_raw(Box::new(e)),
3570 /// Checks if the given object is currently in the success state
3572 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
3576 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3577 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3578 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3579 fn drop(&mut self) {
3581 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3582 let _ = unsafe { Box::from_raw(self.contents.result) };
3585 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3586 let _ = unsafe { Box::from_raw(self.contents.err) };
3591 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3592 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3593 let contents = if o.result_ok {
3594 let result = unsafe { o.contents.result };
3595 unsafe { o.contents.result = std::ptr::null_mut() };
3596 CResult_ChannelFeaturesDecodeErrorZPtr { result }
3598 let err = unsafe { o.contents.err };
3599 unsafe { o.contents.err = std::ptr::null_mut(); }
3600 CResult_ChannelFeaturesDecodeErrorZPtr { err }
3604 result_ok: o.result_ok,
3609 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3610 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3611 /// A pointer to the contents in the success state.
3612 /// Reading from this pointer when `result_ok` is not set is undefined.
3613 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3614 /// A pointer to the contents in the error state.
3615 /// Reading from this pointer when `result_ok` is set is undefined.
3616 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3619 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3620 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3622 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3623 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3624 /// `err` or `result` depending on the state of `result_ok`.
3625 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3626 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3627 pub result_ok: bool,
3630 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3631 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3632 CResult_InvoiceFeaturesDecodeErrorZ {
3633 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3634 result: Box::into_raw(Box::new(o)),
3640 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3641 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3642 CResult_InvoiceFeaturesDecodeErrorZ {
3643 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3644 err: Box::into_raw(Box::new(e)),
3649 /// Checks if the given object is currently in the success state
3651 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
3655 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3656 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3657 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3658 fn drop(&mut self) {
3660 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3661 let _ = unsafe { Box::from_raw(self.contents.result) };
3664 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3665 let _ = unsafe { Box::from_raw(self.contents.err) };
3670 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3671 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3672 let contents = if o.result_ok {
3673 let result = unsafe { o.contents.result };
3674 unsafe { o.contents.result = std::ptr::null_mut() };
3675 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3677 let err = unsafe { o.contents.err };
3678 unsafe { o.contents.err = std::ptr::null_mut(); }
3679 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3683 result_ok: o.result_ok,
3688 /// The contents of CResult_ScoringParametersDecodeErrorZ
3689 pub union CResult_ScoringParametersDecodeErrorZPtr {
3690 /// A pointer to the contents in the success state.
3691 /// Reading from this pointer when `result_ok` is not set is undefined.
3692 pub result: *mut crate::lightning::routing::scorer::ScoringParameters,
3693 /// A pointer to the contents in the error state.
3694 /// Reading from this pointer when `result_ok` is set is undefined.
3695 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3698 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3699 /// containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3701 pub struct CResult_ScoringParametersDecodeErrorZ {
3702 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3703 /// `err` or `result` depending on the state of `result_ok`.
3704 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3705 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3706 pub result_ok: bool,
3709 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3710 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scorer::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3711 CResult_ScoringParametersDecodeErrorZ {
3712 contents: CResult_ScoringParametersDecodeErrorZPtr {
3713 result: Box::into_raw(Box::new(o)),
3719 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3720 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3721 CResult_ScoringParametersDecodeErrorZ {
3722 contents: CResult_ScoringParametersDecodeErrorZPtr {
3723 err: Box::into_raw(Box::new(e)),
3728 /// Checks if the given object is currently in the success state
3730 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3734 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3735 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3736 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3737 fn drop(&mut self) {
3739 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3740 let _ = unsafe { Box::from_raw(self.contents.result) };
3743 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3744 let _ = unsafe { Box::from_raw(self.contents.err) };
3749 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3750 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3751 let contents = if o.result_ok {
3752 let result = unsafe { o.contents.result };
3753 unsafe { o.contents.result = std::ptr::null_mut() };
3754 CResult_ScoringParametersDecodeErrorZPtr { result }
3756 let err = unsafe { o.contents.err };
3757 unsafe { o.contents.err = std::ptr::null_mut(); }
3758 CResult_ScoringParametersDecodeErrorZPtr { err }
3762 result_ok: o.result_ok,
3767 /// The contents of CResult_ScorerDecodeErrorZ
3768 pub union CResult_ScorerDecodeErrorZPtr {
3769 /// A pointer to the contents in the success state.
3770 /// Reading from this pointer when `result_ok` is not set is undefined.
3771 pub result: *mut crate::lightning::routing::scorer::Scorer,
3772 /// A pointer to the contents in the error state.
3773 /// Reading from this pointer when `result_ok` is set is undefined.
3774 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3777 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3778 /// containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3779 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3780 pub struct CResult_ScorerDecodeErrorZ {
3781 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3782 /// `err` or `result` depending on the state of `result_ok`.
3783 pub contents: CResult_ScorerDecodeErrorZPtr,
3784 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3785 pub result_ok: bool,
3788 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3789 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scorer::Scorer) -> CResult_ScorerDecodeErrorZ {
3790 CResult_ScorerDecodeErrorZ {
3791 contents: CResult_ScorerDecodeErrorZPtr {
3792 result: Box::into_raw(Box::new(o)),
3798 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3799 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3800 CResult_ScorerDecodeErrorZ {
3801 contents: CResult_ScorerDecodeErrorZPtr {
3802 err: Box::into_raw(Box::new(e)),
3807 /// Checks if the given object is currently in the success state
3809 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3813 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3814 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3815 impl Drop for CResult_ScorerDecodeErrorZ {
3816 fn drop(&mut self) {
3818 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3819 let _ = unsafe { Box::from_raw(self.contents.result) };
3822 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3823 let _ = unsafe { Box::from_raw(self.contents.err) };
3828 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3829 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3830 let contents = if o.result_ok {
3831 let result = unsafe { o.contents.result };
3832 unsafe { o.contents.result = std::ptr::null_mut() };
3833 CResult_ScorerDecodeErrorZPtr { result }
3835 let err = unsafe { o.contents.err };
3836 unsafe { o.contents.err = std::ptr::null_mut(); }
3837 CResult_ScorerDecodeErrorZPtr { err }
3841 result_ok: o.result_ok,
3846 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3847 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3848 /// A pointer to the contents in the success state.
3849 /// Reading from this pointer when `result_ok` is not set is undefined.
3850 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3851 /// A pointer to the contents in the error state.
3852 /// Reading from this pointer when `result_ok` is set is undefined.
3853 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3856 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3857 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3859 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3860 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3861 /// `err` or `result` depending on the state of `result_ok`.
3862 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3863 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3864 pub result_ok: bool,
3867 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
3868 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3869 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3870 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3871 result: Box::into_raw(Box::new(o)),
3877 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
3878 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3879 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3880 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3881 err: Box::into_raw(Box::new(e)),
3886 /// Checks if the given object is currently in the success state
3888 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
3892 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
3893 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
3894 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3895 fn drop(&mut self) {
3897 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3898 let _ = unsafe { Box::from_raw(self.contents.result) };
3901 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3902 let _ = unsafe { Box::from_raw(self.contents.err) };
3907 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3908 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3909 let contents = if o.result_ok {
3910 let result = unsafe { o.contents.result };
3911 unsafe { o.contents.result = std::ptr::null_mut() };
3912 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
3914 let err = unsafe { o.contents.err };
3915 unsafe { o.contents.err = std::ptr::null_mut(); }
3916 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
3920 result_ok: o.result_ok,
3924 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3925 fn clone(&self) -> Self {
3927 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3928 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3931 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3932 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3938 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3939 /// but with all dynamically-allocated buffers duplicated in new buffers.
3940 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3942 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3943 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3944 /// A pointer to the contents in the success state.
3945 /// Reading from this pointer when `result_ok` is not set is undefined.
3946 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
3947 /// A pointer to the contents in the error state.
3948 /// Reading from this pointer when `result_ok` is set is undefined.
3949 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3952 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3953 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3955 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3956 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3957 /// `err` or `result` depending on the state of `result_ok`.
3958 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
3959 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3960 pub result_ok: bool,
3963 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
3964 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3965 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3966 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3967 result: Box::into_raw(Box::new(o)),
3973 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
3974 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3975 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3976 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3977 err: Box::into_raw(Box::new(e)),
3982 /// Checks if the given object is currently in the success state
3984 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
3988 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
3989 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
3990 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3991 fn drop(&mut self) {
3993 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3994 let _ = unsafe { Box::from_raw(self.contents.result) };
3997 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3998 let _ = unsafe { Box::from_raw(self.contents.err) };
4003 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4004 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4005 let contents = if o.result_ok {
4006 let result = unsafe { o.contents.result };
4007 unsafe { o.contents.result = std::ptr::null_mut() };
4008 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4010 let err = unsafe { o.contents.err };
4011 unsafe { o.contents.err = std::ptr::null_mut(); }
4012 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4016 result_ok: o.result_ok,
4020 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4021 fn clone(&self) -> Self {
4023 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4024 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4027 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4028 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4034 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4035 /// but with all dynamically-allocated buffers duplicated in new buffers.
4036 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4038 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4039 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4040 /// A pointer to the contents in the success state.
4041 /// Reading from this pointer when `result_ok` is not set is undefined.
4042 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4043 /// A pointer to the contents in the error state.
4044 /// Reading from this pointer when `result_ok` is set is undefined.
4045 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4048 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4049 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4051 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4052 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4053 /// `err` or `result` depending on the state of `result_ok`.
4054 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4055 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4056 pub result_ok: bool,
4059 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4060 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4061 CResult_SpendableOutputDescriptorDecodeErrorZ {
4062 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4063 result: Box::into_raw(Box::new(o)),
4069 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4070 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4071 CResult_SpendableOutputDescriptorDecodeErrorZ {
4072 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4073 err: Box::into_raw(Box::new(e)),
4078 /// Checks if the given object is currently in the success state
4080 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4084 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4085 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4086 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4087 fn drop(&mut self) {
4089 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4090 let _ = unsafe { Box::from_raw(self.contents.result) };
4093 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4094 let _ = unsafe { Box::from_raw(self.contents.err) };
4099 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4100 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4101 let contents = if o.result_ok {
4102 let result = unsafe { o.contents.result };
4103 unsafe { o.contents.result = std::ptr::null_mut() };
4104 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4106 let err = unsafe { o.contents.err };
4107 unsafe { o.contents.err = std::ptr::null_mut(); }
4108 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4112 result_ok: o.result_ok,
4116 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4117 fn clone(&self) -> Self {
4119 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4120 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4123 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4124 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4130 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4131 /// but with all dynamically-allocated buffers duplicated in new buffers.
4132 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4134 /// The contents of CResult_NoneNoneZ
4135 pub union CResult_NoneNoneZPtr {
4136 /// Note that this value is always NULL, as there are no contents in the OK variant
4137 pub result: *mut std::ffi::c_void,
4138 /// Note that this value is always NULL, as there are no contents in the Err variant
4139 pub err: *mut std::ffi::c_void,
4142 /// A CResult_NoneNoneZ represents the result of a fallible operation,
4143 /// containing a () on success and a () on failure.
4144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4145 pub struct CResult_NoneNoneZ {
4146 /// The contents of this CResult_NoneNoneZ, accessible via either
4147 /// `err` or `result` depending on the state of `result_ok`.
4148 pub contents: CResult_NoneNoneZPtr,
4149 /// Whether this CResult_NoneNoneZ represents a success state.
4150 pub result_ok: bool,
4153 /// Creates a new CResult_NoneNoneZ in the success state.
4154 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
4156 contents: CResult_NoneNoneZPtr {
4157 result: std::ptr::null_mut(),
4163 /// Creates a new CResult_NoneNoneZ in the error state.
4164 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
4166 contents: CResult_NoneNoneZPtr {
4167 err: std::ptr::null_mut(),
4172 /// Checks if the given object is currently in the success state
4174 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
4178 /// Frees any resources used by the CResult_NoneNoneZ.
4179 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
4180 impl Drop for CResult_NoneNoneZ {
4181 fn drop(&mut self) {
4187 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
4188 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
4189 let contents = if o.result_ok {
4190 let _ = unsafe { Box::from_raw(o.contents.result) };
4191 o.contents.result = std::ptr::null_mut();
4192 CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
4194 let _ = unsafe { Box::from_raw(o.contents.err) };
4195 o.contents.err = std::ptr::null_mut();
4196 CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
4200 result_ok: o.result_ok,
4204 impl Clone for CResult_NoneNoneZ {
4205 fn clone(&self) -> Self {
4207 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
4208 result: std::ptr::null_mut()
4211 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
4212 err: std::ptr::null_mut()
4218 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
4219 /// but with all dynamically-allocated buffers duplicated in new buffers.
4220 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
4222 /// A tuple of 2 elements. See the individual fields for the types contained.
4223 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4224 /// The element at position 0
4225 pub a: crate::c_types::Signature,
4226 /// The element at position 1
4227 pub b: crate::c_types::derived::CVec_SignatureZ,
4229 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4230 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4237 impl C2Tuple_SignatureCVec_SignatureZZ {
4238 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4242 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4243 fn clone(&self) -> Self {
4245 a: Clone::clone(&self.a),
4246 b: Clone::clone(&self.b),
4251 /// Creates a new tuple which has the same data as `orig`
4252 /// but with all dynamically-allocated buffers duplicated in new buffers.
4253 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4254 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4256 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4257 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4261 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4262 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4264 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4265 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4266 /// A pointer to the contents in the success state.
4267 /// Reading from this pointer when `result_ok` is not set is undefined.
4268 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4269 /// Note that this value is always NULL, as there are no contents in the Err variant
4270 pub err: *mut std::ffi::c_void,
4273 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4274 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4275 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4276 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4277 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4278 /// `err` or `result` depending on the state of `result_ok`.
4279 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4280 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4281 pub result_ok: bool,
4284 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4285 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4286 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4287 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4288 result: Box::into_raw(Box::new(o)),
4294 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4295 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4296 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4297 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4298 err: std::ptr::null_mut(),
4303 /// Checks if the given object is currently in the success state
4305 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4309 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4310 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4311 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4312 fn drop(&mut self) {
4314 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4315 let _ = unsafe { Box::from_raw(self.contents.result) };
4321 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4322 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4323 let contents = if o.result_ok {
4324 let result = unsafe { o.contents.result };
4325 unsafe { o.contents.result = std::ptr::null_mut() };
4326 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4328 let _ = unsafe { Box::from_raw(o.contents.err) };
4329 o.contents.err = std::ptr::null_mut();
4330 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
4334 result_ok: o.result_ok,
4338 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4339 fn clone(&self) -> Self {
4341 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4342 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4345 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4346 err: std::ptr::null_mut()
4352 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4353 /// but with all dynamically-allocated buffers duplicated in new buffers.
4354 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4356 /// The contents of CResult_SignatureNoneZ
4357 pub union CResult_SignatureNoneZPtr {
4358 /// A pointer to the contents in the success state.
4359 /// Reading from this pointer when `result_ok` is not set is undefined.
4360 pub result: *mut crate::c_types::Signature,
4361 /// Note that this value is always NULL, as there are no contents in the Err variant
4362 pub err: *mut std::ffi::c_void,
4365 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4366 /// containing a crate::c_types::Signature on success and a () on failure.
4367 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4368 pub struct CResult_SignatureNoneZ {
4369 /// The contents of this CResult_SignatureNoneZ, accessible via either
4370 /// `err` or `result` depending on the state of `result_ok`.
4371 pub contents: CResult_SignatureNoneZPtr,
4372 /// Whether this CResult_SignatureNoneZ represents a success state.
4373 pub result_ok: bool,
4376 /// Creates a new CResult_SignatureNoneZ in the success state.
4377 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4378 CResult_SignatureNoneZ {
4379 contents: CResult_SignatureNoneZPtr {
4380 result: Box::into_raw(Box::new(o)),
4386 /// Creates a new CResult_SignatureNoneZ in the error state.
4387 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4388 CResult_SignatureNoneZ {
4389 contents: CResult_SignatureNoneZPtr {
4390 err: std::ptr::null_mut(),
4395 /// Checks if the given object is currently in the success state
4397 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4401 /// Frees any resources used by the CResult_SignatureNoneZ.
4402 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4403 impl Drop for CResult_SignatureNoneZ {
4404 fn drop(&mut self) {
4406 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4407 let _ = unsafe { Box::from_raw(self.contents.result) };
4413 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4414 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4415 let contents = if o.result_ok {
4416 let result = unsafe { o.contents.result };
4417 unsafe { o.contents.result = std::ptr::null_mut() };
4418 CResult_SignatureNoneZPtr { result }
4420 let _ = unsafe { Box::from_raw(o.contents.err) };
4421 o.contents.err = std::ptr::null_mut();
4422 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
4426 result_ok: o.result_ok,
4430 impl Clone for CResult_SignatureNoneZ {
4431 fn clone(&self) -> Self {
4433 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4434 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4437 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4438 err: std::ptr::null_mut()
4444 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4445 /// but with all dynamically-allocated buffers duplicated in new buffers.
4446 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4448 /// The contents of CResult_SignDecodeErrorZ
4449 pub union CResult_SignDecodeErrorZPtr {
4450 /// A pointer to the contents in the success state.
4451 /// Reading from this pointer when `result_ok` is not set is undefined.
4452 pub result: *mut crate::lightning::chain::keysinterface::Sign,
4453 /// A pointer to the contents in the error state.
4454 /// Reading from this pointer when `result_ok` is set is undefined.
4455 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4458 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4459 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4460 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4461 pub struct CResult_SignDecodeErrorZ {
4462 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
4463 /// `err` or `result` depending on the state of `result_ok`.
4464 pub contents: CResult_SignDecodeErrorZPtr,
4465 /// Whether this CResult_SignDecodeErrorZ represents a success state.
4466 pub result_ok: bool,
4469 /// Creates a new CResult_SignDecodeErrorZ in the success state.
4470 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4471 CResult_SignDecodeErrorZ {
4472 contents: CResult_SignDecodeErrorZPtr {
4473 result: Box::into_raw(Box::new(o)),
4479 /// Creates a new CResult_SignDecodeErrorZ in the error state.
4480 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4481 CResult_SignDecodeErrorZ {
4482 contents: CResult_SignDecodeErrorZPtr {
4483 err: Box::into_raw(Box::new(e)),
4488 /// Checks if the given object is currently in the success state
4490 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
4494 /// Frees any resources used by the CResult_SignDecodeErrorZ.
4495 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4496 impl Drop for CResult_SignDecodeErrorZ {
4497 fn drop(&mut self) {
4499 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4500 let _ = unsafe { Box::from_raw(self.contents.result) };
4503 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4504 let _ = unsafe { Box::from_raw(self.contents.err) };
4509 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4510 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
4511 let contents = if o.result_ok {
4512 let result = unsafe { o.contents.result };
4513 unsafe { o.contents.result = std::ptr::null_mut() };
4514 CResult_SignDecodeErrorZPtr { result }
4516 let err = unsafe { o.contents.err };
4517 unsafe { o.contents.err = std::ptr::null_mut(); }
4518 CResult_SignDecodeErrorZPtr { err }
4522 result_ok: o.result_ok,
4526 impl Clone for CResult_SignDecodeErrorZ {
4527 fn clone(&self) -> Self {
4529 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4530 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4533 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4534 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4540 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
4541 /// but with all dynamically-allocated buffers duplicated in new buffers.
4542 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
4544 /// A dynamically-allocated array of u8s of arbitrary size.
4545 /// This corresponds to std::vector in C++
4546 pub struct CVec_u8Z {
4547 /// The elements in the array.
4548 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4550 /// The number of elements pointed to by `data`.
4554 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
4555 if self.datalen == 0 { return Vec::new(); }
4556 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4557 self.data = std::ptr::null_mut();
4561 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
4562 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4565 impl From<Vec<u8>> for CVec_u8Z {
4566 fn from(v: Vec<u8>) -> Self {
4567 let datalen = v.len();
4568 let data = Box::into_raw(v.into_boxed_slice());
4569 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4573 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4574 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
4575 impl Drop for CVec_u8Z {
4576 fn drop(&mut self) {
4577 if self.datalen == 0 { return; }
4578 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4581 impl Clone for CVec_u8Z {
4582 fn clone(&self) -> Self {
4583 let mut res = Vec::new();
4584 if self.datalen == 0 { return Self::from(res); }
4585 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4590 /// The contents of CResult_RecoverableSignatureNoneZ
4591 pub union CResult_RecoverableSignatureNoneZPtr {
4592 /// A pointer to the contents in the success state.
4593 /// Reading from this pointer when `result_ok` is not set is undefined.
4594 pub result: *mut crate::c_types::RecoverableSignature,
4595 /// Note that this value is always NULL, as there are no contents in the Err variant
4596 pub err: *mut std::ffi::c_void,
4599 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4600 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
4601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4602 pub struct CResult_RecoverableSignatureNoneZ {
4603 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4604 /// `err` or `result` depending on the state of `result_ok`.
4605 pub contents: CResult_RecoverableSignatureNoneZPtr,
4606 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4607 pub result_ok: bool,
4610 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4611 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4612 CResult_RecoverableSignatureNoneZ {
4613 contents: CResult_RecoverableSignatureNoneZPtr {
4614 result: Box::into_raw(Box::new(o)),
4620 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4621 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4622 CResult_RecoverableSignatureNoneZ {
4623 contents: CResult_RecoverableSignatureNoneZPtr {
4624 err: std::ptr::null_mut(),
4629 /// Checks if the given object is currently in the success state
4631 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
4635 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4636 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4637 impl Drop for CResult_RecoverableSignatureNoneZ {
4638 fn drop(&mut self) {
4640 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4641 let _ = unsafe { Box::from_raw(self.contents.result) };
4647 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4648 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4649 let contents = if o.result_ok {
4650 let result = unsafe { o.contents.result };
4651 unsafe { o.contents.result = std::ptr::null_mut() };
4652 CResult_RecoverableSignatureNoneZPtr { result }
4654 let _ = unsafe { Box::from_raw(o.contents.err) };
4655 o.contents.err = std::ptr::null_mut();
4656 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
4660 result_ok: o.result_ok,
4664 impl Clone for CResult_RecoverableSignatureNoneZ {
4665 fn clone(&self) -> Self {
4667 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4668 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4671 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4672 err: std::ptr::null_mut()
4678 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4679 /// but with all dynamically-allocated buffers duplicated in new buffers.
4680 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4682 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4683 /// This corresponds to std::vector in C++
4684 pub struct CVec_CVec_u8ZZ {
4685 /// The elements in the array.
4686 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4687 pub data: *mut crate::c_types::derived::CVec_u8Z,
4688 /// The number of elements pointed to by `data`.
4691 impl CVec_CVec_u8ZZ {
4692 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4693 if self.datalen == 0 { return Vec::new(); }
4694 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4695 self.data = std::ptr::null_mut();
4699 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4700 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4703 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4704 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4705 let datalen = v.len();
4706 let data = Box::into_raw(v.into_boxed_slice());
4707 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4711 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4712 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4713 impl Drop for CVec_CVec_u8ZZ {
4714 fn drop(&mut self) {
4715 if self.datalen == 0 { return; }
4716 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4719 impl Clone for CVec_CVec_u8ZZ {
4720 fn clone(&self) -> Self {
4721 let mut res = Vec::new();
4722 if self.datalen == 0 { return Self::from(res); }
4723 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4728 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4729 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4730 /// A pointer to the contents in the success state.
4731 /// Reading from this pointer when `result_ok` is not set is undefined.
4732 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4733 /// Note that this value is always NULL, as there are no contents in the Err variant
4734 pub err: *mut std::ffi::c_void,
4737 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4738 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4739 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4740 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4741 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4742 /// `err` or `result` depending on the state of `result_ok`.
4743 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4744 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4745 pub result_ok: bool,
4748 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4749 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4750 CResult_CVec_CVec_u8ZZNoneZ {
4751 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4752 result: Box::into_raw(Box::new(o)),
4758 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4759 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4760 CResult_CVec_CVec_u8ZZNoneZ {
4761 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4762 err: std::ptr::null_mut(),
4767 /// Checks if the given object is currently in the success state
4769 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
4773 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4774 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4775 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4776 fn drop(&mut self) {
4778 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4779 let _ = unsafe { Box::from_raw(self.contents.result) };
4785 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4786 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4787 let contents = if o.result_ok {
4788 let result = unsafe { o.contents.result };
4789 unsafe { o.contents.result = std::ptr::null_mut() };
4790 CResult_CVec_CVec_u8ZZNoneZPtr { result }
4792 let _ = unsafe { Box::from_raw(o.contents.err) };
4793 o.contents.err = std::ptr::null_mut();
4794 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4798 result_ok: o.result_ok,
4802 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4803 fn clone(&self) -> Self {
4805 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4806 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4809 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4810 err: std::ptr::null_mut()
4816 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4817 /// but with all dynamically-allocated buffers duplicated in new buffers.
4818 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4820 /// The contents of CResult_InMemorySignerDecodeErrorZ
4821 pub union CResult_InMemorySignerDecodeErrorZPtr {
4822 /// A pointer to the contents in the success state.
4823 /// Reading from this pointer when `result_ok` is not set is undefined.
4824 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4825 /// A pointer to the contents in the error state.
4826 /// Reading from this pointer when `result_ok` is set is undefined.
4827 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4830 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4831 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4833 pub struct CResult_InMemorySignerDecodeErrorZ {
4834 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4835 /// `err` or `result` depending on the state of `result_ok`.
4836 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4837 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4838 pub result_ok: bool,
4841 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4842 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4843 CResult_InMemorySignerDecodeErrorZ {
4844 contents: CResult_InMemorySignerDecodeErrorZPtr {
4845 result: Box::into_raw(Box::new(o)),
4851 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4852 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4853 CResult_InMemorySignerDecodeErrorZ {
4854 contents: CResult_InMemorySignerDecodeErrorZPtr {
4855 err: Box::into_raw(Box::new(e)),
4860 /// Checks if the given object is currently in the success state
4862 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
4866 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
4867 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4868 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4869 fn drop(&mut self) {
4871 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4872 let _ = unsafe { Box::from_raw(self.contents.result) };
4875 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4876 let _ = unsafe { Box::from_raw(self.contents.err) };
4881 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
4882 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
4883 let contents = if o.result_ok {
4884 let result = unsafe { o.contents.result };
4885 unsafe { o.contents.result = std::ptr::null_mut() };
4886 CResult_InMemorySignerDecodeErrorZPtr { result }
4888 let err = unsafe { o.contents.err };
4889 unsafe { o.contents.err = std::ptr::null_mut(); }
4890 CResult_InMemorySignerDecodeErrorZPtr { err }
4894 result_ok: o.result_ok,
4898 impl Clone for CResult_InMemorySignerDecodeErrorZ {
4899 fn clone(&self) -> Self {
4901 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
4902 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
4905 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
4906 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4912 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
4913 /// but with all dynamically-allocated buffers duplicated in new buffers.
4914 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
4916 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4917 /// This corresponds to std::vector in C++
4918 pub struct CVec_TxOutZ {
4919 /// The elements in the array.
4920 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4921 pub data: *mut crate::c_types::TxOut,
4922 /// The number of elements pointed to by `data`.
4926 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
4927 if self.datalen == 0 { return Vec::new(); }
4928 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4929 self.data = std::ptr::null_mut();
4933 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
4934 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4937 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
4938 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
4939 let datalen = v.len();
4940 let data = Box::into_raw(v.into_boxed_slice());
4941 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4945 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4946 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
4947 impl Drop for CVec_TxOutZ {
4948 fn drop(&mut self) {
4949 if self.datalen == 0 { return; }
4950 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4953 impl Clone for CVec_TxOutZ {
4954 fn clone(&self) -> Self {
4955 let mut res = Vec::new();
4956 if self.datalen == 0 { return Self::from(res); }
4957 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4962 /// The contents of CResult_TransactionNoneZ
4963 pub union CResult_TransactionNoneZPtr {
4964 /// A pointer to the contents in the success state.
4965 /// Reading from this pointer when `result_ok` is not set is undefined.
4966 pub result: *mut crate::c_types::Transaction,
4967 /// Note that this value is always NULL, as there are no contents in the Err variant
4968 pub err: *mut std::ffi::c_void,
4971 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
4972 /// containing a crate::c_types::Transaction on success and a () on failure.
4973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4974 pub struct CResult_TransactionNoneZ {
4975 /// The contents of this CResult_TransactionNoneZ, accessible via either
4976 /// `err` or `result` depending on the state of `result_ok`.
4977 pub contents: CResult_TransactionNoneZPtr,
4978 /// Whether this CResult_TransactionNoneZ represents a success state.
4979 pub result_ok: bool,
4982 /// Creates a new CResult_TransactionNoneZ in the success state.
4983 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
4984 CResult_TransactionNoneZ {
4985 contents: CResult_TransactionNoneZPtr {
4986 result: Box::into_raw(Box::new(o)),
4992 /// Creates a new CResult_TransactionNoneZ in the error state.
4993 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
4994 CResult_TransactionNoneZ {
4995 contents: CResult_TransactionNoneZPtr {
4996 err: std::ptr::null_mut(),
5001 /// Checks if the given object is currently in the success state
5003 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5007 /// Frees any resources used by the CResult_TransactionNoneZ.
5008 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5009 impl Drop for CResult_TransactionNoneZ {
5010 fn drop(&mut self) {
5012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5013 let _ = unsafe { Box::from_raw(self.contents.result) };
5019 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5020 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5021 let contents = if o.result_ok {
5022 let result = unsafe { o.contents.result };
5023 unsafe { o.contents.result = std::ptr::null_mut() };
5024 CResult_TransactionNoneZPtr { result }
5026 let _ = unsafe { Box::from_raw(o.contents.err) };
5027 o.contents.err = std::ptr::null_mut();
5028 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
5032 result_ok: o.result_ok,
5036 impl Clone for CResult_TransactionNoneZ {
5037 fn clone(&self) -> Self {
5039 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5040 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5043 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5044 err: std::ptr::null_mut()
5050 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5051 /// but with all dynamically-allocated buffers duplicated in new buffers.
5052 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5054 /// A tuple of 2 elements. See the individual fields for the types contained.
5055 pub struct C2Tuple_BlockHashChannelMonitorZ {
5056 /// The element at position 0
5057 pub a: crate::c_types::ThirtyTwoBytes,
5058 /// The element at position 1
5059 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5061 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5062 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5069 impl C2Tuple_BlockHashChannelMonitorZ {
5070 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5074 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5076 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5077 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5081 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5082 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5084 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5085 /// This corresponds to std::vector in C++
5086 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5087 /// The elements in the array.
5088 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5089 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5090 /// The number of elements pointed to by `data`.
5093 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5094 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5095 if self.datalen == 0 { return Vec::new(); }
5096 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5097 self.data = std::ptr::null_mut();
5101 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5102 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5105 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5106 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5107 let datalen = v.len();
5108 let data = Box::into_raw(v.into_boxed_slice());
5109 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5113 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5114 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5115 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5116 fn drop(&mut self) {
5117 if self.datalen == 0 { return; }
5118 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5122 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5123 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5124 /// A pointer to the contents in the success state.
5125 /// Reading from this pointer when `result_ok` is not set is undefined.
5126 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5127 /// A pointer to the contents in the error state.
5128 /// Reading from this pointer when `result_ok` is set is undefined.
5129 pub err: *mut crate::c_types::IOError,
5132 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5133 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5135 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5136 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5137 /// `err` or `result` depending on the state of `result_ok`.
5138 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5139 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5140 pub result_ok: bool,
5143 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5144 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5145 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5146 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5147 result: Box::into_raw(Box::new(o)),
5153 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5154 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5155 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5156 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5157 err: Box::into_raw(Box::new(e)),
5162 /// Checks if the given object is currently in the success state
5164 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5168 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5169 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5170 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5171 fn drop(&mut self) {
5173 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5174 let _ = unsafe { Box::from_raw(self.contents.result) };
5177 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5178 let _ = unsafe { Box::from_raw(self.contents.err) };
5183 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5184 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5185 let contents = if o.result_ok {
5186 let result = unsafe { o.contents.result };
5187 unsafe { o.contents.result = std::ptr::null_mut() };
5188 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5190 let err = unsafe { o.contents.err };
5191 unsafe { o.contents.err = std::ptr::null_mut(); }
5192 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5196 result_ok: o.result_ok,
5202 /// An enum which can either contain a u16 or not
5203 pub enum COption_u16Z {
5204 /// When we're in this state, this COption_u16Z contains a u16
5206 /// When we're in this state, this COption_u16Z contains nothing
5210 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5211 if let Self::Some(_) = self { true } else { false }
5213 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5216 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5217 if let Self::Some(v) = self { v } else { unreachable!() }
5221 /// Constructs a new COption_u16Z containing a u16
5222 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5223 COption_u16Z::Some(o)
5226 /// Constructs a new COption_u16Z containing nothing
5227 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5231 /// Frees any resources associated with the u16, if we are in the Some state
5232 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5234 /// Creates a new COption_u16Z which has the same data as `orig`
5235 /// but with all dynamically-allocated buffers duplicated in new buffers.
5236 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5238 /// The contents of CResult_NoneAPIErrorZ
5239 pub union CResult_NoneAPIErrorZPtr {
5240 /// Note that this value is always NULL, as there are no contents in the OK variant
5241 pub result: *mut std::ffi::c_void,
5242 /// A pointer to the contents in the error state.
5243 /// Reading from this pointer when `result_ok` is set is undefined.
5244 pub err: *mut crate::lightning::util::errors::APIError,
5247 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5248 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
5249 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5250 pub struct CResult_NoneAPIErrorZ {
5251 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
5252 /// `err` or `result` depending on the state of `result_ok`.
5253 pub contents: CResult_NoneAPIErrorZPtr,
5254 /// Whether this CResult_NoneAPIErrorZ represents a success state.
5255 pub result_ok: bool,
5258 /// Creates a new CResult_NoneAPIErrorZ in the success state.
5259 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
5260 CResult_NoneAPIErrorZ {
5261 contents: CResult_NoneAPIErrorZPtr {
5262 result: std::ptr::null_mut(),
5268 /// Creates a new CResult_NoneAPIErrorZ in the error state.
5269 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
5270 CResult_NoneAPIErrorZ {
5271 contents: CResult_NoneAPIErrorZPtr {
5272 err: Box::into_raw(Box::new(e)),
5277 /// Checks if the given object is currently in the success state
5279 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
5283 /// Frees any resources used by the CResult_NoneAPIErrorZ.
5284 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
5285 impl Drop for CResult_NoneAPIErrorZ {
5286 fn drop(&mut self) {
5289 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5290 let _ = unsafe { Box::from_raw(self.contents.err) };
5295 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
5296 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
5297 let contents = if o.result_ok {
5298 let _ = unsafe { Box::from_raw(o.contents.result) };
5299 o.contents.result = std::ptr::null_mut();
5300 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
5302 let err = unsafe { o.contents.err };
5303 unsafe { o.contents.err = std::ptr::null_mut(); }
5304 CResult_NoneAPIErrorZPtr { err }
5308 result_ok: o.result_ok,
5312 impl Clone for CResult_NoneAPIErrorZ {
5313 fn clone(&self) -> Self {
5315 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
5316 result: std::ptr::null_mut()
5319 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
5320 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5326 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
5327 /// but with all dynamically-allocated buffers duplicated in new buffers.
5328 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
5330 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5331 /// This corresponds to std::vector in C++
5332 pub struct CVec_CResult_NoneAPIErrorZZ {
5333 /// The elements in the array.
5334 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5335 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
5336 /// The number of elements pointed to by `data`.
5339 impl CVec_CResult_NoneAPIErrorZZ {
5340 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
5341 if self.datalen == 0 { return Vec::new(); }
5342 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5343 self.data = std::ptr::null_mut();
5347 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
5348 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5351 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
5352 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
5353 let datalen = v.len();
5354 let data = Box::into_raw(v.into_boxed_slice());
5355 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5359 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5360 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
5361 impl Drop for CVec_CResult_NoneAPIErrorZZ {
5362 fn drop(&mut self) {
5363 if self.datalen == 0 { return; }
5364 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5367 impl Clone for CVec_CResult_NoneAPIErrorZZ {
5368 fn clone(&self) -> Self {
5369 let mut res = Vec::new();
5370 if self.datalen == 0 { return Self::from(res); }
5371 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5376 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5377 /// This corresponds to std::vector in C++
5378 pub struct CVec_APIErrorZ {
5379 /// The elements in the array.
5380 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5381 pub data: *mut crate::lightning::util::errors::APIError,
5382 /// The number of elements pointed to by `data`.
5385 impl CVec_APIErrorZ {
5386 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
5387 if self.datalen == 0 { return Vec::new(); }
5388 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5389 self.data = std::ptr::null_mut();
5393 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
5394 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5397 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
5398 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
5399 let datalen = v.len();
5400 let data = Box::into_raw(v.into_boxed_slice());
5401 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5405 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5406 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
5407 impl Drop for CVec_APIErrorZ {
5408 fn drop(&mut self) {
5409 if self.datalen == 0 { return; }
5410 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5413 impl Clone for CVec_APIErrorZ {
5414 fn clone(&self) -> Self {
5415 let mut res = Vec::new();
5416 if self.datalen == 0 { return Self::from(res); }
5417 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5422 /// The contents of CResult__u832APIErrorZ
5423 pub union CResult__u832APIErrorZPtr {
5424 /// A pointer to the contents in the success state.
5425 /// Reading from this pointer when `result_ok` is not set is undefined.
5426 pub result: *mut crate::c_types::ThirtyTwoBytes,
5427 /// A pointer to the contents in the error state.
5428 /// Reading from this pointer when `result_ok` is set is undefined.
5429 pub err: *mut crate::lightning::util::errors::APIError,
5432 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
5433 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5435 pub struct CResult__u832APIErrorZ {
5436 /// The contents of this CResult__u832APIErrorZ, accessible via either
5437 /// `err` or `result` depending on the state of `result_ok`.
5438 pub contents: CResult__u832APIErrorZPtr,
5439 /// Whether this CResult__u832APIErrorZ represents a success state.
5440 pub result_ok: bool,
5443 /// Creates a new CResult__u832APIErrorZ in the success state.
5444 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
5445 CResult__u832APIErrorZ {
5446 contents: CResult__u832APIErrorZPtr {
5447 result: Box::into_raw(Box::new(o)),
5453 /// Creates a new CResult__u832APIErrorZ in the error state.
5454 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
5455 CResult__u832APIErrorZ {
5456 contents: CResult__u832APIErrorZPtr {
5457 err: Box::into_raw(Box::new(e)),
5462 /// Checks if the given object is currently in the success state
5464 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
5468 /// Frees any resources used by the CResult__u832APIErrorZ.
5469 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
5470 impl Drop for CResult__u832APIErrorZ {
5471 fn drop(&mut self) {
5473 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5474 let _ = unsafe { Box::from_raw(self.contents.result) };
5477 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5478 let _ = unsafe { Box::from_raw(self.contents.err) };
5483 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
5484 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5485 let contents = if o.result_ok {
5486 let result = unsafe { o.contents.result };
5487 unsafe { o.contents.result = std::ptr::null_mut() };
5488 CResult__u832APIErrorZPtr { result }
5490 let err = unsafe { o.contents.err };
5491 unsafe { o.contents.err = std::ptr::null_mut(); }
5492 CResult__u832APIErrorZPtr { err }
5496 result_ok: o.result_ok,
5500 impl Clone for CResult__u832APIErrorZ {
5501 fn clone(&self) -> Self {
5503 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
5504 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5507 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
5508 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5514 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
5515 /// but with all dynamically-allocated buffers duplicated in new buffers.
5516 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
5518 /// The contents of CResult_PaymentIdPaymentSendFailureZ
5519 pub union CResult_PaymentIdPaymentSendFailureZPtr {
5520 /// A pointer to the contents in the success state.
5521 /// Reading from this pointer when `result_ok` is not set is undefined.
5522 pub result: *mut crate::c_types::ThirtyTwoBytes,
5523 /// A pointer to the contents in the error state.
5524 /// Reading from this pointer when `result_ok` is set is undefined.
5525 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5528 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5529 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5531 pub struct CResult_PaymentIdPaymentSendFailureZ {
5532 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5533 /// `err` or `result` depending on the state of `result_ok`.
5534 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
5535 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5536 pub result_ok: bool,
5539 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
5540 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
5541 CResult_PaymentIdPaymentSendFailureZ {
5542 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5543 result: Box::into_raw(Box::new(o)),
5549 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
5550 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
5551 CResult_PaymentIdPaymentSendFailureZ {
5552 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5553 err: Box::into_raw(Box::new(e)),
5558 /// Checks if the given object is currently in the success state
5560 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
5564 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
5565 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
5566 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
5567 fn drop(&mut self) {
5569 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5570 let _ = unsafe { Box::from_raw(self.contents.result) };
5573 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5574 let _ = unsafe { Box::from_raw(self.contents.err) };
5579 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
5580 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5581 let contents = if o.result_ok {
5582 let result = unsafe { o.contents.result };
5583 unsafe { o.contents.result = std::ptr::null_mut() };
5584 CResult_PaymentIdPaymentSendFailureZPtr { result }
5586 let err = unsafe { o.contents.err };
5587 unsafe { o.contents.err = std::ptr::null_mut(); }
5588 CResult_PaymentIdPaymentSendFailureZPtr { err }
5592 result_ok: o.result_ok,
5596 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
5597 fn clone(&self) -> Self {
5599 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5600 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5603 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5604 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5610 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
5611 /// but with all dynamically-allocated buffers duplicated in new buffers.
5612 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
5614 /// The contents of CResult_NonePaymentSendFailureZ
5615 pub union CResult_NonePaymentSendFailureZPtr {
5616 /// Note that this value is always NULL, as there are no contents in the OK variant
5617 pub result: *mut std::ffi::c_void,
5618 /// A pointer to the contents in the error state.
5619 /// Reading from this pointer when `result_ok` is set is undefined.
5620 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5623 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5624 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5625 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5626 pub struct CResult_NonePaymentSendFailureZ {
5627 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5628 /// `err` or `result` depending on the state of `result_ok`.
5629 pub contents: CResult_NonePaymentSendFailureZPtr,
5630 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
5631 pub result_ok: bool,
5634 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
5635 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
5636 CResult_NonePaymentSendFailureZ {
5637 contents: CResult_NonePaymentSendFailureZPtr {
5638 result: std::ptr::null_mut(),
5644 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
5645 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
5646 CResult_NonePaymentSendFailureZ {
5647 contents: CResult_NonePaymentSendFailureZPtr {
5648 err: Box::into_raw(Box::new(e)),
5653 /// Checks if the given object is currently in the success state
5655 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
5659 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5660 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5661 impl Drop for CResult_NonePaymentSendFailureZ {
5662 fn drop(&mut self) {
5665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5666 let _ = unsafe { Box::from_raw(self.contents.err) };
5671 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5672 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5673 let contents = if o.result_ok {
5674 let _ = unsafe { Box::from_raw(o.contents.result) };
5675 o.contents.result = std::ptr::null_mut();
5676 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
5678 let err = unsafe { o.contents.err };
5679 unsafe { o.contents.err = std::ptr::null_mut(); }
5680 CResult_NonePaymentSendFailureZPtr { err }
5684 result_ok: o.result_ok,
5688 impl Clone for CResult_NonePaymentSendFailureZ {
5689 fn clone(&self) -> Self {
5691 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5692 result: std::ptr::null_mut()
5695 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5696 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5702 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5703 /// but with all dynamically-allocated buffers duplicated in new buffers.
5704 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5706 /// A tuple of 2 elements. See the individual fields for the types contained.
5707 pub struct C2Tuple_PaymentHashPaymentIdZ {
5708 /// The element at position 0
5709 pub a: crate::c_types::ThirtyTwoBytes,
5710 /// The element at position 1
5711 pub b: crate::c_types::ThirtyTwoBytes,
5713 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5714 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5721 impl C2Tuple_PaymentHashPaymentIdZ {
5722 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5726 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5727 fn clone(&self) -> Self {
5729 a: Clone::clone(&self.a),
5730 b: Clone::clone(&self.b),
5735 /// Creates a new tuple which has the same data as `orig`
5736 /// but with all dynamically-allocated buffers duplicated in new buffers.
5737 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5738 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5740 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5741 C2Tuple_PaymentHashPaymentIdZ { a, b, }
5745 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5746 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5748 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5749 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5750 /// A pointer to the contents in the success state.
5751 /// Reading from this pointer when `result_ok` is not set is undefined.
5752 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5753 /// A pointer to the contents in the error state.
5754 /// Reading from this pointer when `result_ok` is set is undefined.
5755 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5758 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5759 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5761 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5762 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5763 /// `err` or `result` depending on the state of `result_ok`.
5764 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5765 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5766 pub result_ok: bool,
5769 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5770 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5771 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5772 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5773 result: Box::into_raw(Box::new(o)),
5779 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5780 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5781 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5782 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5783 err: Box::into_raw(Box::new(e)),
5788 /// Checks if the given object is currently in the success state
5790 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
5794 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5795 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5796 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5797 fn drop(&mut self) {
5799 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5800 let _ = unsafe { Box::from_raw(self.contents.result) };
5803 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5804 let _ = unsafe { Box::from_raw(self.contents.err) };
5809 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5810 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5811 let contents = if o.result_ok {
5812 let result = unsafe { o.contents.result };
5813 unsafe { o.contents.result = std::ptr::null_mut() };
5814 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5816 let err = unsafe { o.contents.err };
5817 unsafe { o.contents.err = std::ptr::null_mut(); }
5818 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5822 result_ok: o.result_ok,
5826 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5827 fn clone(&self) -> Self {
5829 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5830 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5833 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5834 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5840 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5841 /// but with all dynamically-allocated buffers duplicated in new buffers.
5842 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5844 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5845 /// This corresponds to std::vector in C++
5846 pub struct CVec_NetAddressZ {
5847 /// The elements in the array.
5848 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5849 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5850 /// The number of elements pointed to by `data`.
5853 impl CVec_NetAddressZ {
5854 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5855 if self.datalen == 0 { return Vec::new(); }
5856 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5857 self.data = std::ptr::null_mut();
5861 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5862 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5865 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5866 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5867 let datalen = v.len();
5868 let data = Box::into_raw(v.into_boxed_slice());
5869 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5873 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5874 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5875 impl Drop for CVec_NetAddressZ {
5876 fn drop(&mut self) {
5877 if self.datalen == 0 { return; }
5878 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5881 impl Clone for CVec_NetAddressZ {
5882 fn clone(&self) -> Self {
5883 let mut res = Vec::new();
5884 if self.datalen == 0 { return Self::from(res); }
5885 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5890 /// A tuple of 2 elements. See the individual fields for the types contained.
5891 pub struct C2Tuple_PaymentHashPaymentSecretZ {
5892 /// The element at position 0
5893 pub a: crate::c_types::ThirtyTwoBytes,
5894 /// The element at position 1
5895 pub b: crate::c_types::ThirtyTwoBytes,
5897 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
5898 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5905 impl C2Tuple_PaymentHashPaymentSecretZ {
5906 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5910 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
5911 fn clone(&self) -> Self {
5913 a: Clone::clone(&self.a),
5914 b: Clone::clone(&self.b),
5919 /// Creates a new tuple which has the same data as `orig`
5920 /// but with all dynamically-allocated buffers duplicated in new buffers.
5921 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
5922 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
5924 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
5925 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
5929 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
5930 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
5932 /// The contents of CResult_PaymentSecretAPIErrorZ
5933 pub union CResult_PaymentSecretAPIErrorZPtr {
5934 /// A pointer to the contents in the success state.
5935 /// Reading from this pointer when `result_ok` is not set is undefined.
5936 pub result: *mut crate::c_types::ThirtyTwoBytes,
5937 /// A pointer to the contents in the error state.
5938 /// Reading from this pointer when `result_ok` is set is undefined.
5939 pub err: *mut crate::lightning::util::errors::APIError,
5942 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
5943 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5945 pub struct CResult_PaymentSecretAPIErrorZ {
5946 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
5947 /// `err` or `result` depending on the state of `result_ok`.
5948 pub contents: CResult_PaymentSecretAPIErrorZPtr,
5949 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
5950 pub result_ok: bool,
5953 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
5954 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
5955 CResult_PaymentSecretAPIErrorZ {
5956 contents: CResult_PaymentSecretAPIErrorZPtr {
5957 result: Box::into_raw(Box::new(o)),
5963 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
5964 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
5965 CResult_PaymentSecretAPIErrorZ {
5966 contents: CResult_PaymentSecretAPIErrorZPtr {
5967 err: Box::into_raw(Box::new(e)),
5972 /// Checks if the given object is currently in the success state
5974 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
5978 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
5979 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
5980 impl Drop for CResult_PaymentSecretAPIErrorZ {
5981 fn drop(&mut self) {
5983 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5984 let _ = unsafe { Box::from_raw(self.contents.result) };
5987 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5988 let _ = unsafe { Box::from_raw(self.contents.err) };
5993 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
5994 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5995 let contents = if o.result_ok {
5996 let result = unsafe { o.contents.result };
5997 unsafe { o.contents.result = std::ptr::null_mut() };
5998 CResult_PaymentSecretAPIErrorZPtr { result }
6000 let err = unsafe { o.contents.err };
6001 unsafe { o.contents.err = std::ptr::null_mut(); }
6002 CResult_PaymentSecretAPIErrorZPtr { err }
6006 result_ok: o.result_ok,
6010 impl Clone for CResult_PaymentSecretAPIErrorZ {
6011 fn clone(&self) -> Self {
6013 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
6014 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6017 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
6018 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6024 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
6025 /// but with all dynamically-allocated buffers duplicated in new buffers.
6026 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
6028 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6029 /// This corresponds to std::vector in C++
6030 pub struct CVec_ChannelMonitorZ {
6031 /// The elements in the array.
6032 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6033 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
6034 /// The number of elements pointed to by `data`.
6037 impl CVec_ChannelMonitorZ {
6038 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
6039 if self.datalen == 0 { return Vec::new(); }
6040 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6041 self.data = std::ptr::null_mut();
6045 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
6046 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6049 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
6050 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
6051 let datalen = v.len();
6052 let data = Box::into_raw(v.into_boxed_slice());
6053 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6057 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6058 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
6059 impl Drop for CVec_ChannelMonitorZ {
6060 fn drop(&mut self) {
6061 if self.datalen == 0 { return; }
6062 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6066 /// A tuple of 2 elements. See the individual fields for the types contained.
6067 pub struct C2Tuple_BlockHashChannelManagerZ {
6068 /// The element at position 0
6069 pub a: crate::c_types::ThirtyTwoBytes,
6070 /// The element at position 1
6071 pub b: crate::lightning::ln::channelmanager::ChannelManager,
6073 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
6074 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
6081 impl C2Tuple_BlockHashChannelManagerZ {
6082 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
6086 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
6088 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
6089 C2Tuple_BlockHashChannelManagerZ { a, b, }
6093 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
6094 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
6096 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6097 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6098 /// A pointer to the contents in the success state.
6099 /// Reading from this pointer when `result_ok` is not set is undefined.
6100 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
6101 /// A pointer to the contents in the error state.
6102 /// Reading from this pointer when `result_ok` is set is undefined.
6103 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6106 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6107 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6109 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6110 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6111 /// `err` or `result` depending on the state of `result_ok`.
6112 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
6113 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6114 pub result_ok: bool,
6117 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
6118 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6119 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6120 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6121 result: Box::into_raw(Box::new(o)),
6127 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
6128 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6129 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6130 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6131 err: Box::into_raw(Box::new(e)),
6136 /// Checks if the given object is currently in the success state
6138 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
6142 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
6143 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
6144 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6145 fn drop(&mut self) {
6147 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6148 let _ = unsafe { Box::from_raw(self.contents.result) };
6151 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6152 let _ = unsafe { Box::from_raw(self.contents.err) };
6157 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6158 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6159 let contents = if o.result_ok {
6160 let result = unsafe { o.contents.result };
6161 unsafe { o.contents.result = std::ptr::null_mut() };
6162 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
6164 let err = unsafe { o.contents.err };
6165 unsafe { o.contents.err = std::ptr::null_mut(); }
6166 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
6170 result_ok: o.result_ok,
6175 /// The contents of CResult_ChannelConfigDecodeErrorZ
6176 pub union CResult_ChannelConfigDecodeErrorZPtr {
6177 /// A pointer to the contents in the success state.
6178 /// Reading from this pointer when `result_ok` is not set is undefined.
6179 pub result: *mut crate::lightning::util::config::ChannelConfig,
6180 /// A pointer to the contents in the error state.
6181 /// Reading from this pointer when `result_ok` is set is undefined.
6182 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6185 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6186 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6188 pub struct CResult_ChannelConfigDecodeErrorZ {
6189 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6190 /// `err` or `result` depending on the state of `result_ok`.
6191 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
6192 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6193 pub result_ok: bool,
6196 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
6197 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
6198 CResult_ChannelConfigDecodeErrorZ {
6199 contents: CResult_ChannelConfigDecodeErrorZPtr {
6200 result: Box::into_raw(Box::new(o)),
6206 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
6207 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
6208 CResult_ChannelConfigDecodeErrorZ {
6209 contents: CResult_ChannelConfigDecodeErrorZPtr {
6210 err: Box::into_raw(Box::new(e)),
6215 /// Checks if the given object is currently in the success state
6217 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
6221 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
6222 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
6223 impl Drop for CResult_ChannelConfigDecodeErrorZ {
6224 fn drop(&mut self) {
6226 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6227 let _ = unsafe { Box::from_raw(self.contents.result) };
6230 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6231 let _ = unsafe { Box::from_raw(self.contents.err) };
6236 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
6237 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
6238 let contents = if o.result_ok {
6239 let result = unsafe { o.contents.result };
6240 unsafe { o.contents.result = std::ptr::null_mut() };
6241 CResult_ChannelConfigDecodeErrorZPtr { result }
6243 let err = unsafe { o.contents.err };
6244 unsafe { o.contents.err = std::ptr::null_mut(); }
6245 CResult_ChannelConfigDecodeErrorZPtr { err }
6249 result_ok: o.result_ok,
6253 impl Clone for CResult_ChannelConfigDecodeErrorZ {
6254 fn clone(&self) -> Self {
6256 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
6257 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
6260 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
6261 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6267 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
6268 /// but with all dynamically-allocated buffers duplicated in new buffers.
6269 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
6271 /// The contents of CResult_OutPointDecodeErrorZ
6272 pub union CResult_OutPointDecodeErrorZPtr {
6273 /// A pointer to the contents in the success state.
6274 /// Reading from this pointer when `result_ok` is not set is undefined.
6275 pub result: *mut crate::lightning::chain::transaction::OutPoint,
6276 /// A pointer to the contents in the error state.
6277 /// Reading from this pointer when `result_ok` is set is undefined.
6278 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6281 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6282 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6284 pub struct CResult_OutPointDecodeErrorZ {
6285 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6286 /// `err` or `result` depending on the state of `result_ok`.
6287 pub contents: CResult_OutPointDecodeErrorZPtr,
6288 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
6289 pub result_ok: bool,
6292 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
6293 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
6294 CResult_OutPointDecodeErrorZ {
6295 contents: CResult_OutPointDecodeErrorZPtr {
6296 result: Box::into_raw(Box::new(o)),
6302 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
6303 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
6304 CResult_OutPointDecodeErrorZ {
6305 contents: CResult_OutPointDecodeErrorZPtr {
6306 err: Box::into_raw(Box::new(e)),
6311 /// Checks if the given object is currently in the success state
6313 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
6317 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
6318 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
6319 impl Drop for CResult_OutPointDecodeErrorZ {
6320 fn drop(&mut self) {
6322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6323 let _ = unsafe { Box::from_raw(self.contents.result) };
6326 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6327 let _ = unsafe { Box::from_raw(self.contents.err) };
6332 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
6333 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
6334 let contents = if o.result_ok {
6335 let result = unsafe { o.contents.result };
6336 unsafe { o.contents.result = std::ptr::null_mut() };
6337 CResult_OutPointDecodeErrorZPtr { result }
6339 let err = unsafe { o.contents.err };
6340 unsafe { o.contents.err = std::ptr::null_mut(); }
6341 CResult_OutPointDecodeErrorZPtr { err }
6345 result_ok: o.result_ok,
6349 impl Clone for CResult_OutPointDecodeErrorZ {
6350 fn clone(&self) -> Self {
6352 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
6353 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
6356 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
6357 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6363 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
6364 /// but with all dynamically-allocated buffers duplicated in new buffers.
6365 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
6367 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
6368 pub enum COption_TypeZ {
6369 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
6370 Some(crate::lightning::ln::wire::Type),
6371 /// When we're in this state, this COption_TypeZ contains nothing
6374 impl COption_TypeZ {
6375 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6376 if let Self::Some(_) = self { true } else { false }
6378 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6381 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
6382 if let Self::Some(v) = self { v } else { unreachable!() }
6386 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
6387 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
6388 COption_TypeZ::Some(o)
6391 /// Constructs a new COption_TypeZ containing nothing
6392 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
6396 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
6397 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
6399 /// The contents of CResult_COption_TypeZDecodeErrorZ
6400 pub union CResult_COption_TypeZDecodeErrorZPtr {
6401 /// A pointer to the contents in the success state.
6402 /// Reading from this pointer when `result_ok` is not set is undefined.
6403 pub result: *mut crate::c_types::derived::COption_TypeZ,
6404 /// A pointer to the contents in the error state.
6405 /// Reading from this pointer when `result_ok` is set is undefined.
6406 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6409 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6410 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6411 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6412 pub struct CResult_COption_TypeZDecodeErrorZ {
6413 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6414 /// `err` or `result` depending on the state of `result_ok`.
6415 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
6416 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6417 pub result_ok: bool,
6420 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
6421 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
6422 CResult_COption_TypeZDecodeErrorZ {
6423 contents: CResult_COption_TypeZDecodeErrorZPtr {
6424 result: Box::into_raw(Box::new(o)),
6430 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
6431 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
6432 CResult_COption_TypeZDecodeErrorZ {
6433 contents: CResult_COption_TypeZDecodeErrorZPtr {
6434 err: Box::into_raw(Box::new(e)),
6439 /// Checks if the given object is currently in the success state
6441 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
6445 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
6446 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
6447 impl Drop for CResult_COption_TypeZDecodeErrorZ {
6448 fn drop(&mut self) {
6450 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6451 let _ = unsafe { Box::from_raw(self.contents.result) };
6454 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6455 let _ = unsafe { Box::from_raw(self.contents.err) };
6460 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
6461 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6462 let contents = if o.result_ok {
6463 let result = unsafe { o.contents.result };
6464 unsafe { o.contents.result = std::ptr::null_mut() };
6465 CResult_COption_TypeZDecodeErrorZPtr { result }
6467 let err = unsafe { o.contents.err };
6468 unsafe { o.contents.err = std::ptr::null_mut(); }
6469 CResult_COption_TypeZDecodeErrorZPtr { err }
6473 result_ok: o.result_ok,
6478 /// The contents of CResult_PaymentIdPaymentErrorZ
6479 pub union CResult_PaymentIdPaymentErrorZPtr {
6480 /// A pointer to the contents in the success state.
6481 /// Reading from this pointer when `result_ok` is not set is undefined.
6482 pub result: *mut crate::c_types::ThirtyTwoBytes,
6483 /// A pointer to the contents in the error state.
6484 /// Reading from this pointer when `result_ok` is set is undefined.
6485 pub err: *mut crate::lightning_invoice::payment::PaymentError,
6488 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
6489 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
6490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6491 pub struct CResult_PaymentIdPaymentErrorZ {
6492 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
6493 /// `err` or `result` depending on the state of `result_ok`.
6494 pub contents: CResult_PaymentIdPaymentErrorZPtr,
6495 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
6496 pub result_ok: bool,
6499 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
6500 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
6501 CResult_PaymentIdPaymentErrorZ {
6502 contents: CResult_PaymentIdPaymentErrorZPtr {
6503 result: Box::into_raw(Box::new(o)),
6509 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
6510 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
6511 CResult_PaymentIdPaymentErrorZ {
6512 contents: CResult_PaymentIdPaymentErrorZPtr {
6513 err: Box::into_raw(Box::new(e)),
6518 /// Checks if the given object is currently in the success state
6520 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
6524 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
6525 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
6526 impl Drop for CResult_PaymentIdPaymentErrorZ {
6527 fn drop(&mut self) {
6529 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6530 let _ = unsafe { Box::from_raw(self.contents.result) };
6533 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6534 let _ = unsafe { Box::from_raw(self.contents.err) };
6539 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
6540 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
6541 let contents = if o.result_ok {
6542 let result = unsafe { o.contents.result };
6543 unsafe { o.contents.result = std::ptr::null_mut() };
6544 CResult_PaymentIdPaymentErrorZPtr { result }
6546 let err = unsafe { o.contents.err };
6547 unsafe { o.contents.err = std::ptr::null_mut(); }
6548 CResult_PaymentIdPaymentErrorZPtr { err }
6552 result_ok: o.result_ok,
6556 impl Clone for CResult_PaymentIdPaymentErrorZ {
6557 fn clone(&self) -> Self {
6559 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
6560 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6563 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
6564 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
6570 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
6571 /// but with all dynamically-allocated buffers duplicated in new buffers.
6572 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
6574 /// The contents of CResult_SiPrefixNoneZ
6575 pub union CResult_SiPrefixNoneZPtr {
6576 /// A pointer to the contents in the success state.
6577 /// Reading from this pointer when `result_ok` is not set is undefined.
6578 pub result: *mut crate::lightning_invoice::SiPrefix,
6579 /// Note that this value is always NULL, as there are no contents in the Err variant
6580 pub err: *mut std::ffi::c_void,
6583 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
6584 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
6585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6586 pub struct CResult_SiPrefixNoneZ {
6587 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
6588 /// `err` or `result` depending on the state of `result_ok`.
6589 pub contents: CResult_SiPrefixNoneZPtr,
6590 /// Whether this CResult_SiPrefixNoneZ represents a success state.
6591 pub result_ok: bool,
6594 /// Creates a new CResult_SiPrefixNoneZ in the success state.
6595 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
6596 CResult_SiPrefixNoneZ {
6597 contents: CResult_SiPrefixNoneZPtr {
6598 result: Box::into_raw(Box::new(o)),
6604 /// Creates a new CResult_SiPrefixNoneZ in the error state.
6605 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
6606 CResult_SiPrefixNoneZ {
6607 contents: CResult_SiPrefixNoneZPtr {
6608 err: std::ptr::null_mut(),
6613 /// Checks if the given object is currently in the success state
6615 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
6619 /// Frees any resources used by the CResult_SiPrefixNoneZ.
6620 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
6621 impl Drop for CResult_SiPrefixNoneZ {
6622 fn drop(&mut self) {
6624 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6625 let _ = unsafe { Box::from_raw(self.contents.result) };
6631 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
6632 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
6633 let contents = if o.result_ok {
6634 let result = unsafe { o.contents.result };
6635 unsafe { o.contents.result = std::ptr::null_mut() };
6636 CResult_SiPrefixNoneZPtr { result }
6638 let _ = unsafe { Box::from_raw(o.contents.err) };
6639 o.contents.err = std::ptr::null_mut();
6640 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
6644 result_ok: o.result_ok,
6648 impl Clone for CResult_SiPrefixNoneZ {
6649 fn clone(&self) -> Self {
6651 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
6652 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
6655 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
6656 err: std::ptr::null_mut()
6662 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
6663 /// but with all dynamically-allocated buffers duplicated in new buffers.
6664 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
6666 /// The contents of CResult_InvoiceNoneZ
6667 pub union CResult_InvoiceNoneZPtr {
6668 /// A pointer to the contents in the success state.
6669 /// Reading from this pointer when `result_ok` is not set is undefined.
6670 pub result: *mut crate::lightning_invoice::Invoice,
6671 /// Note that this value is always NULL, as there are no contents in the Err variant
6672 pub err: *mut std::ffi::c_void,
6675 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
6676 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
6677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6678 pub struct CResult_InvoiceNoneZ {
6679 /// The contents of this CResult_InvoiceNoneZ, accessible via either
6680 /// `err` or `result` depending on the state of `result_ok`.
6681 pub contents: CResult_InvoiceNoneZPtr,
6682 /// Whether this CResult_InvoiceNoneZ represents a success state.
6683 pub result_ok: bool,
6686 /// Creates a new CResult_InvoiceNoneZ in the success state.
6687 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
6688 CResult_InvoiceNoneZ {
6689 contents: CResult_InvoiceNoneZPtr {
6690 result: Box::into_raw(Box::new(o)),
6696 /// Creates a new CResult_InvoiceNoneZ in the error state.
6697 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
6698 CResult_InvoiceNoneZ {
6699 contents: CResult_InvoiceNoneZPtr {
6700 err: std::ptr::null_mut(),
6705 /// Checks if the given object is currently in the success state
6707 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
6711 /// Frees any resources used by the CResult_InvoiceNoneZ.
6712 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
6713 impl Drop for CResult_InvoiceNoneZ {
6714 fn drop(&mut self) {
6716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6717 let _ = unsafe { Box::from_raw(self.contents.result) };
6723 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
6724 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
6725 let contents = if o.result_ok {
6726 let result = unsafe { o.contents.result };
6727 unsafe { o.contents.result = std::ptr::null_mut() };
6728 CResult_InvoiceNoneZPtr { result }
6730 let _ = unsafe { Box::from_raw(o.contents.err) };
6731 o.contents.err = std::ptr::null_mut();
6732 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
6736 result_ok: o.result_ok,
6740 impl Clone for CResult_InvoiceNoneZ {
6741 fn clone(&self) -> Self {
6743 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
6744 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6747 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
6748 err: std::ptr::null_mut()
6754 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
6755 /// but with all dynamically-allocated buffers duplicated in new buffers.
6756 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
6758 /// The contents of CResult_SignedRawInvoiceNoneZ
6759 pub union CResult_SignedRawInvoiceNoneZPtr {
6760 /// A pointer to the contents in the success state.
6761 /// Reading from this pointer when `result_ok` is not set is undefined.
6762 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
6763 /// Note that this value is always NULL, as there are no contents in the Err variant
6764 pub err: *mut std::ffi::c_void,
6767 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
6768 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
6769 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6770 pub struct CResult_SignedRawInvoiceNoneZ {
6771 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
6772 /// `err` or `result` depending on the state of `result_ok`.
6773 pub contents: CResult_SignedRawInvoiceNoneZPtr,
6774 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
6775 pub result_ok: bool,
6778 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
6779 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
6780 CResult_SignedRawInvoiceNoneZ {
6781 contents: CResult_SignedRawInvoiceNoneZPtr {
6782 result: Box::into_raw(Box::new(o)),
6788 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
6789 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
6790 CResult_SignedRawInvoiceNoneZ {
6791 contents: CResult_SignedRawInvoiceNoneZPtr {
6792 err: std::ptr::null_mut(),
6797 /// Checks if the given object is currently in the success state
6799 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
6803 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
6804 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
6805 impl Drop for CResult_SignedRawInvoiceNoneZ {
6806 fn drop(&mut self) {
6808 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6809 let _ = unsafe { Box::from_raw(self.contents.result) };
6815 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
6816 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
6817 let contents = if o.result_ok {
6818 let result = unsafe { o.contents.result };
6819 unsafe { o.contents.result = std::ptr::null_mut() };
6820 CResult_SignedRawInvoiceNoneZPtr { result }
6822 let _ = unsafe { Box::from_raw(o.contents.err) };
6823 o.contents.err = std::ptr::null_mut();
6824 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
6828 result_ok: o.result_ok,
6832 impl Clone for CResult_SignedRawInvoiceNoneZ {
6833 fn clone(&self) -> Self {
6835 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
6836 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
6839 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
6840 err: std::ptr::null_mut()
6846 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
6847 /// but with all dynamically-allocated buffers duplicated in new buffers.
6848 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
6850 /// A tuple of 3 elements. See the individual fields for the types contained.
6851 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6852 /// The element at position 0
6853 pub a: crate::lightning_invoice::RawInvoice,
6854 /// The element at position 1
6855 pub b: crate::c_types::ThirtyTwoBytes,
6856 /// The element at position 2
6857 pub c: crate::lightning_invoice::InvoiceSignature,
6859 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6860 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
6868 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6869 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
6870 (self.a, self.b, self.c)
6873 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6874 fn clone(&self) -> Self {
6876 a: Clone::clone(&self.a),
6877 b: Clone::clone(&self.b),
6878 c: Clone::clone(&self.c),
6883 /// Creates a new tuple which has the same data as `orig`
6884 /// but with all dynamically-allocated buffers duplicated in new buffers.
6885 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
6886 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
6888 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 {
6889 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
6893 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
6894 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
6896 /// The contents of CResult_PayeePubKeyErrorZ
6897 pub union CResult_PayeePubKeyErrorZPtr {
6898 /// A pointer to the contents in the success state.
6899 /// Reading from this pointer when `result_ok` is not set is undefined.
6900 pub result: *mut crate::lightning_invoice::PayeePubKey,
6901 /// A pointer to the contents in the error state.
6902 /// Reading from this pointer when `result_ok` is set is undefined.
6903 pub err: *mut crate::c_types::Secp256k1Error,
6906 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
6907 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
6908 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6909 pub struct CResult_PayeePubKeyErrorZ {
6910 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
6911 /// `err` or `result` depending on the state of `result_ok`.
6912 pub contents: CResult_PayeePubKeyErrorZPtr,
6913 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
6914 pub result_ok: bool,
6917 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
6918 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
6919 CResult_PayeePubKeyErrorZ {
6920 contents: CResult_PayeePubKeyErrorZPtr {
6921 result: Box::into_raw(Box::new(o)),
6927 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
6928 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
6929 CResult_PayeePubKeyErrorZ {
6930 contents: CResult_PayeePubKeyErrorZPtr {
6931 err: Box::into_raw(Box::new(e)),
6936 /// Checks if the given object is currently in the success state
6938 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
6942 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
6943 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
6944 impl Drop for CResult_PayeePubKeyErrorZ {
6945 fn drop(&mut self) {
6947 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6948 let _ = unsafe { Box::from_raw(self.contents.result) };
6951 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6952 let _ = unsafe { Box::from_raw(self.contents.err) };
6957 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
6958 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
6959 let contents = if o.result_ok {
6960 let result = unsafe { o.contents.result };
6961 unsafe { o.contents.result = std::ptr::null_mut() };
6962 CResult_PayeePubKeyErrorZPtr { result }
6964 let err = unsafe { o.contents.err };
6965 unsafe { o.contents.err = std::ptr::null_mut(); }
6966 CResult_PayeePubKeyErrorZPtr { err }
6970 result_ok: o.result_ok,
6974 impl Clone for CResult_PayeePubKeyErrorZ {
6975 fn clone(&self) -> Self {
6977 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
6978 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
6981 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
6982 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6988 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
6989 /// but with all dynamically-allocated buffers duplicated in new buffers.
6990 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
6992 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
6993 /// This corresponds to std::vector in C++
6994 pub struct CVec_PrivateRouteZ {
6995 /// The elements in the array.
6996 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6997 pub data: *mut crate::lightning_invoice::PrivateRoute,
6998 /// The number of elements pointed to by `data`.
7001 impl CVec_PrivateRouteZ {
7002 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
7003 if self.datalen == 0 { return Vec::new(); }
7004 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7005 self.data = std::ptr::null_mut();
7009 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
7010 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7013 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
7014 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
7015 let datalen = v.len();
7016 let data = Box::into_raw(v.into_boxed_slice());
7017 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7021 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7022 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
7023 impl Drop for CVec_PrivateRouteZ {
7024 fn drop(&mut self) {
7025 if self.datalen == 0 { return; }
7026 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7029 impl Clone for CVec_PrivateRouteZ {
7030 fn clone(&self) -> Self {
7031 let mut res = Vec::new();
7032 if self.datalen == 0 { return Self::from(res); }
7033 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7038 /// The contents of CResult_PositiveTimestampCreationErrorZ
7039 pub union CResult_PositiveTimestampCreationErrorZPtr {
7040 /// A pointer to the contents in the success state.
7041 /// Reading from this pointer when `result_ok` is not set is undefined.
7042 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
7043 /// A pointer to the contents in the error state.
7044 /// Reading from this pointer when `result_ok` is set is undefined.
7045 pub err: *mut crate::lightning_invoice::CreationError,
7048 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7049 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7051 pub struct CResult_PositiveTimestampCreationErrorZ {
7052 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7053 /// `err` or `result` depending on the state of `result_ok`.
7054 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
7055 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7056 pub result_ok: bool,
7059 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
7060 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
7061 CResult_PositiveTimestampCreationErrorZ {
7062 contents: CResult_PositiveTimestampCreationErrorZPtr {
7063 result: Box::into_raw(Box::new(o)),
7069 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
7070 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
7071 CResult_PositiveTimestampCreationErrorZ {
7072 contents: CResult_PositiveTimestampCreationErrorZPtr {
7073 err: Box::into_raw(Box::new(e)),
7078 /// Checks if the given object is currently in the success state
7080 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
7084 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
7085 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
7086 impl Drop for CResult_PositiveTimestampCreationErrorZ {
7087 fn drop(&mut self) {
7089 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7090 let _ = unsafe { Box::from_raw(self.contents.result) };
7093 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7094 let _ = unsafe { Box::from_raw(self.contents.err) };
7099 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
7100 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
7101 let contents = if o.result_ok {
7102 let result = unsafe { o.contents.result };
7103 unsafe { o.contents.result = std::ptr::null_mut() };
7104 CResult_PositiveTimestampCreationErrorZPtr { result }
7106 let err = unsafe { o.contents.err };
7107 unsafe { o.contents.err = std::ptr::null_mut(); }
7108 CResult_PositiveTimestampCreationErrorZPtr { err }
7112 result_ok: o.result_ok,
7116 impl Clone for CResult_PositiveTimestampCreationErrorZ {
7117 fn clone(&self) -> Self {
7119 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
7120 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
7123 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
7124 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7130 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
7131 /// but with all dynamically-allocated buffers duplicated in new buffers.
7132 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
7134 /// The contents of CResult_NoneSemanticErrorZ
7135 pub union CResult_NoneSemanticErrorZPtr {
7136 /// Note that this value is always NULL, as there are no contents in the OK variant
7137 pub result: *mut std::ffi::c_void,
7138 /// A pointer to the contents in the error state.
7139 /// Reading from this pointer when `result_ok` is set is undefined.
7140 pub err: *mut crate::lightning_invoice::SemanticError,
7143 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7144 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7146 pub struct CResult_NoneSemanticErrorZ {
7147 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
7148 /// `err` or `result` depending on the state of `result_ok`.
7149 pub contents: CResult_NoneSemanticErrorZPtr,
7150 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
7151 pub result_ok: bool,
7154 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
7155 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
7156 CResult_NoneSemanticErrorZ {
7157 contents: CResult_NoneSemanticErrorZPtr {
7158 result: std::ptr::null_mut(),
7164 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
7165 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
7166 CResult_NoneSemanticErrorZ {
7167 contents: CResult_NoneSemanticErrorZPtr {
7168 err: Box::into_raw(Box::new(e)),
7173 /// Checks if the given object is currently in the success state
7175 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
7179 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
7180 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
7181 impl Drop for CResult_NoneSemanticErrorZ {
7182 fn drop(&mut self) {
7185 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7186 let _ = unsafe { Box::from_raw(self.contents.err) };
7191 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
7192 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
7193 let contents = if o.result_ok {
7194 let _ = unsafe { Box::from_raw(o.contents.result) };
7195 o.contents.result = std::ptr::null_mut();
7196 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
7198 let err = unsafe { o.contents.err };
7199 unsafe { o.contents.err = std::ptr::null_mut(); }
7200 CResult_NoneSemanticErrorZPtr { err }
7204 result_ok: o.result_ok,
7208 impl Clone for CResult_NoneSemanticErrorZ {
7209 fn clone(&self) -> Self {
7211 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
7212 result: std::ptr::null_mut()
7215 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
7216 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7222 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
7223 /// but with all dynamically-allocated buffers duplicated in new buffers.
7224 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
7226 /// The contents of CResult_InvoiceSemanticErrorZ
7227 pub union CResult_InvoiceSemanticErrorZPtr {
7228 /// A pointer to the contents in the success state.
7229 /// Reading from this pointer when `result_ok` is not set is undefined.
7230 pub result: *mut crate::lightning_invoice::Invoice,
7231 /// A pointer to the contents in the error state.
7232 /// Reading from this pointer when `result_ok` is set is undefined.
7233 pub err: *mut crate::lightning_invoice::SemanticError,
7236 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7237 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7239 pub struct CResult_InvoiceSemanticErrorZ {
7240 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7241 /// `err` or `result` depending on the state of `result_ok`.
7242 pub contents: CResult_InvoiceSemanticErrorZPtr,
7243 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7244 pub result_ok: bool,
7247 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
7248 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
7249 CResult_InvoiceSemanticErrorZ {
7250 contents: CResult_InvoiceSemanticErrorZPtr {
7251 result: Box::into_raw(Box::new(o)),
7257 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
7258 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
7259 CResult_InvoiceSemanticErrorZ {
7260 contents: CResult_InvoiceSemanticErrorZPtr {
7261 err: Box::into_raw(Box::new(e)),
7266 /// Checks if the given object is currently in the success state
7268 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
7272 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
7273 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
7274 impl Drop for CResult_InvoiceSemanticErrorZ {
7275 fn drop(&mut self) {
7277 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7278 let _ = unsafe { Box::from_raw(self.contents.result) };
7281 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7282 let _ = unsafe { Box::from_raw(self.contents.err) };
7287 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
7288 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
7289 let contents = if o.result_ok {
7290 let result = unsafe { o.contents.result };
7291 unsafe { o.contents.result = std::ptr::null_mut() };
7292 CResult_InvoiceSemanticErrorZPtr { result }
7294 let err = unsafe { o.contents.err };
7295 unsafe { o.contents.err = std::ptr::null_mut(); }
7296 CResult_InvoiceSemanticErrorZPtr { err }
7300 result_ok: o.result_ok,
7304 impl Clone for CResult_InvoiceSemanticErrorZ {
7305 fn clone(&self) -> Self {
7307 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
7308 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7311 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
7312 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7318 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
7319 /// but with all dynamically-allocated buffers duplicated in new buffers.
7320 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
7322 /// The contents of CResult_DescriptionCreationErrorZ
7323 pub union CResult_DescriptionCreationErrorZPtr {
7324 /// A pointer to the contents in the success state.
7325 /// Reading from this pointer when `result_ok` is not set is undefined.
7326 pub result: *mut crate::lightning_invoice::Description,
7327 /// A pointer to the contents in the error state.
7328 /// Reading from this pointer when `result_ok` is set is undefined.
7329 pub err: *mut crate::lightning_invoice::CreationError,
7332 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7333 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7335 pub struct CResult_DescriptionCreationErrorZ {
7336 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7337 /// `err` or `result` depending on the state of `result_ok`.
7338 pub contents: CResult_DescriptionCreationErrorZPtr,
7339 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
7340 pub result_ok: bool,
7343 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
7344 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
7345 CResult_DescriptionCreationErrorZ {
7346 contents: CResult_DescriptionCreationErrorZPtr {
7347 result: Box::into_raw(Box::new(o)),
7353 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
7354 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
7355 CResult_DescriptionCreationErrorZ {
7356 contents: CResult_DescriptionCreationErrorZPtr {
7357 err: Box::into_raw(Box::new(e)),
7362 /// Checks if the given object is currently in the success state
7364 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
7368 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
7369 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
7370 impl Drop for CResult_DescriptionCreationErrorZ {
7371 fn drop(&mut self) {
7373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7374 let _ = unsafe { Box::from_raw(self.contents.result) };
7377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7378 let _ = unsafe { Box::from_raw(self.contents.err) };
7383 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
7384 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
7385 let contents = if o.result_ok {
7386 let result = unsafe { o.contents.result };
7387 unsafe { o.contents.result = std::ptr::null_mut() };
7388 CResult_DescriptionCreationErrorZPtr { result }
7390 let err = unsafe { o.contents.err };
7391 unsafe { o.contents.err = std::ptr::null_mut(); }
7392 CResult_DescriptionCreationErrorZPtr { err }
7396 result_ok: o.result_ok,
7400 impl Clone for CResult_DescriptionCreationErrorZ {
7401 fn clone(&self) -> Self {
7403 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
7404 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
7407 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
7408 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7414 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
7415 /// but with all dynamically-allocated buffers duplicated in new buffers.
7416 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
7418 /// The contents of CResult_ExpiryTimeCreationErrorZ
7419 pub union CResult_ExpiryTimeCreationErrorZPtr {
7420 /// A pointer to the contents in the success state.
7421 /// Reading from this pointer when `result_ok` is not set is undefined.
7422 pub result: *mut crate::lightning_invoice::ExpiryTime,
7423 /// A pointer to the contents in the error state.
7424 /// Reading from this pointer when `result_ok` is set is undefined.
7425 pub err: *mut crate::lightning_invoice::CreationError,
7428 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
7429 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
7430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7431 pub struct CResult_ExpiryTimeCreationErrorZ {
7432 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
7433 /// `err` or `result` depending on the state of `result_ok`.
7434 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
7435 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
7436 pub result_ok: bool,
7439 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
7440 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
7441 CResult_ExpiryTimeCreationErrorZ {
7442 contents: CResult_ExpiryTimeCreationErrorZPtr {
7443 result: Box::into_raw(Box::new(o)),
7449 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
7450 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
7451 CResult_ExpiryTimeCreationErrorZ {
7452 contents: CResult_ExpiryTimeCreationErrorZPtr {
7453 err: Box::into_raw(Box::new(e)),
7458 /// Checks if the given object is currently in the success state
7460 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_is_ok(o: &CResult_ExpiryTimeCreationErrorZ) -> bool {
7464 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
7465 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
7466 impl Drop for CResult_ExpiryTimeCreationErrorZ {
7467 fn drop(&mut self) {
7469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7470 let _ = unsafe { Box::from_raw(self.contents.result) };
7473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7474 let _ = unsafe { Box::from_raw(self.contents.err) };
7479 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
7480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
7481 let contents = if o.result_ok {
7482 let result = unsafe { o.contents.result };
7483 unsafe { o.contents.result = std::ptr::null_mut() };
7484 CResult_ExpiryTimeCreationErrorZPtr { result }
7486 let err = unsafe { o.contents.err };
7487 unsafe { o.contents.err = std::ptr::null_mut(); }
7488 CResult_ExpiryTimeCreationErrorZPtr { err }
7492 result_ok: o.result_ok,
7496 impl Clone for CResult_ExpiryTimeCreationErrorZ {
7497 fn clone(&self) -> Self {
7499 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
7500 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
7503 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
7504 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7510 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
7511 /// but with all dynamically-allocated buffers duplicated in new buffers.
7512 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
7514 /// The contents of CResult_PrivateRouteCreationErrorZ
7515 pub union CResult_PrivateRouteCreationErrorZPtr {
7516 /// A pointer to the contents in the success state.
7517 /// Reading from this pointer when `result_ok` is not set is undefined.
7518 pub result: *mut crate::lightning_invoice::PrivateRoute,
7519 /// A pointer to the contents in the error state.
7520 /// Reading from this pointer when `result_ok` is set is undefined.
7521 pub err: *mut crate::lightning_invoice::CreationError,
7524 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
7525 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
7526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7527 pub struct CResult_PrivateRouteCreationErrorZ {
7528 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
7529 /// `err` or `result` depending on the state of `result_ok`.
7530 pub contents: CResult_PrivateRouteCreationErrorZPtr,
7531 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
7532 pub result_ok: bool,
7535 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
7536 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
7537 CResult_PrivateRouteCreationErrorZ {
7538 contents: CResult_PrivateRouteCreationErrorZPtr {
7539 result: Box::into_raw(Box::new(o)),
7545 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
7546 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
7547 CResult_PrivateRouteCreationErrorZ {
7548 contents: CResult_PrivateRouteCreationErrorZPtr {
7549 err: Box::into_raw(Box::new(e)),
7554 /// Checks if the given object is currently in the success state
7556 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
7560 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
7561 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
7562 impl Drop for CResult_PrivateRouteCreationErrorZ {
7563 fn drop(&mut self) {
7565 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7566 let _ = unsafe { Box::from_raw(self.contents.result) };
7569 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7570 let _ = unsafe { Box::from_raw(self.contents.err) };
7575 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
7576 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
7577 let contents = if o.result_ok {
7578 let result = unsafe { o.contents.result };
7579 unsafe { o.contents.result = std::ptr::null_mut() };
7580 CResult_PrivateRouteCreationErrorZPtr { result }
7582 let err = unsafe { o.contents.err };
7583 unsafe { o.contents.err = std::ptr::null_mut(); }
7584 CResult_PrivateRouteCreationErrorZPtr { err }
7588 result_ok: o.result_ok,
7592 impl Clone for CResult_PrivateRouteCreationErrorZ {
7593 fn clone(&self) -> Self {
7595 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
7596 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
7599 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
7600 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7606 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
7607 /// but with all dynamically-allocated buffers duplicated in new buffers.
7608 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
7610 /// The contents of CResult_StringErrorZ
7611 pub union CResult_StringErrorZPtr {
7612 /// A pointer to the contents in the success state.
7613 /// Reading from this pointer when `result_ok` is not set is undefined.
7614 pub result: *mut crate::c_types::Str,
7615 /// A pointer to the contents in the error state.
7616 /// Reading from this pointer when `result_ok` is set is undefined.
7617 pub err: *mut crate::c_types::Secp256k1Error,
7620 /// A CResult_StringErrorZ represents the result of a fallible operation,
7621 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7623 pub struct CResult_StringErrorZ {
7624 /// The contents of this CResult_StringErrorZ, accessible via either
7625 /// `err` or `result` depending on the state of `result_ok`.
7626 pub contents: CResult_StringErrorZPtr,
7627 /// Whether this CResult_StringErrorZ represents a success state.
7628 pub result_ok: bool,
7631 /// Creates a new CResult_StringErrorZ in the success state.
7632 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
7633 CResult_StringErrorZ {
7634 contents: CResult_StringErrorZPtr {
7635 result: Box::into_raw(Box::new(o)),
7641 /// Creates a new CResult_StringErrorZ in the error state.
7642 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
7643 CResult_StringErrorZ {
7644 contents: CResult_StringErrorZPtr {
7645 err: Box::into_raw(Box::new(e)),
7650 /// Checks if the given object is currently in the success state
7652 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
7656 /// Frees any resources used by the CResult_StringErrorZ.
7657 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
7658 impl Drop for CResult_StringErrorZ {
7659 fn drop(&mut self) {
7661 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7662 let _ = unsafe { Box::from_raw(self.contents.result) };
7665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7666 let _ = unsafe { Box::from_raw(self.contents.err) };
7671 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
7672 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
7673 let contents = if o.result_ok {
7674 let result = unsafe { o.contents.result };
7675 unsafe { o.contents.result = std::ptr::null_mut() };
7676 CResult_StringErrorZPtr { result }
7678 let err = unsafe { o.contents.err };
7679 unsafe { o.contents.err = std::ptr::null_mut(); }
7680 CResult_StringErrorZPtr { err }
7684 result_ok: o.result_ok,
7689 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7690 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7691 /// A pointer to the contents in the success state.
7692 /// Reading from this pointer when `result_ok` is not set is undefined.
7693 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
7694 /// A pointer to the contents in the error state.
7695 /// Reading from this pointer when `result_ok` is set is undefined.
7696 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7699 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7700 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7702 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
7703 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7704 /// `err` or `result` depending on the state of `result_ok`.
7705 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
7706 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7707 pub result_ok: bool,
7710 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
7711 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
7712 CResult_ChannelMonitorUpdateDecodeErrorZ {
7713 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7714 result: Box::into_raw(Box::new(o)),
7720 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
7721 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
7722 CResult_ChannelMonitorUpdateDecodeErrorZ {
7723 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7724 err: Box::into_raw(Box::new(e)),
7729 /// Checks if the given object is currently in the success state
7731 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
7735 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
7736 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
7737 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
7738 fn drop(&mut self) {
7740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7741 let _ = unsafe { Box::from_raw(self.contents.result) };
7744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7745 let _ = unsafe { Box::from_raw(self.contents.err) };
7750 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
7751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7752 let contents = if o.result_ok {
7753 let result = unsafe { o.contents.result };
7754 unsafe { o.contents.result = std::ptr::null_mut() };
7755 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
7757 let err = unsafe { o.contents.err };
7758 unsafe { o.contents.err = std::ptr::null_mut(); }
7759 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
7763 result_ok: o.result_ok,
7767 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
7768 fn clone(&self) -> Self {
7770 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7771 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
7774 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7781 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
7782 /// but with all dynamically-allocated buffers duplicated in new buffers.
7783 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
7786 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
7787 pub enum COption_MonitorEventZ {
7788 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
7789 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
7790 /// When we're in this state, this COption_MonitorEventZ contains nothing
7793 impl COption_MonitorEventZ {
7794 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7795 if let Self::Some(_) = self { true } else { false }
7797 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7800 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
7801 if let Self::Some(v) = self { v } else { unreachable!() }
7805 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
7806 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
7807 COption_MonitorEventZ::Some(o)
7810 /// Constructs a new COption_MonitorEventZ containing nothing
7811 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
7812 COption_MonitorEventZ::None
7815 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
7816 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
7818 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
7819 /// but with all dynamically-allocated buffers duplicated in new buffers.
7820 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
7822 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
7823 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
7824 /// A pointer to the contents in the success state.
7825 /// Reading from this pointer when `result_ok` is not set is undefined.
7826 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
7827 /// A pointer to the contents in the error state.
7828 /// Reading from this pointer when `result_ok` is set is undefined.
7829 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7832 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
7833 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7835 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
7836 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
7837 /// `err` or `result` depending on the state of `result_ok`.
7838 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
7839 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
7840 pub result_ok: bool,
7843 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
7844 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
7845 CResult_COption_MonitorEventZDecodeErrorZ {
7846 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
7847 result: Box::into_raw(Box::new(o)),
7853 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
7854 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
7855 CResult_COption_MonitorEventZDecodeErrorZ {
7856 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
7857 err: Box::into_raw(Box::new(e)),
7862 /// Checks if the given object is currently in the success state
7864 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
7868 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
7869 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
7870 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
7871 fn drop(&mut self) {
7873 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7874 let _ = unsafe { Box::from_raw(self.contents.result) };
7877 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7878 let _ = unsafe { Box::from_raw(self.contents.err) };
7883 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
7884 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7885 let contents = if o.result_ok {
7886 let result = unsafe { o.contents.result };
7887 unsafe { o.contents.result = std::ptr::null_mut() };
7888 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
7890 let err = unsafe { o.contents.err };
7891 unsafe { o.contents.err = std::ptr::null_mut(); }
7892 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
7896 result_ok: o.result_ok,
7900 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
7901 fn clone(&self) -> Self {
7903 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
7904 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
7907 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
7908 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7914 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
7915 /// but with all dynamically-allocated buffers duplicated in new buffers.
7916 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
7918 /// The contents of CResult_HTLCUpdateDecodeErrorZ
7919 pub union CResult_HTLCUpdateDecodeErrorZPtr {
7920 /// A pointer to the contents in the success state.
7921 /// Reading from this pointer when `result_ok` is not set is undefined.
7922 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
7923 /// A pointer to the contents in the error state.
7924 /// Reading from this pointer when `result_ok` is set is undefined.
7925 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7928 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7929 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7931 pub struct CResult_HTLCUpdateDecodeErrorZ {
7932 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7933 /// `err` or `result` depending on the state of `result_ok`.
7934 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
7935 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7936 pub result_ok: bool,
7939 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
7940 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
7941 CResult_HTLCUpdateDecodeErrorZ {
7942 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7943 result: Box::into_raw(Box::new(o)),
7949 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
7950 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
7951 CResult_HTLCUpdateDecodeErrorZ {
7952 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7953 err: Box::into_raw(Box::new(e)),
7958 /// Checks if the given object is currently in the success state
7960 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
7964 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
7965 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
7966 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
7967 fn drop(&mut self) {
7969 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7970 let _ = unsafe { Box::from_raw(self.contents.result) };
7973 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7974 let _ = unsafe { Box::from_raw(self.contents.err) };
7979 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
7980 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7981 let contents = if o.result_ok {
7982 let result = unsafe { o.contents.result };
7983 unsafe { o.contents.result = std::ptr::null_mut() };
7984 CResult_HTLCUpdateDecodeErrorZPtr { result }
7986 let err = unsafe { o.contents.err };
7987 unsafe { o.contents.err = std::ptr::null_mut(); }
7988 CResult_HTLCUpdateDecodeErrorZPtr { err }
7992 result_ok: o.result_ok,
7996 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
7997 fn clone(&self) -> Self {
7999 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8000 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
8003 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8004 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8010 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8011 /// but with all dynamically-allocated buffers duplicated in new buffers.
8012 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
8014 /// The contents of CResult_NoneMonitorUpdateErrorZ
8015 pub union CResult_NoneMonitorUpdateErrorZPtr {
8016 /// Note that this value is always NULL, as there are no contents in the OK variant
8017 pub result: *mut std::ffi::c_void,
8018 /// A pointer to the contents in the error state.
8019 /// Reading from this pointer when `result_ok` is set is undefined.
8020 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
8023 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
8024 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
8025 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8026 pub struct CResult_NoneMonitorUpdateErrorZ {
8027 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
8028 /// `err` or `result` depending on the state of `result_ok`.
8029 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
8030 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
8031 pub result_ok: bool,
8034 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
8035 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
8036 CResult_NoneMonitorUpdateErrorZ {
8037 contents: CResult_NoneMonitorUpdateErrorZPtr {
8038 result: std::ptr::null_mut(),
8044 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
8045 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
8046 CResult_NoneMonitorUpdateErrorZ {
8047 contents: CResult_NoneMonitorUpdateErrorZPtr {
8048 err: Box::into_raw(Box::new(e)),
8053 /// Checks if the given object is currently in the success state
8055 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_is_ok(o: &CResult_NoneMonitorUpdateErrorZ) -> bool {
8059 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
8060 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
8061 impl Drop for CResult_NoneMonitorUpdateErrorZ {
8062 fn drop(&mut self) {
8065 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8066 let _ = unsafe { Box::from_raw(self.contents.err) };
8071 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
8072 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
8073 let contents = if o.result_ok {
8074 let _ = unsafe { Box::from_raw(o.contents.result) };
8075 o.contents.result = std::ptr::null_mut();
8076 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
8078 let err = unsafe { o.contents.err };
8079 unsafe { o.contents.err = std::ptr::null_mut(); }
8080 CResult_NoneMonitorUpdateErrorZPtr { err }
8084 result_ok: o.result_ok,
8088 impl Clone for CResult_NoneMonitorUpdateErrorZ {
8089 fn clone(&self) -> Self {
8091 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
8092 result: std::ptr::null_mut()
8095 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
8096 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
8102 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
8103 /// but with all dynamically-allocated buffers duplicated in new buffers.
8104 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
8106 /// A tuple of 2 elements. See the individual fields for the types contained.
8107 pub struct C2Tuple_OutPointScriptZ {
8108 /// The element at position 0
8109 pub a: crate::lightning::chain::transaction::OutPoint,
8110 /// The element at position 1
8111 pub b: crate::c_types::derived::CVec_u8Z,
8113 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
8114 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
8121 impl C2Tuple_OutPointScriptZ {
8122 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
8126 impl Clone for C2Tuple_OutPointScriptZ {
8127 fn clone(&self) -> Self {
8129 a: Clone::clone(&self.a),
8130 b: Clone::clone(&self.b),
8135 /// Creates a new tuple which has the same data as `orig`
8136 /// but with all dynamically-allocated buffers duplicated in new buffers.
8137 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
8138 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8140 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
8141 C2Tuple_OutPointScriptZ { a, b, }
8145 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
8146 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
8148 /// A tuple of 2 elements. See the individual fields for the types contained.
8149 pub struct C2Tuple_u32ScriptZ {
8150 /// The element at position 0
8152 /// The element at position 1
8153 pub b: crate::c_types::derived::CVec_u8Z,
8155 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
8156 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
8163 impl C2Tuple_u32ScriptZ {
8164 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
8168 impl Clone for C2Tuple_u32ScriptZ {
8169 fn clone(&self) -> Self {
8171 a: Clone::clone(&self.a),
8172 b: Clone::clone(&self.b),
8177 /// Creates a new tuple which has the same data as `orig`
8178 /// but with all dynamically-allocated buffers duplicated in new buffers.
8179 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
8180 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
8182 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
8183 C2Tuple_u32ScriptZ { a, b, }
8187 /// Frees any resources used by the C2Tuple_u32ScriptZ.
8188 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
8190 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8191 /// This corresponds to std::vector in C++
8192 pub struct CVec_C2Tuple_u32ScriptZZ {
8193 /// The elements in the array.
8194 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8195 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
8196 /// The number of elements pointed to by `data`.
8199 impl CVec_C2Tuple_u32ScriptZZ {
8200 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
8201 if self.datalen == 0 { return Vec::new(); }
8202 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8203 self.data = std::ptr::null_mut();
8207 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
8208 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8211 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
8212 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
8213 let datalen = v.len();
8214 let data = Box::into_raw(v.into_boxed_slice());
8215 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8219 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8220 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
8221 impl Drop for CVec_C2Tuple_u32ScriptZZ {
8222 fn drop(&mut self) {
8223 if self.datalen == 0 { return; }
8224 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8227 impl Clone for CVec_C2Tuple_u32ScriptZZ {
8228 fn clone(&self) -> Self {
8229 let mut res = Vec::new();
8230 if self.datalen == 0 { return Self::from(res); }
8231 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8236 /// A tuple of 2 elements. See the individual fields for the types contained.
8237 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8238 /// The element at position 0
8239 pub a: crate::c_types::ThirtyTwoBytes,
8240 /// The element at position 1
8241 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
8243 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8244 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
8251 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8252 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
8256 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8257 fn clone(&self) -> Self {
8259 a: Clone::clone(&self.a),
8260 b: Clone::clone(&self.b),
8265 /// Creates a new tuple which has the same data as `orig`
8266 /// but with all dynamically-allocated buffers duplicated in new buffers.
8267 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
8268 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8270 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 {
8271 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
8275 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8276 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
8278 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8279 /// This corresponds to std::vector in C++
8280 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8281 /// The elements in the array.
8282 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8283 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
8284 /// The number of elements pointed to by `data`.
8287 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8288 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
8289 if self.datalen == 0 { return Vec::new(); }
8290 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8291 self.data = std::ptr::null_mut();
8295 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
8296 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8299 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8300 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
8301 let datalen = v.len();
8302 let data = Box::into_raw(v.into_boxed_slice());
8303 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8307 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8308 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
8309 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8310 fn drop(&mut self) {
8311 if self.datalen == 0 { return; }
8312 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8315 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8316 fn clone(&self) -> Self {
8317 let mut res = Vec::new();
8318 if self.datalen == 0 { return Self::from(res); }
8319 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8324 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8325 /// This corresponds to std::vector in C++
8326 pub struct CVec_EventZ {
8327 /// The elements in the array.
8328 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8329 pub data: *mut crate::lightning::util::events::Event,
8330 /// The number of elements pointed to by `data`.
8334 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
8335 if self.datalen == 0 { return Vec::new(); }
8336 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8337 self.data = std::ptr::null_mut();
8341 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
8342 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8345 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
8346 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
8347 let datalen = v.len();
8348 let data = Box::into_raw(v.into_boxed_slice());
8349 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8353 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8354 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
8355 impl Drop for CVec_EventZ {
8356 fn drop(&mut self) {
8357 if self.datalen == 0 { return; }
8358 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8361 impl Clone for CVec_EventZ {
8362 fn clone(&self) -> Self {
8363 let mut res = Vec::new();
8364 if self.datalen == 0 { return Self::from(res); }
8365 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8370 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8371 /// This corresponds to std::vector in C++
8372 pub struct CVec_TransactionZ {
8373 /// The elements in the array.
8374 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8375 pub data: *mut crate::c_types::Transaction,
8376 /// The number of elements pointed to by `data`.
8379 impl CVec_TransactionZ {
8380 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
8381 if self.datalen == 0 { return Vec::new(); }
8382 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8383 self.data = std::ptr::null_mut();
8387 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
8388 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8391 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
8392 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
8393 let datalen = v.len();
8394 let data = Box::into_raw(v.into_boxed_slice());
8395 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8399 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8400 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
8401 impl Drop for CVec_TransactionZ {
8402 fn drop(&mut self) {
8403 if self.datalen == 0 { return; }
8404 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8407 impl Clone for CVec_TransactionZ {
8408 fn clone(&self) -> Self {
8409 let mut res = Vec::new();
8410 if self.datalen == 0 { return Self::from(res); }
8411 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8416 /// A tuple of 2 elements. See the individual fields for the types contained.
8417 pub struct C2Tuple_u32TxOutZ {
8418 /// The element at position 0
8420 /// The element at position 1
8421 pub b: crate::c_types::TxOut,
8423 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
8424 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
8431 impl C2Tuple_u32TxOutZ {
8432 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
8436 impl Clone for C2Tuple_u32TxOutZ {
8437 fn clone(&self) -> Self {
8439 a: Clone::clone(&self.a),
8440 b: Clone::clone(&self.b),
8445 /// Creates a new tuple which has the same data as `orig`
8446 /// but with all dynamically-allocated buffers duplicated in new buffers.
8447 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
8448 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
8450 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
8451 C2Tuple_u32TxOutZ { a, b, }
8455 /// Frees any resources used by the C2Tuple_u32TxOutZ.
8456 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
8458 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8459 /// This corresponds to std::vector in C++
8460 pub struct CVec_C2Tuple_u32TxOutZZ {
8461 /// The elements in the array.
8462 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8463 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
8464 /// The number of elements pointed to by `data`.
8467 impl CVec_C2Tuple_u32TxOutZZ {
8468 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
8469 if self.datalen == 0 { return Vec::new(); }
8470 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8471 self.data = std::ptr::null_mut();
8475 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
8476 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8479 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
8480 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
8481 let datalen = v.len();
8482 let data = Box::into_raw(v.into_boxed_slice());
8483 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8487 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8488 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
8489 impl Drop for CVec_C2Tuple_u32TxOutZZ {
8490 fn drop(&mut self) {
8491 if self.datalen == 0 { return; }
8492 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8495 impl Clone for CVec_C2Tuple_u32TxOutZZ {
8496 fn clone(&self) -> Self {
8497 let mut res = Vec::new();
8498 if self.datalen == 0 { return Self::from(res); }
8499 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8504 /// A tuple of 2 elements. See the individual fields for the types contained.
8505 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8506 /// The element at position 0
8507 pub a: crate::c_types::ThirtyTwoBytes,
8508 /// The element at position 1
8509 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
8511 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8512 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
8519 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8520 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
8524 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8525 fn clone(&self) -> Self {
8527 a: Clone::clone(&self.a),
8528 b: Clone::clone(&self.b),
8533 /// Creates a new tuple which has the same data as `orig`
8534 /// but with all dynamically-allocated buffers duplicated in new buffers.
8535 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
8536 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8538 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 {
8539 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
8543 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8544 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
8546 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8547 /// This corresponds to std::vector in C++
8548 pub struct CVec_TransactionOutputsZ {
8549 /// The elements in the array.
8550 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8551 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
8552 /// The number of elements pointed to by `data`.
8555 impl CVec_TransactionOutputsZ {
8556 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
8557 if self.datalen == 0 { return Vec::new(); }
8558 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8559 self.data = std::ptr::null_mut();
8563 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
8564 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8567 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
8568 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
8569 let datalen = v.len();
8570 let data = Box::into_raw(v.into_boxed_slice());
8571 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8575 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8576 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
8577 impl Drop for CVec_TransactionOutputsZ {
8578 fn drop(&mut self) {
8579 if self.datalen == 0 { return; }
8580 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8583 impl Clone for CVec_TransactionOutputsZ {
8584 fn clone(&self) -> Self {
8585 let mut res = Vec::new();
8586 if self.datalen == 0 { return Self::from(res); }
8587 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8592 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
8593 /// This corresponds to std::vector in C++
8594 pub struct CVec_BalanceZ {
8595 /// The elements in the array.
8596 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8597 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
8598 /// The number of elements pointed to by `data`.
8601 impl CVec_BalanceZ {
8602 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
8603 if self.datalen == 0 { return Vec::new(); }
8604 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8605 self.data = std::ptr::null_mut();
8609 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
8610 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8613 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
8614 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
8615 let datalen = v.len();
8616 let data = Box::into_raw(v.into_boxed_slice());
8617 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8621 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8622 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
8623 impl Drop for CVec_BalanceZ {
8624 fn drop(&mut self) {
8625 if self.datalen == 0 { return; }
8626 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8629 impl Clone for CVec_BalanceZ {
8630 fn clone(&self) -> Self {
8631 let mut res = Vec::new();
8632 if self.datalen == 0 { return Self::from(res); }
8633 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8638 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
8639 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8640 /// A pointer to the contents in the success state.
8641 /// Reading from this pointer when `result_ok` is not set is undefined.
8642 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8643 /// A pointer to the contents in the error state.
8644 /// Reading from this pointer when `result_ok` is set is undefined.
8645 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8648 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
8649 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8650 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8651 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8652 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
8653 /// `err` or `result` depending on the state of `result_ok`.
8654 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
8655 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
8656 pub result_ok: bool,
8659 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
8660 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8661 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8662 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8663 result: Box::into_raw(Box::new(o)),
8669 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
8670 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8671 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8672 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8673 err: Box::into_raw(Box::new(e)),
8678 /// Checks if the given object is currently in the success state
8680 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
8684 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
8685 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
8686 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8687 fn drop(&mut self) {
8689 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8690 let _ = unsafe { Box::from_raw(self.contents.result) };
8693 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8694 let _ = unsafe { Box::from_raw(self.contents.err) };
8699 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8700 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8701 let contents = if o.result_ok {
8702 let result = unsafe { o.contents.result };
8703 unsafe { o.contents.result = std::ptr::null_mut() };
8704 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
8706 let err = unsafe { o.contents.err };
8707 unsafe { o.contents.err = std::ptr::null_mut(); }
8708 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
8712 result_ok: o.result_ok,
8717 /// The contents of CResult_NoneLightningErrorZ
8718 pub union CResult_NoneLightningErrorZPtr {
8719 /// Note that this value is always NULL, as there are no contents in the OK variant
8720 pub result: *mut std::ffi::c_void,
8721 /// A pointer to the contents in the error state.
8722 /// Reading from this pointer when `result_ok` is set is undefined.
8723 pub err: *mut crate::lightning::ln::msgs::LightningError,
8726 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
8727 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
8728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8729 pub struct CResult_NoneLightningErrorZ {
8730 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
8731 /// `err` or `result` depending on the state of `result_ok`.
8732 pub contents: CResult_NoneLightningErrorZPtr,
8733 /// Whether this CResult_NoneLightningErrorZ represents a success state.
8734 pub result_ok: bool,
8737 /// Creates a new CResult_NoneLightningErrorZ in the success state.
8738 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
8739 CResult_NoneLightningErrorZ {
8740 contents: CResult_NoneLightningErrorZPtr {
8741 result: std::ptr::null_mut(),
8747 /// Creates a new CResult_NoneLightningErrorZ in the error state.
8748 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
8749 CResult_NoneLightningErrorZ {
8750 contents: CResult_NoneLightningErrorZPtr {
8751 err: Box::into_raw(Box::new(e)),
8756 /// Checks if the given object is currently in the success state
8758 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
8762 /// Frees any resources used by the CResult_NoneLightningErrorZ.
8763 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
8764 impl Drop for CResult_NoneLightningErrorZ {
8765 fn drop(&mut self) {
8768 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8769 let _ = unsafe { Box::from_raw(self.contents.err) };
8774 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
8775 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
8776 let contents = if o.result_ok {
8777 let _ = unsafe { Box::from_raw(o.contents.result) };
8778 o.contents.result = std::ptr::null_mut();
8779 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
8781 let err = unsafe { o.contents.err };
8782 unsafe { o.contents.err = std::ptr::null_mut(); }
8783 CResult_NoneLightningErrorZPtr { err }
8787 result_ok: o.result_ok,
8791 impl Clone for CResult_NoneLightningErrorZ {
8792 fn clone(&self) -> Self {
8794 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
8795 result: std::ptr::null_mut()
8798 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
8799 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8805 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8806 /// but with all dynamically-allocated buffers duplicated in new buffers.
8807 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
8809 /// A tuple of 2 elements. See the individual fields for the types contained.
8810 pub struct C2Tuple_PublicKeyTypeZ {
8811 /// The element at position 0
8812 pub a: crate::c_types::PublicKey,
8813 /// The element at position 1
8814 pub b: crate::lightning::ln::wire::Type,
8816 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
8817 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
8824 impl C2Tuple_PublicKeyTypeZ {
8825 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
8829 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
8831 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
8832 C2Tuple_PublicKeyTypeZ { a, b, }
8836 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
8837 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
8839 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8840 /// This corresponds to std::vector in C++
8841 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
8842 /// The elements in the array.
8843 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8844 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
8845 /// The number of elements pointed to by `data`.
8848 impl CVec_C2Tuple_PublicKeyTypeZZ {
8849 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
8850 if self.datalen == 0 { return Vec::new(); }
8851 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8852 self.data = std::ptr::null_mut();
8856 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
8857 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8860 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
8861 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
8862 let datalen = v.len();
8863 let data = Box::into_raw(v.into_boxed_slice());
8864 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8868 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8869 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
8870 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
8871 fn drop(&mut self) {
8872 if self.datalen == 0 { return; }
8873 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8877 /// The contents of CResult_boolLightningErrorZ
8878 pub union CResult_boolLightningErrorZPtr {
8879 /// A pointer to the contents in the success state.
8880 /// Reading from this pointer when `result_ok` is not set is undefined.
8881 pub result: *mut bool,
8882 /// A pointer to the contents in the error state.
8883 /// Reading from this pointer when `result_ok` is set is undefined.
8884 pub err: *mut crate::lightning::ln::msgs::LightningError,
8887 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
8888 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8890 pub struct CResult_boolLightningErrorZ {
8891 /// The contents of this CResult_boolLightningErrorZ, accessible via either
8892 /// `err` or `result` depending on the state of `result_ok`.
8893 pub contents: CResult_boolLightningErrorZPtr,
8894 /// Whether this CResult_boolLightningErrorZ represents a success state.
8895 pub result_ok: bool,
8898 /// Creates a new CResult_boolLightningErrorZ in the success state.
8899 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
8900 CResult_boolLightningErrorZ {
8901 contents: CResult_boolLightningErrorZPtr {
8902 result: Box::into_raw(Box::new(o)),
8908 /// Creates a new CResult_boolLightningErrorZ in the error state.
8909 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
8910 CResult_boolLightningErrorZ {
8911 contents: CResult_boolLightningErrorZPtr {
8912 err: Box::into_raw(Box::new(e)),
8917 /// Checks if the given object is currently in the success state
8919 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
8923 /// Frees any resources used by the CResult_boolLightningErrorZ.
8924 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
8925 impl Drop for CResult_boolLightningErrorZ {
8926 fn drop(&mut self) {
8928 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8929 let _ = unsafe { Box::from_raw(self.contents.result) };
8932 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8933 let _ = unsafe { Box::from_raw(self.contents.err) };
8938 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
8939 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
8940 let contents = if o.result_ok {
8941 let result = unsafe { o.contents.result };
8942 unsafe { o.contents.result = std::ptr::null_mut() };
8943 CResult_boolLightningErrorZPtr { result }
8945 let err = unsafe { o.contents.err };
8946 unsafe { o.contents.err = std::ptr::null_mut(); }
8947 CResult_boolLightningErrorZPtr { err }
8951 result_ok: o.result_ok,
8955 impl Clone for CResult_boolLightningErrorZ {
8956 fn clone(&self) -> Self {
8958 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
8959 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8962 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
8963 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8969 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8970 /// but with all dynamically-allocated buffers duplicated in new buffers.
8971 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
8973 /// A tuple of 3 elements. See the individual fields for the types contained.
8974 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8975 /// The element at position 0
8976 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
8977 /// The element at position 1
8978 pub b: crate::lightning::ln::msgs::ChannelUpdate,
8979 /// The element at position 2
8980 pub c: crate::lightning::ln::msgs::ChannelUpdate,
8982 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8983 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
8991 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8992 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
8993 (self.a, self.b, self.c)
8996 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8997 fn clone(&self) -> Self {
8999 a: Clone::clone(&self.a),
9000 b: Clone::clone(&self.b),
9001 c: Clone::clone(&self.c),
9006 /// Creates a new tuple which has the same data as `orig`
9007 /// but with all dynamically-allocated buffers duplicated in new buffers.
9008 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
9009 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9011 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 {
9012 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
9016 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9017 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
9019 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
9020 /// This corresponds to std::vector in C++
9021 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9022 /// The elements in the array.
9023 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9024 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
9025 /// The number of elements pointed to by `data`.
9028 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9029 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
9030 if self.datalen == 0 { return Vec::new(); }
9031 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9032 self.data = std::ptr::null_mut();
9036 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
9037 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9040 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9041 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
9042 let datalen = v.len();
9043 let data = Box::into_raw(v.into_boxed_slice());
9044 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9048 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9049 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
9050 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9051 fn drop(&mut self) {
9052 if self.datalen == 0 { return; }
9053 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9056 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9057 fn clone(&self) -> Self {
9058 let mut res = Vec::new();
9059 if self.datalen == 0 { return Self::from(res); }
9060 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9065 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
9066 /// This corresponds to std::vector in C++
9067 pub struct CVec_NodeAnnouncementZ {
9068 /// The elements in the array.
9069 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9070 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
9071 /// The number of elements pointed to by `data`.
9074 impl CVec_NodeAnnouncementZ {
9075 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
9076 if self.datalen == 0 { return Vec::new(); }
9077 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9078 self.data = std::ptr::null_mut();
9082 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
9083 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9086 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
9087 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
9088 let datalen = v.len();
9089 let data = Box::into_raw(v.into_boxed_slice());
9090 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9094 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9095 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
9096 impl Drop for CVec_NodeAnnouncementZ {
9097 fn drop(&mut self) {
9098 if self.datalen == 0 { return; }
9099 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9102 impl Clone for CVec_NodeAnnouncementZ {
9103 fn clone(&self) -> Self {
9104 let mut res = Vec::new();
9105 if self.datalen == 0 { return Self::from(res); }
9106 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9111 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
9112 /// This corresponds to std::vector in C++
9113 pub struct CVec_PublicKeyZ {
9114 /// The elements in the array.
9115 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9116 pub data: *mut crate::c_types::PublicKey,
9117 /// The number of elements pointed to by `data`.
9120 impl CVec_PublicKeyZ {
9121 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
9122 if self.datalen == 0 { return Vec::new(); }
9123 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9124 self.data = std::ptr::null_mut();
9128 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
9129 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9132 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
9133 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
9134 let datalen = v.len();
9135 let data = Box::into_raw(v.into_boxed_slice());
9136 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9140 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9141 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
9142 impl Drop for CVec_PublicKeyZ {
9143 fn drop(&mut self) {
9144 if self.datalen == 0 { return; }
9145 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9148 impl Clone for CVec_PublicKeyZ {
9149 fn clone(&self) -> Self {
9150 let mut res = Vec::new();
9151 if self.datalen == 0 { return Self::from(res); }
9152 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9157 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
9158 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
9159 /// A pointer to the contents in the success state.
9160 /// Reading from this pointer when `result_ok` is not set is undefined.
9161 pub result: *mut crate::c_types::derived::CVec_u8Z,
9162 /// A pointer to the contents in the error state.
9163 /// Reading from this pointer when `result_ok` is set is undefined.
9164 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9167 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9168 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9170 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
9171 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9172 /// `err` or `result` depending on the state of `result_ok`.
9173 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
9174 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9175 pub result_ok: bool,
9178 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9179 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
9180 CResult_CVec_u8ZPeerHandleErrorZ {
9181 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9182 result: Box::into_raw(Box::new(o)),
9188 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9189 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
9190 CResult_CVec_u8ZPeerHandleErrorZ {
9191 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9192 err: Box::into_raw(Box::new(e)),
9197 /// Checks if the given object is currently in the success state
9199 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
9203 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9204 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
9205 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
9206 fn drop(&mut self) {
9208 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9209 let _ = unsafe { Box::from_raw(self.contents.result) };
9212 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9213 let _ = unsafe { Box::from_raw(self.contents.err) };
9218 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
9219 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9220 let contents = if o.result_ok {
9221 let result = unsafe { o.contents.result };
9222 unsafe { o.contents.result = std::ptr::null_mut() };
9223 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
9225 let err = unsafe { o.contents.err };
9226 unsafe { o.contents.err = std::ptr::null_mut(); }
9227 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
9231 result_ok: o.result_ok,
9235 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
9236 fn clone(&self) -> Self {
9238 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9239 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
9242 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9243 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9249 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9250 /// but with all dynamically-allocated buffers duplicated in new buffers.
9251 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
9253 /// The contents of CResult_NonePeerHandleErrorZ
9254 pub union CResult_NonePeerHandleErrorZPtr {
9255 /// Note that this value is always NULL, as there are no contents in the OK variant
9256 pub result: *mut std::ffi::c_void,
9257 /// A pointer to the contents in the error state.
9258 /// Reading from this pointer when `result_ok` is set is undefined.
9259 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9262 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9263 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9264 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9265 pub struct CResult_NonePeerHandleErrorZ {
9266 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9267 /// `err` or `result` depending on the state of `result_ok`.
9268 pub contents: CResult_NonePeerHandleErrorZPtr,
9269 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
9270 pub result_ok: bool,
9273 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
9274 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
9275 CResult_NonePeerHandleErrorZ {
9276 contents: CResult_NonePeerHandleErrorZPtr {
9277 result: std::ptr::null_mut(),
9283 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
9284 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
9285 CResult_NonePeerHandleErrorZ {
9286 contents: CResult_NonePeerHandleErrorZPtr {
9287 err: Box::into_raw(Box::new(e)),
9292 /// Checks if the given object is currently in the success state
9294 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
9298 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
9299 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
9300 impl Drop for CResult_NonePeerHandleErrorZ {
9301 fn drop(&mut self) {
9304 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9305 let _ = unsafe { Box::from_raw(self.contents.err) };
9310 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
9311 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9312 let contents = if o.result_ok {
9313 let _ = unsafe { Box::from_raw(o.contents.result) };
9314 o.contents.result = std::ptr::null_mut();
9315 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
9317 let err = unsafe { o.contents.err };
9318 unsafe { o.contents.err = std::ptr::null_mut(); }
9319 CResult_NonePeerHandleErrorZPtr { err }
9323 result_ok: o.result_ok,
9327 impl Clone for CResult_NonePeerHandleErrorZ {
9328 fn clone(&self) -> Self {
9330 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
9331 result: std::ptr::null_mut()
9334 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
9335 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9341 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9342 /// but with all dynamically-allocated buffers duplicated in new buffers.
9343 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
9345 /// The contents of CResult_boolPeerHandleErrorZ
9346 pub union CResult_boolPeerHandleErrorZPtr {
9347 /// A pointer to the contents in the success state.
9348 /// Reading from this pointer when `result_ok` is not set is undefined.
9349 pub result: *mut bool,
9350 /// A pointer to the contents in the error state.
9351 /// Reading from this pointer when `result_ok` is set is undefined.
9352 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9355 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9356 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9357 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9358 pub struct CResult_boolPeerHandleErrorZ {
9359 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9360 /// `err` or `result` depending on the state of `result_ok`.
9361 pub contents: CResult_boolPeerHandleErrorZPtr,
9362 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
9363 pub result_ok: bool,
9366 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
9367 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
9368 CResult_boolPeerHandleErrorZ {
9369 contents: CResult_boolPeerHandleErrorZPtr {
9370 result: Box::into_raw(Box::new(o)),
9376 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
9377 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
9378 CResult_boolPeerHandleErrorZ {
9379 contents: CResult_boolPeerHandleErrorZPtr {
9380 err: Box::into_raw(Box::new(e)),
9385 /// Checks if the given object is currently in the success state
9387 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
9391 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
9392 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
9393 impl Drop for CResult_boolPeerHandleErrorZ {
9394 fn drop(&mut self) {
9396 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9397 let _ = unsafe { Box::from_raw(self.contents.result) };
9400 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9401 let _ = unsafe { Box::from_raw(self.contents.err) };
9406 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
9407 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9408 let contents = if o.result_ok {
9409 let result = unsafe { o.contents.result };
9410 unsafe { o.contents.result = std::ptr::null_mut() };
9411 CResult_boolPeerHandleErrorZPtr { result }
9413 let err = unsafe { o.contents.err };
9414 unsafe { o.contents.err = std::ptr::null_mut(); }
9415 CResult_boolPeerHandleErrorZPtr { err }
9419 result_ok: o.result_ok,
9423 impl Clone for CResult_boolPeerHandleErrorZ {
9424 fn clone(&self) -> Self {
9426 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
9427 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9430 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
9431 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9437 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9438 /// but with all dynamically-allocated buffers duplicated in new buffers.
9439 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
9441 /// The contents of CResult_NodeIdDecodeErrorZ
9442 pub union CResult_NodeIdDecodeErrorZPtr {
9443 /// A pointer to the contents in the success state.
9444 /// Reading from this pointer when `result_ok` is not set is undefined.
9445 pub result: *mut crate::lightning::routing::network_graph::NodeId,
9446 /// A pointer to the contents in the error state.
9447 /// Reading from this pointer when `result_ok` is set is undefined.
9448 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9451 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
9452 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
9453 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9454 pub struct CResult_NodeIdDecodeErrorZ {
9455 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
9456 /// `err` or `result` depending on the state of `result_ok`.
9457 pub contents: CResult_NodeIdDecodeErrorZPtr,
9458 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
9459 pub result_ok: bool,
9462 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
9463 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
9464 CResult_NodeIdDecodeErrorZ {
9465 contents: CResult_NodeIdDecodeErrorZPtr {
9466 result: Box::into_raw(Box::new(o)),
9472 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
9473 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
9474 CResult_NodeIdDecodeErrorZ {
9475 contents: CResult_NodeIdDecodeErrorZPtr {
9476 err: Box::into_raw(Box::new(e)),
9481 /// Checks if the given object is currently in the success state
9483 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
9487 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
9488 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
9489 impl Drop for CResult_NodeIdDecodeErrorZ {
9490 fn drop(&mut self) {
9492 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9493 let _ = unsafe { Box::from_raw(self.contents.result) };
9496 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9497 let _ = unsafe { Box::from_raw(self.contents.err) };
9502 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
9503 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
9504 let contents = if o.result_ok {
9505 let result = unsafe { o.contents.result };
9506 unsafe { o.contents.result = std::ptr::null_mut() };
9507 CResult_NodeIdDecodeErrorZPtr { result }
9509 let err = unsafe { o.contents.err };
9510 unsafe { o.contents.err = std::ptr::null_mut(); }
9511 CResult_NodeIdDecodeErrorZPtr { err }
9515 result_ok: o.result_ok,
9519 impl Clone for CResult_NodeIdDecodeErrorZ {
9520 fn clone(&self) -> Self {
9522 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
9523 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
9526 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
9527 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9533 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
9534 /// but with all dynamically-allocated buffers duplicated in new buffers.
9535 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
9537 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
9538 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9539 /// A pointer to the contents in the success state.
9540 /// Reading from this pointer when `result_ok` is not set is undefined.
9541 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
9542 /// A pointer to the contents in the error state.
9543 /// Reading from this pointer when `result_ok` is set is undefined.
9544 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9547 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
9548 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9550 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
9551 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
9552 /// `err` or `result` depending on the state of `result_ok`.
9553 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
9554 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
9555 pub result_ok: bool,
9558 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
9559 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9560 CResult_COption_NetworkUpdateZDecodeErrorZ {
9561 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9562 result: Box::into_raw(Box::new(o)),
9568 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
9569 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9570 CResult_COption_NetworkUpdateZDecodeErrorZ {
9571 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9572 err: Box::into_raw(Box::new(e)),
9577 /// Checks if the given object is currently in the success state
9579 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
9583 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
9584 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
9585 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
9586 fn drop(&mut self) {
9588 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9589 let _ = unsafe { Box::from_raw(self.contents.result) };
9592 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9593 let _ = unsafe { Box::from_raw(self.contents.err) };
9598 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
9599 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9600 let contents = if o.result_ok {
9601 let result = unsafe { o.contents.result };
9602 unsafe { o.contents.result = std::ptr::null_mut() };
9603 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
9605 let err = unsafe { o.contents.err };
9606 unsafe { o.contents.err = std::ptr::null_mut(); }
9607 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
9611 result_ok: o.result_ok,
9615 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
9616 fn clone(&self) -> Self {
9618 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9619 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
9622 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9623 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9629 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
9630 /// but with all dynamically-allocated buffers duplicated in new buffers.
9631 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
9633 /// An enum which can either contain a crate::lightning::chain::Access or not
9634 pub enum COption_AccessZ {
9635 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
9636 Some(crate::lightning::chain::Access),
9637 /// When we're in this state, this COption_AccessZ contains nothing
9640 impl COption_AccessZ {
9641 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9642 if let Self::Some(_) = self { true } else { false }
9644 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9647 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
9648 if let Self::Some(v) = self { v } else { unreachable!() }
9652 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
9653 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
9654 COption_AccessZ::Some(o)
9657 /// Constructs a new COption_AccessZ containing nothing
9658 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
9659 COption_AccessZ::None
9662 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
9663 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
9665 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
9666 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
9667 /// A pointer to the contents in the success state.
9668 /// Reading from this pointer when `result_ok` is not set is undefined.
9669 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
9670 /// A pointer to the contents in the error state.
9671 /// Reading from this pointer when `result_ok` is set is undefined.
9672 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9675 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
9676 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9678 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
9679 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
9680 /// `err` or `result` depending on the state of `result_ok`.
9681 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
9682 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
9683 pub result_ok: bool,
9686 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
9687 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
9688 CResult_DirectionalChannelInfoDecodeErrorZ {
9689 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
9690 result: Box::into_raw(Box::new(o)),
9696 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
9697 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
9698 CResult_DirectionalChannelInfoDecodeErrorZ {
9699 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
9700 err: Box::into_raw(Box::new(e)),
9705 /// Checks if the given object is currently in the success state
9707 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o: &CResult_DirectionalChannelInfoDecodeErrorZ) -> bool {
9711 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
9712 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
9713 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
9714 fn drop(&mut self) {
9716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9717 let _ = unsafe { Box::from_raw(self.contents.result) };
9720 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9721 let _ = unsafe { Box::from_raw(self.contents.err) };
9726 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
9727 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9728 let contents = if o.result_ok {
9729 let result = unsafe { o.contents.result };
9730 unsafe { o.contents.result = std::ptr::null_mut() };
9731 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
9733 let err = unsafe { o.contents.err };
9734 unsafe { o.contents.err = std::ptr::null_mut(); }
9735 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
9739 result_ok: o.result_ok,
9743 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
9744 fn clone(&self) -> Self {
9746 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
9747 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
9750 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
9751 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9757 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
9758 /// but with all dynamically-allocated buffers duplicated in new buffers.
9759 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
9761 /// The contents of CResult_ChannelInfoDecodeErrorZ
9762 pub union CResult_ChannelInfoDecodeErrorZPtr {
9763 /// A pointer to the contents in the success state.
9764 /// Reading from this pointer when `result_ok` is not set is undefined.
9765 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
9766 /// A pointer to the contents in the error state.
9767 /// Reading from this pointer when `result_ok` is set is undefined.
9768 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9771 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
9772 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9774 pub struct CResult_ChannelInfoDecodeErrorZ {
9775 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
9776 /// `err` or `result` depending on the state of `result_ok`.
9777 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
9778 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
9779 pub result_ok: bool,
9782 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
9783 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
9784 CResult_ChannelInfoDecodeErrorZ {
9785 contents: CResult_ChannelInfoDecodeErrorZPtr {
9786 result: Box::into_raw(Box::new(o)),
9792 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
9793 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
9794 CResult_ChannelInfoDecodeErrorZ {
9795 contents: CResult_ChannelInfoDecodeErrorZPtr {
9796 err: Box::into_raw(Box::new(e)),
9801 /// Checks if the given object is currently in the success state
9803 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
9807 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
9808 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
9809 impl Drop for CResult_ChannelInfoDecodeErrorZ {
9810 fn drop(&mut self) {
9812 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9813 let _ = unsafe { Box::from_raw(self.contents.result) };
9816 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9817 let _ = unsafe { Box::from_raw(self.contents.err) };
9822 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
9823 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9824 let contents = if o.result_ok {
9825 let result = unsafe { o.contents.result };
9826 unsafe { o.contents.result = std::ptr::null_mut() };
9827 CResult_ChannelInfoDecodeErrorZPtr { result }
9829 let err = unsafe { o.contents.err };
9830 unsafe { o.contents.err = std::ptr::null_mut(); }
9831 CResult_ChannelInfoDecodeErrorZPtr { err }
9835 result_ok: o.result_ok,
9839 impl Clone for CResult_ChannelInfoDecodeErrorZ {
9840 fn clone(&self) -> Self {
9842 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
9843 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
9846 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
9847 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9853 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
9854 /// but with all dynamically-allocated buffers duplicated in new buffers.
9855 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
9857 /// The contents of CResult_RoutingFeesDecodeErrorZ
9858 pub union CResult_RoutingFeesDecodeErrorZPtr {
9859 /// A pointer to the contents in the success state.
9860 /// Reading from this pointer when `result_ok` is not set is undefined.
9861 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
9862 /// A pointer to the contents in the error state.
9863 /// Reading from this pointer when `result_ok` is set is undefined.
9864 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9867 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
9868 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
9869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9870 pub struct CResult_RoutingFeesDecodeErrorZ {
9871 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
9872 /// `err` or `result` depending on the state of `result_ok`.
9873 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
9874 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
9875 pub result_ok: bool,
9878 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
9879 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
9880 CResult_RoutingFeesDecodeErrorZ {
9881 contents: CResult_RoutingFeesDecodeErrorZPtr {
9882 result: Box::into_raw(Box::new(o)),
9888 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
9889 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
9890 CResult_RoutingFeesDecodeErrorZ {
9891 contents: CResult_RoutingFeesDecodeErrorZPtr {
9892 err: Box::into_raw(Box::new(e)),
9897 /// Checks if the given object is currently in the success state
9899 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
9903 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
9904 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
9905 impl Drop for CResult_RoutingFeesDecodeErrorZ {
9906 fn drop(&mut self) {
9908 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9909 let _ = unsafe { Box::from_raw(self.contents.result) };
9912 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9913 let _ = unsafe { Box::from_raw(self.contents.err) };
9918 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
9919 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
9920 let contents = if o.result_ok {
9921 let result = unsafe { o.contents.result };
9922 unsafe { o.contents.result = std::ptr::null_mut() };
9923 CResult_RoutingFeesDecodeErrorZPtr { result }
9925 let err = unsafe { o.contents.err };
9926 unsafe { o.contents.err = std::ptr::null_mut(); }
9927 CResult_RoutingFeesDecodeErrorZPtr { err }
9931 result_ok: o.result_ok,
9935 impl Clone for CResult_RoutingFeesDecodeErrorZ {
9936 fn clone(&self) -> Self {
9938 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
9939 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
9942 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
9943 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9949 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
9950 /// but with all dynamically-allocated buffers duplicated in new buffers.
9951 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
9953 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
9954 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9955 /// A pointer to the contents in the success state.
9956 /// Reading from this pointer when `result_ok` is not set is undefined.
9957 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
9958 /// A pointer to the contents in the error state.
9959 /// Reading from this pointer when `result_ok` is set is undefined.
9960 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9963 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
9964 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9966 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
9967 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
9968 /// `err` or `result` depending on the state of `result_ok`.
9969 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
9970 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
9971 pub result_ok: bool,
9974 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
9975 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
9976 CResult_NodeAnnouncementInfoDecodeErrorZ {
9977 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9978 result: Box::into_raw(Box::new(o)),
9984 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
9985 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
9986 CResult_NodeAnnouncementInfoDecodeErrorZ {
9987 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9988 err: Box::into_raw(Box::new(e)),
9993 /// Checks if the given object is currently in the success state
9995 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
9999 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10000 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
10001 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
10002 fn drop(&mut self) {
10003 if self.result_ok {
10004 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10005 let _ = unsafe { Box::from_raw(self.contents.result) };
10008 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10009 let _ = unsafe { Box::from_raw(self.contents.err) };
10014 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
10015 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10016 let contents = if o.result_ok {
10017 let result = unsafe { o.contents.result };
10018 unsafe { o.contents.result = std::ptr::null_mut() };
10019 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
10021 let err = unsafe { o.contents.err };
10022 unsafe { o.contents.err = std::ptr::null_mut(); }
10023 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
10027 result_ok: o.result_ok,
10031 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
10032 fn clone(&self) -> Self {
10033 if self.result_ok {
10034 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10035 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
10038 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10039 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10045 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10046 /// but with all dynamically-allocated buffers duplicated in new buffers.
10047 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
10049 /// A dynamically-allocated array of u64s of arbitrary size.
10050 /// This corresponds to std::vector in C++
10051 pub struct CVec_u64Z {
10052 /// The elements in the array.
10053 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10054 pub data: *mut u64,
10055 /// The number of elements pointed to by `data`.
10059 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
10060 if self.datalen == 0 { return Vec::new(); }
10061 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10062 self.data = std::ptr::null_mut();
10066 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
10067 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10070 impl From<Vec<u64>> for CVec_u64Z {
10071 fn from(v: Vec<u64>) -> Self {
10072 let datalen = v.len();
10073 let data = Box::into_raw(v.into_boxed_slice());
10074 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10078 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10079 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
10080 impl Drop for CVec_u64Z {
10081 fn drop(&mut self) {
10082 if self.datalen == 0 { return; }
10083 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10086 impl Clone for CVec_u64Z {
10087 fn clone(&self) -> Self {
10088 let mut res = Vec::new();
10089 if self.datalen == 0 { return Self::from(res); }
10090 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10095 /// The contents of CResult_NodeInfoDecodeErrorZ
10096 pub union CResult_NodeInfoDecodeErrorZPtr {
10097 /// A pointer to the contents in the success state.
10098 /// Reading from this pointer when `result_ok` is not set is undefined.
10099 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
10100 /// A pointer to the contents in the error state.
10101 /// Reading from this pointer when `result_ok` is set is undefined.
10102 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10105 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
10106 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10108 pub struct CResult_NodeInfoDecodeErrorZ {
10109 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
10110 /// `err` or `result` depending on the state of `result_ok`.
10111 pub contents: CResult_NodeInfoDecodeErrorZPtr,
10112 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
10113 pub result_ok: bool,
10116 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10117 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
10118 CResult_NodeInfoDecodeErrorZ {
10119 contents: CResult_NodeInfoDecodeErrorZPtr {
10120 result: Box::into_raw(Box::new(o)),
10126 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10127 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
10128 CResult_NodeInfoDecodeErrorZ {
10129 contents: CResult_NodeInfoDecodeErrorZPtr {
10130 err: Box::into_raw(Box::new(e)),
10135 /// Checks if the given object is currently in the success state
10137 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
10141 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10142 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
10143 impl Drop for CResult_NodeInfoDecodeErrorZ {
10144 fn drop(&mut self) {
10145 if self.result_ok {
10146 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10147 let _ = unsafe { Box::from_raw(self.contents.result) };
10150 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10151 let _ = unsafe { Box::from_raw(self.contents.err) };
10156 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
10157 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10158 let contents = if o.result_ok {
10159 let result = unsafe { o.contents.result };
10160 unsafe { o.contents.result = std::ptr::null_mut() };
10161 CResult_NodeInfoDecodeErrorZPtr { result }
10163 let err = unsafe { o.contents.err };
10164 unsafe { o.contents.err = std::ptr::null_mut(); }
10165 CResult_NodeInfoDecodeErrorZPtr { err }
10169 result_ok: o.result_ok,
10173 impl Clone for CResult_NodeInfoDecodeErrorZ {
10174 fn clone(&self) -> Self {
10175 if self.result_ok {
10176 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
10177 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
10180 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
10181 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10187 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10188 /// but with all dynamically-allocated buffers duplicated in new buffers.
10189 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
10191 /// The contents of CResult_NetworkGraphDecodeErrorZ
10192 pub union CResult_NetworkGraphDecodeErrorZPtr {
10193 /// A pointer to the contents in the success state.
10194 /// Reading from this pointer when `result_ok` is not set is undefined.
10195 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
10196 /// A pointer to the contents in the error state.
10197 /// Reading from this pointer when `result_ok` is set is undefined.
10198 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10201 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
10202 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
10203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10204 pub struct CResult_NetworkGraphDecodeErrorZ {
10205 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
10206 /// `err` or `result` depending on the state of `result_ok`.
10207 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
10208 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
10209 pub result_ok: bool,
10212 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10213 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
10214 CResult_NetworkGraphDecodeErrorZ {
10215 contents: CResult_NetworkGraphDecodeErrorZPtr {
10216 result: Box::into_raw(Box::new(o)),
10222 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10223 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
10224 CResult_NetworkGraphDecodeErrorZ {
10225 contents: CResult_NetworkGraphDecodeErrorZPtr {
10226 err: Box::into_raw(Box::new(e)),
10231 /// Checks if the given object is currently in the success state
10233 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
10237 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10238 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
10239 impl Drop for CResult_NetworkGraphDecodeErrorZ {
10240 fn drop(&mut self) {
10241 if self.result_ok {
10242 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10243 let _ = unsafe { Box::from_raw(self.contents.result) };
10246 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10247 let _ = unsafe { Box::from_raw(self.contents.err) };
10252 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
10253 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
10254 let contents = if o.result_ok {
10255 let result = unsafe { o.contents.result };
10256 unsafe { o.contents.result = std::ptr::null_mut() };
10257 CResult_NetworkGraphDecodeErrorZPtr { result }
10259 let err = unsafe { o.contents.err };
10260 unsafe { o.contents.err = std::ptr::null_mut(); }
10261 CResult_NetworkGraphDecodeErrorZPtr { err }
10265 result_ok: o.result_ok,
10269 impl Clone for CResult_NetworkGraphDecodeErrorZ {
10270 fn clone(&self) -> Self {
10271 if self.result_ok {
10272 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
10273 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
10276 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
10277 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10283 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10284 /// but with all dynamically-allocated buffers duplicated in new buffers.
10285 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
10288 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
10289 pub enum COption_CVec_NetAddressZZ {
10290 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
10291 Some(crate::c_types::derived::CVec_NetAddressZ),
10292 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
10295 impl COption_CVec_NetAddressZZ {
10296 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10297 if let Self::Some(_) = self { true } else { false }
10299 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10302 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
10303 if let Self::Some(v) = self { v } else { unreachable!() }
10307 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
10308 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
10309 COption_CVec_NetAddressZZ::Some(o)
10312 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
10313 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
10314 COption_CVec_NetAddressZZ::None
10317 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
10318 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
10320 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
10321 /// but with all dynamically-allocated buffers duplicated in new buffers.
10322 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
10324 /// The contents of CResult_NetAddressDecodeErrorZ
10325 pub union CResult_NetAddressDecodeErrorZPtr {
10326 /// A pointer to the contents in the success state.
10327 /// Reading from this pointer when `result_ok` is not set is undefined.
10328 pub result: *mut crate::lightning::ln::msgs::NetAddress,
10329 /// A pointer to the contents in the error state.
10330 /// Reading from this pointer when `result_ok` is set is undefined.
10331 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10334 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10335 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10336 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10337 pub struct CResult_NetAddressDecodeErrorZ {
10338 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10339 /// `err` or `result` depending on the state of `result_ok`.
10340 pub contents: CResult_NetAddressDecodeErrorZPtr,
10341 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10342 pub result_ok: bool,
10345 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10346 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
10347 CResult_NetAddressDecodeErrorZ {
10348 contents: CResult_NetAddressDecodeErrorZPtr {
10349 result: Box::into_raw(Box::new(o)),
10355 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10356 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
10357 CResult_NetAddressDecodeErrorZ {
10358 contents: CResult_NetAddressDecodeErrorZPtr {
10359 err: Box::into_raw(Box::new(e)),
10364 /// Checks if the given object is currently in the success state
10366 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
10370 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10371 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
10372 impl Drop for CResult_NetAddressDecodeErrorZ {
10373 fn drop(&mut self) {
10374 if self.result_ok {
10375 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10376 let _ = unsafe { Box::from_raw(self.contents.result) };
10379 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10380 let _ = unsafe { Box::from_raw(self.contents.err) };
10385 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
10386 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
10387 let contents = if o.result_ok {
10388 let result = unsafe { o.contents.result };
10389 unsafe { o.contents.result = std::ptr::null_mut() };
10390 CResult_NetAddressDecodeErrorZPtr { result }
10392 let err = unsafe { o.contents.err };
10393 unsafe { o.contents.err = std::ptr::null_mut(); }
10394 CResult_NetAddressDecodeErrorZPtr { err }
10398 result_ok: o.result_ok,
10402 impl Clone for CResult_NetAddressDecodeErrorZ {
10403 fn clone(&self) -> Self {
10404 if self.result_ok {
10405 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
10406 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
10409 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
10410 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10416 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10417 /// but with all dynamically-allocated buffers duplicated in new buffers.
10418 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
10420 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10421 /// This corresponds to std::vector in C++
10422 pub struct CVec_UpdateAddHTLCZ {
10423 /// The elements in the array.
10424 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10425 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10426 /// The number of elements pointed to by `data`.
10429 impl CVec_UpdateAddHTLCZ {
10430 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
10431 if self.datalen == 0 { return Vec::new(); }
10432 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10433 self.data = std::ptr::null_mut();
10437 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
10438 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10441 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
10442 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
10443 let datalen = v.len();
10444 let data = Box::into_raw(v.into_boxed_slice());
10445 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10449 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10450 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
10451 impl Drop for CVec_UpdateAddHTLCZ {
10452 fn drop(&mut self) {
10453 if self.datalen == 0 { return; }
10454 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10457 impl Clone for CVec_UpdateAddHTLCZ {
10458 fn clone(&self) -> Self {
10459 let mut res = Vec::new();
10460 if self.datalen == 0 { return Self::from(res); }
10461 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10466 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10467 /// This corresponds to std::vector in C++
10468 pub struct CVec_UpdateFulfillHTLCZ {
10469 /// The elements in the array.
10470 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10471 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10472 /// The number of elements pointed to by `data`.
10475 impl CVec_UpdateFulfillHTLCZ {
10476 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
10477 if self.datalen == 0 { return Vec::new(); }
10478 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10479 self.data = std::ptr::null_mut();
10483 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
10484 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10487 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
10488 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
10489 let datalen = v.len();
10490 let data = Box::into_raw(v.into_boxed_slice());
10491 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10495 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10496 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
10497 impl Drop for CVec_UpdateFulfillHTLCZ {
10498 fn drop(&mut self) {
10499 if self.datalen == 0 { return; }
10500 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10503 impl Clone for CVec_UpdateFulfillHTLCZ {
10504 fn clone(&self) -> Self {
10505 let mut res = Vec::new();
10506 if self.datalen == 0 { return Self::from(res); }
10507 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10512 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10513 /// This corresponds to std::vector in C++
10514 pub struct CVec_UpdateFailHTLCZ {
10515 /// The elements in the array.
10516 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10517 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10518 /// The number of elements pointed to by `data`.
10521 impl CVec_UpdateFailHTLCZ {
10522 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
10523 if self.datalen == 0 { return Vec::new(); }
10524 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10525 self.data = std::ptr::null_mut();
10529 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
10530 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10533 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
10534 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
10535 let datalen = v.len();
10536 let data = Box::into_raw(v.into_boxed_slice());
10537 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10541 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10542 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
10543 impl Drop for CVec_UpdateFailHTLCZ {
10544 fn drop(&mut self) {
10545 if self.datalen == 0 { return; }
10546 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10549 impl Clone for CVec_UpdateFailHTLCZ {
10550 fn clone(&self) -> Self {
10551 let mut res = Vec::new();
10552 if self.datalen == 0 { return Self::from(res); }
10553 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10558 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10559 /// This corresponds to std::vector in C++
10560 pub struct CVec_UpdateFailMalformedHTLCZ {
10561 /// The elements in the array.
10562 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10563 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10564 /// The number of elements pointed to by `data`.
10567 impl CVec_UpdateFailMalformedHTLCZ {
10568 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
10569 if self.datalen == 0 { return Vec::new(); }
10570 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10571 self.data = std::ptr::null_mut();
10575 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
10576 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10579 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
10580 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
10581 let datalen = v.len();
10582 let data = Box::into_raw(v.into_boxed_slice());
10583 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10587 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10588 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
10589 impl Drop for CVec_UpdateFailMalformedHTLCZ {
10590 fn drop(&mut self) {
10591 if self.datalen == 0 { return; }
10592 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10595 impl Clone for CVec_UpdateFailMalformedHTLCZ {
10596 fn clone(&self) -> Self {
10597 let mut res = Vec::new();
10598 if self.datalen == 0 { return Self::from(res); }
10599 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10604 /// The contents of CResult_AcceptChannelDecodeErrorZ
10605 pub union CResult_AcceptChannelDecodeErrorZPtr {
10606 /// A pointer to the contents in the success state.
10607 /// Reading from this pointer when `result_ok` is not set is undefined.
10608 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
10609 /// A pointer to the contents in the error state.
10610 /// Reading from this pointer when `result_ok` is set is undefined.
10611 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10614 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
10615 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10617 pub struct CResult_AcceptChannelDecodeErrorZ {
10618 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
10619 /// `err` or `result` depending on the state of `result_ok`.
10620 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
10621 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
10622 pub result_ok: bool,
10625 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10626 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
10627 CResult_AcceptChannelDecodeErrorZ {
10628 contents: CResult_AcceptChannelDecodeErrorZPtr {
10629 result: Box::into_raw(Box::new(o)),
10635 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10636 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
10637 CResult_AcceptChannelDecodeErrorZ {
10638 contents: CResult_AcceptChannelDecodeErrorZPtr {
10639 err: Box::into_raw(Box::new(e)),
10644 /// Checks if the given object is currently in the success state
10646 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
10650 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10651 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
10652 impl Drop for CResult_AcceptChannelDecodeErrorZ {
10653 fn drop(&mut self) {
10654 if self.result_ok {
10655 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10656 let _ = unsafe { Box::from_raw(self.contents.result) };
10659 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10660 let _ = unsafe { Box::from_raw(self.contents.err) };
10665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
10666 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
10667 let contents = if o.result_ok {
10668 let result = unsafe { o.contents.result };
10669 unsafe { o.contents.result = std::ptr::null_mut() };
10670 CResult_AcceptChannelDecodeErrorZPtr { result }
10672 let err = unsafe { o.contents.err };
10673 unsafe { o.contents.err = std::ptr::null_mut(); }
10674 CResult_AcceptChannelDecodeErrorZPtr { err }
10678 result_ok: o.result_ok,
10682 impl Clone for CResult_AcceptChannelDecodeErrorZ {
10683 fn clone(&self) -> Self {
10684 if self.result_ok {
10685 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
10686 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
10689 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
10690 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10696 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10697 /// but with all dynamically-allocated buffers duplicated in new buffers.
10698 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
10700 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
10701 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
10702 /// A pointer to the contents in the success state.
10703 /// Reading from this pointer when `result_ok` is not set is undefined.
10704 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
10705 /// A pointer to the contents in the error state.
10706 /// Reading from this pointer when `result_ok` is set is undefined.
10707 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10710 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
10711 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
10712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10713 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
10714 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
10715 /// `err` or `result` depending on the state of `result_ok`.
10716 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
10717 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
10718 pub result_ok: bool,
10721 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10722 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
10723 CResult_AnnouncementSignaturesDecodeErrorZ {
10724 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
10725 result: Box::into_raw(Box::new(o)),
10731 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10732 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
10733 CResult_AnnouncementSignaturesDecodeErrorZ {
10734 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
10735 err: Box::into_raw(Box::new(e)),
10740 /// Checks if the given object is currently in the success state
10742 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
10746 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10747 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
10748 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
10749 fn drop(&mut self) {
10750 if self.result_ok {
10751 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10752 let _ = unsafe { Box::from_raw(self.contents.result) };
10755 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10756 let _ = unsafe { Box::from_raw(self.contents.err) };
10761 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
10762 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
10763 let contents = if o.result_ok {
10764 let result = unsafe { o.contents.result };
10765 unsafe { o.contents.result = std::ptr::null_mut() };
10766 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
10768 let err = unsafe { o.contents.err };
10769 unsafe { o.contents.err = std::ptr::null_mut(); }
10770 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
10774 result_ok: o.result_ok,
10778 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
10779 fn clone(&self) -> Self {
10780 if self.result_ok {
10781 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
10782 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
10785 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
10786 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10792 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10793 /// but with all dynamically-allocated buffers duplicated in new buffers.
10794 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
10796 /// The contents of CResult_ChannelReestablishDecodeErrorZ
10797 pub union CResult_ChannelReestablishDecodeErrorZPtr {
10798 /// A pointer to the contents in the success state.
10799 /// Reading from this pointer when `result_ok` is not set is undefined.
10800 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
10801 /// A pointer to the contents in the error state.
10802 /// Reading from this pointer when `result_ok` is set is undefined.
10803 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10806 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
10807 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
10808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10809 pub struct CResult_ChannelReestablishDecodeErrorZ {
10810 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
10811 /// `err` or `result` depending on the state of `result_ok`.
10812 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
10813 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
10814 pub result_ok: bool,
10817 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10818 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
10819 CResult_ChannelReestablishDecodeErrorZ {
10820 contents: CResult_ChannelReestablishDecodeErrorZPtr {
10821 result: Box::into_raw(Box::new(o)),
10827 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10828 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
10829 CResult_ChannelReestablishDecodeErrorZ {
10830 contents: CResult_ChannelReestablishDecodeErrorZPtr {
10831 err: Box::into_raw(Box::new(e)),
10836 /// Checks if the given object is currently in the success state
10838 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
10842 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10843 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
10844 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
10845 fn drop(&mut self) {
10846 if self.result_ok {
10847 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10848 let _ = unsafe { Box::from_raw(self.contents.result) };
10851 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10852 let _ = unsafe { Box::from_raw(self.contents.err) };
10857 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
10858 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
10859 let contents = if o.result_ok {
10860 let result = unsafe { o.contents.result };
10861 unsafe { o.contents.result = std::ptr::null_mut() };
10862 CResult_ChannelReestablishDecodeErrorZPtr { result }
10864 let err = unsafe { o.contents.err };
10865 unsafe { o.contents.err = std::ptr::null_mut(); }
10866 CResult_ChannelReestablishDecodeErrorZPtr { err }
10870 result_ok: o.result_ok,
10874 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
10875 fn clone(&self) -> Self {
10876 if self.result_ok {
10877 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
10878 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
10881 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
10882 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10888 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10889 /// but with all dynamically-allocated buffers duplicated in new buffers.
10890 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
10892 /// The contents of CResult_ClosingSignedDecodeErrorZ
10893 pub union CResult_ClosingSignedDecodeErrorZPtr {
10894 /// A pointer to the contents in the success state.
10895 /// Reading from this pointer when `result_ok` is not set is undefined.
10896 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
10897 /// A pointer to the contents in the error state.
10898 /// Reading from this pointer when `result_ok` is set is undefined.
10899 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10902 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
10903 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10904 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10905 pub struct CResult_ClosingSignedDecodeErrorZ {
10906 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
10907 /// `err` or `result` depending on the state of `result_ok`.
10908 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
10909 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
10910 pub result_ok: bool,
10913 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10914 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
10915 CResult_ClosingSignedDecodeErrorZ {
10916 contents: CResult_ClosingSignedDecodeErrorZPtr {
10917 result: Box::into_raw(Box::new(o)),
10923 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10924 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
10925 CResult_ClosingSignedDecodeErrorZ {
10926 contents: CResult_ClosingSignedDecodeErrorZPtr {
10927 err: Box::into_raw(Box::new(e)),
10932 /// Checks if the given object is currently in the success state
10934 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
10938 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10939 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
10940 impl Drop for CResult_ClosingSignedDecodeErrorZ {
10941 fn drop(&mut self) {
10942 if self.result_ok {
10943 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10944 let _ = unsafe { Box::from_raw(self.contents.result) };
10947 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10948 let _ = unsafe { Box::from_raw(self.contents.err) };
10953 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
10954 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10955 let contents = if o.result_ok {
10956 let result = unsafe { o.contents.result };
10957 unsafe { o.contents.result = std::ptr::null_mut() };
10958 CResult_ClosingSignedDecodeErrorZPtr { result }
10960 let err = unsafe { o.contents.err };
10961 unsafe { o.contents.err = std::ptr::null_mut(); }
10962 CResult_ClosingSignedDecodeErrorZPtr { err }
10966 result_ok: o.result_ok,
10970 impl Clone for CResult_ClosingSignedDecodeErrorZ {
10971 fn clone(&self) -> Self {
10972 if self.result_ok {
10973 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
10974 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
10977 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
10978 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10984 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10985 /// but with all dynamically-allocated buffers duplicated in new buffers.
10986 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
10988 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
10989 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10990 /// A pointer to the contents in the success state.
10991 /// Reading from this pointer when `result_ok` is not set is undefined.
10992 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
10993 /// A pointer to the contents in the error state.
10994 /// Reading from this pointer when `result_ok` is set is undefined.
10995 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10998 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
10999 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11001 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
11002 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
11003 /// `err` or `result` depending on the state of `result_ok`.
11004 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
11005 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
11006 pub result_ok: bool,
11009 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
11010 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11011 CResult_ClosingSignedFeeRangeDecodeErrorZ {
11012 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11013 result: Box::into_raw(Box::new(o)),
11019 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
11020 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11021 CResult_ClosingSignedFeeRangeDecodeErrorZ {
11022 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11023 err: Box::into_raw(Box::new(e)),
11028 /// Checks if the given object is currently in the success state
11030 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
11034 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
11035 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
11036 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11037 fn drop(&mut self) {
11038 if self.result_ok {
11039 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11040 let _ = unsafe { Box::from_raw(self.contents.result) };
11043 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11044 let _ = unsafe { Box::from_raw(self.contents.err) };
11049 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11050 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11051 let contents = if o.result_ok {
11052 let result = unsafe { o.contents.result };
11053 unsafe { o.contents.result = std::ptr::null_mut() };
11054 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
11056 let err = unsafe { o.contents.err };
11057 unsafe { o.contents.err = std::ptr::null_mut(); }
11058 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
11062 result_ok: o.result_ok,
11066 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11067 fn clone(&self) -> Self {
11068 if self.result_ok {
11069 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11070 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
11073 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11074 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11080 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
11081 /// but with all dynamically-allocated buffers duplicated in new buffers.
11082 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
11084 /// The contents of CResult_CommitmentSignedDecodeErrorZ
11085 pub union CResult_CommitmentSignedDecodeErrorZPtr {
11086 /// A pointer to the contents in the success state.
11087 /// Reading from this pointer when `result_ok` is not set is undefined.
11088 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
11089 /// A pointer to the contents in the error state.
11090 /// Reading from this pointer when `result_ok` is set is undefined.
11091 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11094 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11095 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11096 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11097 pub struct CResult_CommitmentSignedDecodeErrorZ {
11098 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11099 /// `err` or `result` depending on the state of `result_ok`.
11100 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
11101 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11102 pub result_ok: bool,
11105 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
11106 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
11107 CResult_CommitmentSignedDecodeErrorZ {
11108 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11109 result: Box::into_raw(Box::new(o)),
11115 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
11116 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
11117 CResult_CommitmentSignedDecodeErrorZ {
11118 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11119 err: Box::into_raw(Box::new(e)),
11124 /// Checks if the given object is currently in the success state
11126 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
11130 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
11131 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
11132 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
11133 fn drop(&mut self) {
11134 if self.result_ok {
11135 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11136 let _ = unsafe { Box::from_raw(self.contents.result) };
11139 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11140 let _ = unsafe { Box::from_raw(self.contents.err) };
11145 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
11146 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11147 let contents = if o.result_ok {
11148 let result = unsafe { o.contents.result };
11149 unsafe { o.contents.result = std::ptr::null_mut() };
11150 CResult_CommitmentSignedDecodeErrorZPtr { result }
11152 let err = unsafe { o.contents.err };
11153 unsafe { o.contents.err = std::ptr::null_mut(); }
11154 CResult_CommitmentSignedDecodeErrorZPtr { err }
11158 result_ok: o.result_ok,
11162 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
11163 fn clone(&self) -> Self {
11164 if self.result_ok {
11165 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11166 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
11169 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11170 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11176 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
11177 /// but with all dynamically-allocated buffers duplicated in new buffers.
11178 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
11180 /// The contents of CResult_FundingCreatedDecodeErrorZ
11181 pub union CResult_FundingCreatedDecodeErrorZPtr {
11182 /// A pointer to the contents in the success state.
11183 /// Reading from this pointer when `result_ok` is not set is undefined.
11184 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
11185 /// A pointer to the contents in the error state.
11186 /// Reading from this pointer when `result_ok` is set is undefined.
11187 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11190 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11191 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11192 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11193 pub struct CResult_FundingCreatedDecodeErrorZ {
11194 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11195 /// `err` or `result` depending on the state of `result_ok`.
11196 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
11197 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11198 pub result_ok: bool,
11201 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
11202 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
11203 CResult_FundingCreatedDecodeErrorZ {
11204 contents: CResult_FundingCreatedDecodeErrorZPtr {
11205 result: Box::into_raw(Box::new(o)),
11211 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
11212 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
11213 CResult_FundingCreatedDecodeErrorZ {
11214 contents: CResult_FundingCreatedDecodeErrorZPtr {
11215 err: Box::into_raw(Box::new(e)),
11220 /// Checks if the given object is currently in the success state
11222 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
11226 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
11227 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
11228 impl Drop for CResult_FundingCreatedDecodeErrorZ {
11229 fn drop(&mut self) {
11230 if self.result_ok {
11231 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11232 let _ = unsafe { Box::from_raw(self.contents.result) };
11235 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11236 let _ = unsafe { Box::from_raw(self.contents.err) };
11241 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
11242 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
11243 let contents = if o.result_ok {
11244 let result = unsafe { o.contents.result };
11245 unsafe { o.contents.result = std::ptr::null_mut() };
11246 CResult_FundingCreatedDecodeErrorZPtr { result }
11248 let err = unsafe { o.contents.err };
11249 unsafe { o.contents.err = std::ptr::null_mut(); }
11250 CResult_FundingCreatedDecodeErrorZPtr { err }
11254 result_ok: o.result_ok,
11258 impl Clone for CResult_FundingCreatedDecodeErrorZ {
11259 fn clone(&self) -> Self {
11260 if self.result_ok {
11261 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
11262 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
11265 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
11266 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11272 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
11273 /// but with all dynamically-allocated buffers duplicated in new buffers.
11274 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
11276 /// The contents of CResult_FundingSignedDecodeErrorZ
11277 pub union CResult_FundingSignedDecodeErrorZPtr {
11278 /// A pointer to the contents in the success state.
11279 /// Reading from this pointer when `result_ok` is not set is undefined.
11280 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
11281 /// A pointer to the contents in the error state.
11282 /// Reading from this pointer when `result_ok` is set is undefined.
11283 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11286 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11287 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11288 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11289 pub struct CResult_FundingSignedDecodeErrorZ {
11290 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11291 /// `err` or `result` depending on the state of `result_ok`.
11292 pub contents: CResult_FundingSignedDecodeErrorZPtr,
11293 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11294 pub result_ok: bool,
11297 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
11298 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
11299 CResult_FundingSignedDecodeErrorZ {
11300 contents: CResult_FundingSignedDecodeErrorZPtr {
11301 result: Box::into_raw(Box::new(o)),
11307 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
11308 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
11309 CResult_FundingSignedDecodeErrorZ {
11310 contents: CResult_FundingSignedDecodeErrorZPtr {
11311 err: Box::into_raw(Box::new(e)),
11316 /// Checks if the given object is currently in the success state
11318 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
11322 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11323 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
11324 impl Drop for CResult_FundingSignedDecodeErrorZ {
11325 fn drop(&mut self) {
11326 if self.result_ok {
11327 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11328 let _ = unsafe { Box::from_raw(self.contents.result) };
11331 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11332 let _ = unsafe { Box::from_raw(self.contents.err) };
11337 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
11338 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11339 let contents = if o.result_ok {
11340 let result = unsafe { o.contents.result };
11341 unsafe { o.contents.result = std::ptr::null_mut() };
11342 CResult_FundingSignedDecodeErrorZPtr { result }
11344 let err = unsafe { o.contents.err };
11345 unsafe { o.contents.err = std::ptr::null_mut(); }
11346 CResult_FundingSignedDecodeErrorZPtr { err }
11350 result_ok: o.result_ok,
11354 impl Clone for CResult_FundingSignedDecodeErrorZ {
11355 fn clone(&self) -> Self {
11356 if self.result_ok {
11357 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
11358 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
11361 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
11362 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11368 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11369 /// but with all dynamically-allocated buffers duplicated in new buffers.
11370 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
11372 /// The contents of CResult_FundingLockedDecodeErrorZ
11373 pub union CResult_FundingLockedDecodeErrorZPtr {
11374 /// A pointer to the contents in the success state.
11375 /// Reading from this pointer when `result_ok` is not set is undefined.
11376 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
11377 /// A pointer to the contents in the error state.
11378 /// Reading from this pointer when `result_ok` is set is undefined.
11379 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11382 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
11383 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
11384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11385 pub struct CResult_FundingLockedDecodeErrorZ {
11386 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
11387 /// `err` or `result` depending on the state of `result_ok`.
11388 pub contents: CResult_FundingLockedDecodeErrorZPtr,
11389 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
11390 pub result_ok: bool,
11393 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11394 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
11395 CResult_FundingLockedDecodeErrorZ {
11396 contents: CResult_FundingLockedDecodeErrorZPtr {
11397 result: Box::into_raw(Box::new(o)),
11403 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11404 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
11405 CResult_FundingLockedDecodeErrorZ {
11406 contents: CResult_FundingLockedDecodeErrorZPtr {
11407 err: Box::into_raw(Box::new(e)),
11412 /// Checks if the given object is currently in the success state
11414 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
11418 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11419 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
11420 impl Drop for CResult_FundingLockedDecodeErrorZ {
11421 fn drop(&mut self) {
11422 if self.result_ok {
11423 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11424 let _ = unsafe { Box::from_raw(self.contents.result) };
11427 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11428 let _ = unsafe { Box::from_raw(self.contents.err) };
11433 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
11434 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
11435 let contents = if o.result_ok {
11436 let result = unsafe { o.contents.result };
11437 unsafe { o.contents.result = std::ptr::null_mut() };
11438 CResult_FundingLockedDecodeErrorZPtr { result }
11440 let err = unsafe { o.contents.err };
11441 unsafe { o.contents.err = std::ptr::null_mut(); }
11442 CResult_FundingLockedDecodeErrorZPtr { err }
11446 result_ok: o.result_ok,
11450 impl Clone for CResult_FundingLockedDecodeErrorZ {
11451 fn clone(&self) -> Self {
11452 if self.result_ok {
11453 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
11454 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
11457 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
11458 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11464 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11465 /// but with all dynamically-allocated buffers duplicated in new buffers.
11466 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
11468 /// The contents of CResult_InitDecodeErrorZ
11469 pub union CResult_InitDecodeErrorZPtr {
11470 /// A pointer to the contents in the success state.
11471 /// Reading from this pointer when `result_ok` is not set is undefined.
11472 pub result: *mut crate::lightning::ln::msgs::Init,
11473 /// A pointer to the contents in the error state.
11474 /// Reading from this pointer when `result_ok` is set is undefined.
11475 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11478 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11479 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11480 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11481 pub struct CResult_InitDecodeErrorZ {
11482 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
11483 /// `err` or `result` depending on the state of `result_ok`.
11484 pub contents: CResult_InitDecodeErrorZPtr,
11485 /// Whether this CResult_InitDecodeErrorZ represents a success state.
11486 pub result_ok: bool,
11489 /// Creates a new CResult_InitDecodeErrorZ in the success state.
11490 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
11491 CResult_InitDecodeErrorZ {
11492 contents: CResult_InitDecodeErrorZPtr {
11493 result: Box::into_raw(Box::new(o)),
11499 /// Creates a new CResult_InitDecodeErrorZ in the error state.
11500 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
11501 CResult_InitDecodeErrorZ {
11502 contents: CResult_InitDecodeErrorZPtr {
11503 err: Box::into_raw(Box::new(e)),
11508 /// Checks if the given object is currently in the success state
11510 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
11514 /// Frees any resources used by the CResult_InitDecodeErrorZ.
11515 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
11516 impl Drop for CResult_InitDecodeErrorZ {
11517 fn drop(&mut self) {
11518 if self.result_ok {
11519 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11520 let _ = unsafe { Box::from_raw(self.contents.result) };
11523 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11524 let _ = unsafe { Box::from_raw(self.contents.err) };
11529 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
11530 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
11531 let contents = if o.result_ok {
11532 let result = unsafe { o.contents.result };
11533 unsafe { o.contents.result = std::ptr::null_mut() };
11534 CResult_InitDecodeErrorZPtr { result }
11536 let err = unsafe { o.contents.err };
11537 unsafe { o.contents.err = std::ptr::null_mut(); }
11538 CResult_InitDecodeErrorZPtr { err }
11542 result_ok: o.result_ok,
11546 impl Clone for CResult_InitDecodeErrorZ {
11547 fn clone(&self) -> Self {
11548 if self.result_ok {
11549 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
11550 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
11553 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
11554 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11560 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11561 /// but with all dynamically-allocated buffers duplicated in new buffers.
11562 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
11564 /// The contents of CResult_OpenChannelDecodeErrorZ
11565 pub union CResult_OpenChannelDecodeErrorZPtr {
11566 /// A pointer to the contents in the success state.
11567 /// Reading from this pointer when `result_ok` is not set is undefined.
11568 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
11569 /// A pointer to the contents in the error state.
11570 /// Reading from this pointer when `result_ok` is set is undefined.
11571 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11574 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11575 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11576 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11577 pub struct CResult_OpenChannelDecodeErrorZ {
11578 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11579 /// `err` or `result` depending on the state of `result_ok`.
11580 pub contents: CResult_OpenChannelDecodeErrorZPtr,
11581 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
11582 pub result_ok: bool,
11585 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11586 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
11587 CResult_OpenChannelDecodeErrorZ {
11588 contents: CResult_OpenChannelDecodeErrorZPtr {
11589 result: Box::into_raw(Box::new(o)),
11595 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
11596 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
11597 CResult_OpenChannelDecodeErrorZ {
11598 contents: CResult_OpenChannelDecodeErrorZPtr {
11599 err: Box::into_raw(Box::new(e)),
11604 /// Checks if the given object is currently in the success state
11606 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
11610 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
11611 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
11612 impl Drop for CResult_OpenChannelDecodeErrorZ {
11613 fn drop(&mut self) {
11614 if self.result_ok {
11615 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11616 let _ = unsafe { Box::from_raw(self.contents.result) };
11619 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11620 let _ = unsafe { Box::from_raw(self.contents.err) };
11625 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
11626 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
11627 let contents = if o.result_ok {
11628 let result = unsafe { o.contents.result };
11629 unsafe { o.contents.result = std::ptr::null_mut() };
11630 CResult_OpenChannelDecodeErrorZPtr { result }
11632 let err = unsafe { o.contents.err };
11633 unsafe { o.contents.err = std::ptr::null_mut(); }
11634 CResult_OpenChannelDecodeErrorZPtr { err }
11638 result_ok: o.result_ok,
11642 impl Clone for CResult_OpenChannelDecodeErrorZ {
11643 fn clone(&self) -> Self {
11644 if self.result_ok {
11645 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
11646 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
11649 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
11650 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11656 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
11657 /// but with all dynamically-allocated buffers duplicated in new buffers.
11658 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
11660 /// The contents of CResult_RevokeAndACKDecodeErrorZ
11661 pub union CResult_RevokeAndACKDecodeErrorZPtr {
11662 /// A pointer to the contents in the success state.
11663 /// Reading from this pointer when `result_ok` is not set is undefined.
11664 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
11665 /// A pointer to the contents in the error state.
11666 /// Reading from this pointer when `result_ok` is set is undefined.
11667 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11670 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
11671 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
11672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11673 pub struct CResult_RevokeAndACKDecodeErrorZ {
11674 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
11675 /// `err` or `result` depending on the state of `result_ok`.
11676 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
11677 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
11678 pub result_ok: bool,
11681 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
11682 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
11683 CResult_RevokeAndACKDecodeErrorZ {
11684 contents: CResult_RevokeAndACKDecodeErrorZPtr {
11685 result: Box::into_raw(Box::new(o)),
11691 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
11692 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
11693 CResult_RevokeAndACKDecodeErrorZ {
11694 contents: CResult_RevokeAndACKDecodeErrorZPtr {
11695 err: Box::into_raw(Box::new(e)),
11700 /// Checks if the given object is currently in the success state
11702 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
11706 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
11707 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
11708 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
11709 fn drop(&mut self) {
11710 if self.result_ok {
11711 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11712 let _ = unsafe { Box::from_raw(self.contents.result) };
11715 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11716 let _ = unsafe { Box::from_raw(self.contents.err) };
11721 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
11722 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
11723 let contents = if o.result_ok {
11724 let result = unsafe { o.contents.result };
11725 unsafe { o.contents.result = std::ptr::null_mut() };
11726 CResult_RevokeAndACKDecodeErrorZPtr { result }
11728 let err = unsafe { o.contents.err };
11729 unsafe { o.contents.err = std::ptr::null_mut(); }
11730 CResult_RevokeAndACKDecodeErrorZPtr { err }
11734 result_ok: o.result_ok,
11738 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
11739 fn clone(&self) -> Self {
11740 if self.result_ok {
11741 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
11742 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
11745 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
11746 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11752 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
11753 /// but with all dynamically-allocated buffers duplicated in new buffers.
11754 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
11756 /// The contents of CResult_ShutdownDecodeErrorZ
11757 pub union CResult_ShutdownDecodeErrorZPtr {
11758 /// A pointer to the contents in the success state.
11759 /// Reading from this pointer when `result_ok` is not set is undefined.
11760 pub result: *mut crate::lightning::ln::msgs::Shutdown,
11761 /// A pointer to the contents in the error state.
11762 /// Reading from this pointer when `result_ok` is set is undefined.
11763 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11766 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
11767 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
11768 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11769 pub struct CResult_ShutdownDecodeErrorZ {
11770 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
11771 /// `err` or `result` depending on the state of `result_ok`.
11772 pub contents: CResult_ShutdownDecodeErrorZPtr,
11773 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
11774 pub result_ok: bool,
11777 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
11778 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
11779 CResult_ShutdownDecodeErrorZ {
11780 contents: CResult_ShutdownDecodeErrorZPtr {
11781 result: Box::into_raw(Box::new(o)),
11787 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
11788 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
11789 CResult_ShutdownDecodeErrorZ {
11790 contents: CResult_ShutdownDecodeErrorZPtr {
11791 err: Box::into_raw(Box::new(e)),
11796 /// Checks if the given object is currently in the success state
11798 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
11802 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
11803 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
11804 impl Drop for CResult_ShutdownDecodeErrorZ {
11805 fn drop(&mut self) {
11806 if self.result_ok {
11807 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11808 let _ = unsafe { Box::from_raw(self.contents.result) };
11811 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11812 let _ = unsafe { Box::from_raw(self.contents.err) };
11817 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
11818 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
11819 let contents = if o.result_ok {
11820 let result = unsafe { o.contents.result };
11821 unsafe { o.contents.result = std::ptr::null_mut() };
11822 CResult_ShutdownDecodeErrorZPtr { result }
11824 let err = unsafe { o.contents.err };
11825 unsafe { o.contents.err = std::ptr::null_mut(); }
11826 CResult_ShutdownDecodeErrorZPtr { err }
11830 result_ok: o.result_ok,
11834 impl Clone for CResult_ShutdownDecodeErrorZ {
11835 fn clone(&self) -> Self {
11836 if self.result_ok {
11837 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
11838 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
11841 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
11842 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11848 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
11849 /// but with all dynamically-allocated buffers duplicated in new buffers.
11850 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
11852 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
11853 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
11854 /// A pointer to the contents in the success state.
11855 /// Reading from this pointer when `result_ok` is not set is undefined.
11856 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11857 /// A pointer to the contents in the error state.
11858 /// Reading from this pointer when `result_ok` is set is undefined.
11859 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11862 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
11863 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11865 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
11866 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
11867 /// `err` or `result` depending on the state of `result_ok`.
11868 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
11869 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
11870 pub result_ok: bool,
11873 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
11874 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
11875 CResult_UpdateFailHTLCDecodeErrorZ {
11876 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
11877 result: Box::into_raw(Box::new(o)),
11883 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
11884 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
11885 CResult_UpdateFailHTLCDecodeErrorZ {
11886 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
11887 err: Box::into_raw(Box::new(e)),
11892 /// Checks if the given object is currently in the success state
11894 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
11898 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
11899 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
11900 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
11901 fn drop(&mut self) {
11902 if self.result_ok {
11903 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11904 let _ = unsafe { Box::from_raw(self.contents.result) };
11907 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11908 let _ = unsafe { Box::from_raw(self.contents.err) };
11913 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
11914 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11915 let contents = if o.result_ok {
11916 let result = unsafe { o.contents.result };
11917 unsafe { o.contents.result = std::ptr::null_mut() };
11918 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
11920 let err = unsafe { o.contents.err };
11921 unsafe { o.contents.err = std::ptr::null_mut(); }
11922 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
11926 result_ok: o.result_ok,
11930 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
11931 fn clone(&self) -> Self {
11932 if self.result_ok {
11933 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
11934 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
11937 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
11938 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11944 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
11945 /// but with all dynamically-allocated buffers duplicated in new buffers.
11946 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
11948 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
11949 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11950 /// A pointer to the contents in the success state.
11951 /// Reading from this pointer when `result_ok` is not set is undefined.
11952 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11953 /// A pointer to the contents in the error state.
11954 /// Reading from this pointer when `result_ok` is set is undefined.
11955 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11958 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
11959 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11960 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11961 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11962 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
11963 /// `err` or `result` depending on the state of `result_ok`.
11964 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
11965 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
11966 pub result_ok: bool,
11969 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
11970 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11971 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11972 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11973 result: Box::into_raw(Box::new(o)),
11979 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11980 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11981 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11982 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11983 err: Box::into_raw(Box::new(e)),
11988 /// Checks if the given object is currently in the success state
11990 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
11994 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
11995 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
11996 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11997 fn drop(&mut self) {
11998 if self.result_ok {
11999 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12000 let _ = unsafe { Box::from_raw(self.contents.result) };
12003 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12004 let _ = unsafe { Box::from_raw(self.contents.err) };
12009 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12010 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12011 let contents = if o.result_ok {
12012 let result = unsafe { o.contents.result };
12013 unsafe { o.contents.result = std::ptr::null_mut() };
12014 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
12016 let err = unsafe { o.contents.err };
12017 unsafe { o.contents.err = std::ptr::null_mut(); }
12018 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
12022 result_ok: o.result_ok,
12026 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12027 fn clone(&self) -> Self {
12028 if self.result_ok {
12029 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12030 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
12033 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12034 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12040 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
12041 /// but with all dynamically-allocated buffers duplicated in new buffers.
12042 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
12044 /// The contents of CResult_UpdateFeeDecodeErrorZ
12045 pub union CResult_UpdateFeeDecodeErrorZPtr {
12046 /// A pointer to the contents in the success state.
12047 /// Reading from this pointer when `result_ok` is not set is undefined.
12048 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
12049 /// A pointer to the contents in the error state.
12050 /// Reading from this pointer when `result_ok` is set is undefined.
12051 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12054 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
12055 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
12056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12057 pub struct CResult_UpdateFeeDecodeErrorZ {
12058 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
12059 /// `err` or `result` depending on the state of `result_ok`.
12060 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
12061 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
12062 pub result_ok: bool,
12065 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
12066 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
12067 CResult_UpdateFeeDecodeErrorZ {
12068 contents: CResult_UpdateFeeDecodeErrorZPtr {
12069 result: Box::into_raw(Box::new(o)),
12075 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
12076 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
12077 CResult_UpdateFeeDecodeErrorZ {
12078 contents: CResult_UpdateFeeDecodeErrorZPtr {
12079 err: Box::into_raw(Box::new(e)),
12084 /// Checks if the given object is currently in the success state
12086 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
12090 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
12091 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
12092 impl Drop for CResult_UpdateFeeDecodeErrorZ {
12093 fn drop(&mut self) {
12094 if self.result_ok {
12095 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12096 let _ = unsafe { Box::from_raw(self.contents.result) };
12099 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12100 let _ = unsafe { Box::from_raw(self.contents.err) };
12105 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
12106 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
12107 let contents = if o.result_ok {
12108 let result = unsafe { o.contents.result };
12109 unsafe { o.contents.result = std::ptr::null_mut() };
12110 CResult_UpdateFeeDecodeErrorZPtr { result }
12112 let err = unsafe { o.contents.err };
12113 unsafe { o.contents.err = std::ptr::null_mut(); }
12114 CResult_UpdateFeeDecodeErrorZPtr { err }
12118 result_ok: o.result_ok,
12122 impl Clone for CResult_UpdateFeeDecodeErrorZ {
12123 fn clone(&self) -> Self {
12124 if self.result_ok {
12125 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
12126 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
12129 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
12130 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12136 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
12137 /// but with all dynamically-allocated buffers duplicated in new buffers.
12138 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
12140 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
12141 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12142 /// A pointer to the contents in the success state.
12143 /// Reading from this pointer when `result_ok` is not set is undefined.
12144 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12145 /// A pointer to the contents in the error state.
12146 /// Reading from this pointer when `result_ok` is set is undefined.
12147 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12150 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
12151 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12152 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12153 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
12154 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
12155 /// `err` or `result` depending on the state of `result_ok`.
12156 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
12157 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
12158 pub result_ok: bool,
12161 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
12162 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12163 CResult_UpdateFulfillHTLCDecodeErrorZ {
12164 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12165 result: Box::into_raw(Box::new(o)),
12171 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
12172 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12173 CResult_UpdateFulfillHTLCDecodeErrorZ {
12174 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12175 err: Box::into_raw(Box::new(e)),
12180 /// Checks if the given object is currently in the success state
12182 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
12186 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
12187 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
12188 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
12189 fn drop(&mut self) {
12190 if self.result_ok {
12191 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12192 let _ = unsafe { Box::from_raw(self.contents.result) };
12195 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12196 let _ = unsafe { Box::from_raw(self.contents.err) };
12201 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
12202 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12203 let contents = if o.result_ok {
12204 let result = unsafe { o.contents.result };
12205 unsafe { o.contents.result = std::ptr::null_mut() };
12206 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
12208 let err = unsafe { o.contents.err };
12209 unsafe { o.contents.err = std::ptr::null_mut(); }
12210 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
12214 result_ok: o.result_ok,
12218 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
12219 fn clone(&self) -> Self {
12220 if self.result_ok {
12221 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12222 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
12225 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12226 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12232 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
12233 /// but with all dynamically-allocated buffers duplicated in new buffers.
12234 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
12236 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
12237 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
12238 /// A pointer to the contents in the success state.
12239 /// Reading from this pointer when `result_ok` is not set is undefined.
12240 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12241 /// A pointer to the contents in the error state.
12242 /// Reading from this pointer when `result_ok` is set is undefined.
12243 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12246 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
12247 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12249 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
12250 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
12251 /// `err` or `result` depending on the state of `result_ok`.
12252 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
12253 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
12254 pub result_ok: bool,
12257 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
12258 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
12259 CResult_UpdateAddHTLCDecodeErrorZ {
12260 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12261 result: Box::into_raw(Box::new(o)),
12267 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
12268 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
12269 CResult_UpdateAddHTLCDecodeErrorZ {
12270 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12271 err: Box::into_raw(Box::new(e)),
12276 /// Checks if the given object is currently in the success state
12278 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
12282 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
12283 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
12284 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
12285 fn drop(&mut self) {
12286 if self.result_ok {
12287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12288 let _ = unsafe { Box::from_raw(self.contents.result) };
12291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12292 let _ = unsafe { Box::from_raw(self.contents.err) };
12297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
12298 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12299 let contents = if o.result_ok {
12300 let result = unsafe { o.contents.result };
12301 unsafe { o.contents.result = std::ptr::null_mut() };
12302 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
12304 let err = unsafe { o.contents.err };
12305 unsafe { o.contents.err = std::ptr::null_mut(); }
12306 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
12310 result_ok: o.result_ok,
12314 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
12315 fn clone(&self) -> Self {
12316 if self.result_ok {
12317 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12318 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
12321 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12322 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12328 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
12329 /// but with all dynamically-allocated buffers duplicated in new buffers.
12330 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
12332 /// The contents of CResult_PingDecodeErrorZ
12333 pub union CResult_PingDecodeErrorZPtr {
12334 /// A pointer to the contents in the success state.
12335 /// Reading from this pointer when `result_ok` is not set is undefined.
12336 pub result: *mut crate::lightning::ln::msgs::Ping,
12337 /// A pointer to the contents in the error state.
12338 /// Reading from this pointer when `result_ok` is set is undefined.
12339 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12342 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
12343 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
12344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12345 pub struct CResult_PingDecodeErrorZ {
12346 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
12347 /// `err` or `result` depending on the state of `result_ok`.
12348 pub contents: CResult_PingDecodeErrorZPtr,
12349 /// Whether this CResult_PingDecodeErrorZ represents a success state.
12350 pub result_ok: bool,
12353 /// Creates a new CResult_PingDecodeErrorZ in the success state.
12354 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
12355 CResult_PingDecodeErrorZ {
12356 contents: CResult_PingDecodeErrorZPtr {
12357 result: Box::into_raw(Box::new(o)),
12363 /// Creates a new CResult_PingDecodeErrorZ in the error state.
12364 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
12365 CResult_PingDecodeErrorZ {
12366 contents: CResult_PingDecodeErrorZPtr {
12367 err: Box::into_raw(Box::new(e)),
12372 /// Checks if the given object is currently in the success state
12374 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
12378 /// Frees any resources used by the CResult_PingDecodeErrorZ.
12379 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
12380 impl Drop for CResult_PingDecodeErrorZ {
12381 fn drop(&mut self) {
12382 if self.result_ok {
12383 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12384 let _ = unsafe { Box::from_raw(self.contents.result) };
12387 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12388 let _ = unsafe { Box::from_raw(self.contents.err) };
12393 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
12394 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
12395 let contents = if o.result_ok {
12396 let result = unsafe { o.contents.result };
12397 unsafe { o.contents.result = std::ptr::null_mut() };
12398 CResult_PingDecodeErrorZPtr { result }
12400 let err = unsafe { o.contents.err };
12401 unsafe { o.contents.err = std::ptr::null_mut(); }
12402 CResult_PingDecodeErrorZPtr { err }
12406 result_ok: o.result_ok,
12410 impl Clone for CResult_PingDecodeErrorZ {
12411 fn clone(&self) -> Self {
12412 if self.result_ok {
12413 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
12414 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
12417 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
12418 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12424 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
12425 /// but with all dynamically-allocated buffers duplicated in new buffers.
12426 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
12428 /// The contents of CResult_PongDecodeErrorZ
12429 pub union CResult_PongDecodeErrorZPtr {
12430 /// A pointer to the contents in the success state.
12431 /// Reading from this pointer when `result_ok` is not set is undefined.
12432 pub result: *mut crate::lightning::ln::msgs::Pong,
12433 /// A pointer to the contents in the error state.
12434 /// Reading from this pointer when `result_ok` is set is undefined.
12435 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12438 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
12439 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
12440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12441 pub struct CResult_PongDecodeErrorZ {
12442 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
12443 /// `err` or `result` depending on the state of `result_ok`.
12444 pub contents: CResult_PongDecodeErrorZPtr,
12445 /// Whether this CResult_PongDecodeErrorZ represents a success state.
12446 pub result_ok: bool,
12449 /// Creates a new CResult_PongDecodeErrorZ in the success state.
12450 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
12451 CResult_PongDecodeErrorZ {
12452 contents: CResult_PongDecodeErrorZPtr {
12453 result: Box::into_raw(Box::new(o)),
12459 /// Creates a new CResult_PongDecodeErrorZ in the error state.
12460 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
12461 CResult_PongDecodeErrorZ {
12462 contents: CResult_PongDecodeErrorZPtr {
12463 err: Box::into_raw(Box::new(e)),
12468 /// Checks if the given object is currently in the success state
12470 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
12474 /// Frees any resources used by the CResult_PongDecodeErrorZ.
12475 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
12476 impl Drop for CResult_PongDecodeErrorZ {
12477 fn drop(&mut self) {
12478 if self.result_ok {
12479 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12480 let _ = unsafe { Box::from_raw(self.contents.result) };
12483 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12484 let _ = unsafe { Box::from_raw(self.contents.err) };
12489 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
12490 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
12491 let contents = if o.result_ok {
12492 let result = unsafe { o.contents.result };
12493 unsafe { o.contents.result = std::ptr::null_mut() };
12494 CResult_PongDecodeErrorZPtr { result }
12496 let err = unsafe { o.contents.err };
12497 unsafe { o.contents.err = std::ptr::null_mut(); }
12498 CResult_PongDecodeErrorZPtr { err }
12502 result_ok: o.result_ok,
12506 impl Clone for CResult_PongDecodeErrorZ {
12507 fn clone(&self) -> Self {
12508 if self.result_ok {
12509 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
12510 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
12513 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
12514 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12520 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
12521 /// but with all dynamically-allocated buffers duplicated in new buffers.
12522 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
12524 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
12525 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12526 /// A pointer to the contents in the success state.
12527 /// Reading from this pointer when `result_ok` is not set is undefined.
12528 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
12529 /// A pointer to the contents in the error state.
12530 /// Reading from this pointer when `result_ok` is set is undefined.
12531 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12534 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12535 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12537 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12538 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
12539 /// `err` or `result` depending on the state of `result_ok`.
12540 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
12541 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
12542 pub result_ok: bool,
12545 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
12546 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12547 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12548 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12549 result: Box::into_raw(Box::new(o)),
12555 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
12556 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12557 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12558 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12559 err: Box::into_raw(Box::new(e)),
12564 /// Checks if the given object is currently in the success state
12566 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
12570 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
12571 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
12572 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12573 fn drop(&mut self) {
12574 if self.result_ok {
12575 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12576 let _ = unsafe { Box::from_raw(self.contents.result) };
12579 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12580 let _ = unsafe { Box::from_raw(self.contents.err) };
12585 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12586 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12587 let contents = if o.result_ok {
12588 let result = unsafe { o.contents.result };
12589 unsafe { o.contents.result = std::ptr::null_mut() };
12590 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
12592 let err = unsafe { o.contents.err };
12593 unsafe { o.contents.err = std::ptr::null_mut(); }
12594 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
12598 result_ok: o.result_ok,
12602 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12603 fn clone(&self) -> Self {
12604 if self.result_ok {
12605 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12606 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
12609 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12610 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12616 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
12617 /// but with all dynamically-allocated buffers duplicated in new buffers.
12618 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12620 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
12621 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
12622 /// A pointer to the contents in the success state.
12623 /// Reading from this pointer when `result_ok` is not set is undefined.
12624 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
12625 /// A pointer to the contents in the error state.
12626 /// Reading from this pointer when `result_ok` is set is undefined.
12627 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12630 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12631 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12632 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12633 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
12634 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
12635 /// `err` or `result` depending on the state of `result_ok`.
12636 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
12637 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
12638 pub result_ok: bool,
12641 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
12642 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
12643 CResult_ChannelAnnouncementDecodeErrorZ {
12644 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
12645 result: Box::into_raw(Box::new(o)),
12651 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
12652 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
12653 CResult_ChannelAnnouncementDecodeErrorZ {
12654 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
12655 err: Box::into_raw(Box::new(e)),
12660 /// Checks if the given object is currently in the success state
12662 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
12666 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
12667 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
12668 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
12669 fn drop(&mut self) {
12670 if self.result_ok {
12671 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12672 let _ = unsafe { Box::from_raw(self.contents.result) };
12675 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12676 let _ = unsafe { Box::from_raw(self.contents.err) };
12681 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
12682 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12683 let contents = if o.result_ok {
12684 let result = unsafe { o.contents.result };
12685 unsafe { o.contents.result = std::ptr::null_mut() };
12686 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
12688 let err = unsafe { o.contents.err };
12689 unsafe { o.contents.err = std::ptr::null_mut(); }
12690 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
12694 result_ok: o.result_ok,
12698 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
12699 fn clone(&self) -> Self {
12700 if self.result_ok {
12701 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
12702 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
12705 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
12706 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12712 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
12713 /// but with all dynamically-allocated buffers duplicated in new buffers.
12714 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12716 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
12717 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12718 /// A pointer to the contents in the success state.
12719 /// Reading from this pointer when `result_ok` is not set is undefined.
12720 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
12721 /// A pointer to the contents in the error state.
12722 /// Reading from this pointer when `result_ok` is set is undefined.
12723 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12726 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12727 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12729 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
12730 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
12731 /// `err` or `result` depending on the state of `result_ok`.
12732 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
12733 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
12734 pub result_ok: bool,
12737 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
12738 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
12739 CResult_UnsignedChannelUpdateDecodeErrorZ {
12740 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12741 result: Box::into_raw(Box::new(o)),
12747 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
12748 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
12749 CResult_UnsignedChannelUpdateDecodeErrorZ {
12750 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12751 err: Box::into_raw(Box::new(e)),
12756 /// Checks if the given object is currently in the success state
12758 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
12762 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
12763 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
12764 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
12765 fn drop(&mut self) {
12766 if self.result_ok {
12767 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12768 let _ = unsafe { Box::from_raw(self.contents.result) };
12771 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12772 let _ = unsafe { Box::from_raw(self.contents.err) };
12777 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
12778 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12779 let contents = if o.result_ok {
12780 let result = unsafe { o.contents.result };
12781 unsafe { o.contents.result = std::ptr::null_mut() };
12782 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
12784 let err = unsafe { o.contents.err };
12785 unsafe { o.contents.err = std::ptr::null_mut(); }
12786 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
12790 result_ok: o.result_ok,
12794 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
12795 fn clone(&self) -> Self {
12796 if self.result_ok {
12797 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12798 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
12801 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12802 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12808 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
12809 /// but with all dynamically-allocated buffers duplicated in new buffers.
12810 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
12812 /// The contents of CResult_ChannelUpdateDecodeErrorZ
12813 pub union CResult_ChannelUpdateDecodeErrorZPtr {
12814 /// A pointer to the contents in the success state.
12815 /// Reading from this pointer when `result_ok` is not set is undefined.
12816 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
12817 /// A pointer to the contents in the error state.
12818 /// Reading from this pointer when `result_ok` is set is undefined.
12819 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12822 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12823 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12825 pub struct CResult_ChannelUpdateDecodeErrorZ {
12826 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
12827 /// `err` or `result` depending on the state of `result_ok`.
12828 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
12829 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
12830 pub result_ok: bool,
12833 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
12834 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
12835 CResult_ChannelUpdateDecodeErrorZ {
12836 contents: CResult_ChannelUpdateDecodeErrorZPtr {
12837 result: Box::into_raw(Box::new(o)),
12843 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
12844 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
12845 CResult_ChannelUpdateDecodeErrorZ {
12846 contents: CResult_ChannelUpdateDecodeErrorZPtr {
12847 err: Box::into_raw(Box::new(e)),
12852 /// Checks if the given object is currently in the success state
12854 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
12858 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
12859 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
12860 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
12861 fn drop(&mut self) {
12862 if self.result_ok {
12863 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12864 let _ = unsafe { Box::from_raw(self.contents.result) };
12867 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12868 let _ = unsafe { Box::from_raw(self.contents.err) };
12873 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
12874 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12875 let contents = if o.result_ok {
12876 let result = unsafe { o.contents.result };
12877 unsafe { o.contents.result = std::ptr::null_mut() };
12878 CResult_ChannelUpdateDecodeErrorZPtr { result }
12880 let err = unsafe { o.contents.err };
12881 unsafe { o.contents.err = std::ptr::null_mut(); }
12882 CResult_ChannelUpdateDecodeErrorZPtr { err }
12886 result_ok: o.result_ok,
12890 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
12891 fn clone(&self) -> Self {
12892 if self.result_ok {
12893 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
12894 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
12897 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
12898 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12904 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
12905 /// but with all dynamically-allocated buffers duplicated in new buffers.
12906 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
12908 /// The contents of CResult_ErrorMessageDecodeErrorZ
12909 pub union CResult_ErrorMessageDecodeErrorZPtr {
12910 /// A pointer to the contents in the success state.
12911 /// Reading from this pointer when `result_ok` is not set is undefined.
12912 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
12913 /// A pointer to the contents in the error state.
12914 /// Reading from this pointer when `result_ok` is set is undefined.
12915 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12918 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
12919 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12920 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12921 pub struct CResult_ErrorMessageDecodeErrorZ {
12922 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
12923 /// `err` or `result` depending on the state of `result_ok`.
12924 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
12925 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
12926 pub result_ok: bool,
12929 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
12930 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
12931 CResult_ErrorMessageDecodeErrorZ {
12932 contents: CResult_ErrorMessageDecodeErrorZPtr {
12933 result: Box::into_raw(Box::new(o)),
12939 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
12940 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
12941 CResult_ErrorMessageDecodeErrorZ {
12942 contents: CResult_ErrorMessageDecodeErrorZPtr {
12943 err: Box::into_raw(Box::new(e)),
12948 /// Checks if the given object is currently in the success state
12950 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
12954 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
12955 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
12956 impl Drop for CResult_ErrorMessageDecodeErrorZ {
12957 fn drop(&mut self) {
12958 if self.result_ok {
12959 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12960 let _ = unsafe { Box::from_raw(self.contents.result) };
12963 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12964 let _ = unsafe { Box::from_raw(self.contents.err) };
12969 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
12970 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
12971 let contents = if o.result_ok {
12972 let result = unsafe { o.contents.result };
12973 unsafe { o.contents.result = std::ptr::null_mut() };
12974 CResult_ErrorMessageDecodeErrorZPtr { result }
12976 let err = unsafe { o.contents.err };
12977 unsafe { o.contents.err = std::ptr::null_mut(); }
12978 CResult_ErrorMessageDecodeErrorZPtr { err }
12982 result_ok: o.result_ok,
12986 impl Clone for CResult_ErrorMessageDecodeErrorZ {
12987 fn clone(&self) -> Self {
12988 if self.result_ok {
12989 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
12990 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
12993 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
12994 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13000 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13001 /// but with all dynamically-allocated buffers duplicated in new buffers.
13002 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
13004 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
13005 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13006 /// A pointer to the contents in the success state.
13007 /// Reading from this pointer when `result_ok` is not set is undefined.
13008 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
13009 /// A pointer to the contents in the error state.
13010 /// Reading from this pointer when `result_ok` is set is undefined.
13011 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13014 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13015 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13016 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13017 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13018 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
13019 /// `err` or `result` depending on the state of `result_ok`.
13020 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
13021 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
13022 pub result_ok: bool,
13025 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13026 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13027 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13028 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13029 result: Box::into_raw(Box::new(o)),
13035 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13036 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13037 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13038 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13039 err: Box::into_raw(Box::new(e)),
13044 /// Checks if the given object is currently in the success state
13046 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
13050 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13051 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
13052 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13053 fn drop(&mut self) {
13054 if self.result_ok {
13055 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13056 let _ = unsafe { Box::from_raw(self.contents.result) };
13059 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13060 let _ = unsafe { Box::from_raw(self.contents.err) };
13065 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13066 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13067 let contents = if o.result_ok {
13068 let result = unsafe { o.contents.result };
13069 unsafe { o.contents.result = std::ptr::null_mut() };
13070 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
13072 let err = unsafe { o.contents.err };
13073 unsafe { o.contents.err = std::ptr::null_mut(); }
13074 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
13078 result_ok: o.result_ok,
13082 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13083 fn clone(&self) -> Self {
13084 if self.result_ok {
13085 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13086 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13089 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13090 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13096 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13097 /// but with all dynamically-allocated buffers duplicated in new buffers.
13098 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13100 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
13101 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
13102 /// A pointer to the contents in the success state.
13103 /// Reading from this pointer when `result_ok` is not set is undefined.
13104 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
13105 /// A pointer to the contents in the error state.
13106 /// Reading from this pointer when `result_ok` is set is undefined.
13107 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13110 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13111 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13112 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13113 pub struct CResult_NodeAnnouncementDecodeErrorZ {
13114 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
13115 /// `err` or `result` depending on the state of `result_ok`.
13116 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
13117 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
13118 pub result_ok: bool,
13121 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13122 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
13123 CResult_NodeAnnouncementDecodeErrorZ {
13124 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13125 result: Box::into_raw(Box::new(o)),
13131 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13132 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
13133 CResult_NodeAnnouncementDecodeErrorZ {
13134 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13135 err: Box::into_raw(Box::new(e)),
13140 /// Checks if the given object is currently in the success state
13142 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
13146 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13147 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
13148 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
13149 fn drop(&mut self) {
13150 if self.result_ok {
13151 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13152 let _ = unsafe { Box::from_raw(self.contents.result) };
13155 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13156 let _ = unsafe { Box::from_raw(self.contents.err) };
13161 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
13162 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13163 let contents = if o.result_ok {
13164 let result = unsafe { o.contents.result };
13165 unsafe { o.contents.result = std::ptr::null_mut() };
13166 CResult_NodeAnnouncementDecodeErrorZPtr { result }
13168 let err = unsafe { o.contents.err };
13169 unsafe { o.contents.err = std::ptr::null_mut(); }
13170 CResult_NodeAnnouncementDecodeErrorZPtr { err }
13174 result_ok: o.result_ok,
13178 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
13179 fn clone(&self) -> Self {
13180 if self.result_ok {
13181 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13182 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13185 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13186 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13192 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13193 /// but with all dynamically-allocated buffers duplicated in new buffers.
13194 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13196 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
13197 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
13198 /// A pointer to the contents in the success state.
13199 /// Reading from this pointer when `result_ok` is not set is undefined.
13200 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
13201 /// A pointer to the contents in the error state.
13202 /// Reading from this pointer when `result_ok` is set is undefined.
13203 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13206 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
13207 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
13208 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13209 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
13210 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
13211 /// `err` or `result` depending on the state of `result_ok`.
13212 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
13213 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
13214 pub result_ok: bool,
13217 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13218 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13219 CResult_QueryShortChannelIdsDecodeErrorZ {
13220 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13221 result: Box::into_raw(Box::new(o)),
13227 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13228 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13229 CResult_QueryShortChannelIdsDecodeErrorZ {
13230 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13231 err: Box::into_raw(Box::new(e)),
13236 /// Checks if the given object is currently in the success state
13238 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
13242 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13243 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
13244 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
13245 fn drop(&mut self) {
13246 if self.result_ok {
13247 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13248 let _ = unsafe { Box::from_raw(self.contents.result) };
13251 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13252 let _ = unsafe { Box::from_raw(self.contents.err) };
13257 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
13258 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
13259 let contents = if o.result_ok {
13260 let result = unsafe { o.contents.result };
13261 unsafe { o.contents.result = std::ptr::null_mut() };
13262 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
13264 let err = unsafe { o.contents.err };
13265 unsafe { o.contents.err = std::ptr::null_mut(); }
13266 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
13270 result_ok: o.result_ok,
13274 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
13275 fn clone(&self) -> Self {
13276 if self.result_ok {
13277 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13278 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
13281 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13282 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13288 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13289 /// but with all dynamically-allocated buffers duplicated in new buffers.
13290 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
13292 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
13293 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13294 /// A pointer to the contents in the success state.
13295 /// Reading from this pointer when `result_ok` is not set is undefined.
13296 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
13297 /// A pointer to the contents in the error state.
13298 /// Reading from this pointer when `result_ok` is set is undefined.
13299 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13302 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
13303 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
13304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13305 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13306 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
13307 /// `err` or `result` depending on the state of `result_ok`.
13308 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
13309 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
13310 pub result_ok: bool,
13313 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13314 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13315 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13316 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13317 result: Box::into_raw(Box::new(o)),
13323 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13324 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13325 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13326 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13327 err: Box::into_raw(Box::new(e)),
13332 /// Checks if the given object is currently in the success state
13334 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
13338 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13339 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
13340 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13341 fn drop(&mut self) {
13342 if self.result_ok {
13343 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13344 let _ = unsafe { Box::from_raw(self.contents.result) };
13347 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13348 let _ = unsafe { Box::from_raw(self.contents.err) };
13353 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13354 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
13355 let contents = if o.result_ok {
13356 let result = unsafe { o.contents.result };
13357 unsafe { o.contents.result = std::ptr::null_mut() };
13358 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
13360 let err = unsafe { o.contents.err };
13361 unsafe { o.contents.err = std::ptr::null_mut(); }
13362 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
13366 result_ok: o.result_ok,
13370 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13371 fn clone(&self) -> Self {
13372 if self.result_ok {
13373 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13374 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
13377 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13378 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13384 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13385 /// but with all dynamically-allocated buffers duplicated in new buffers.
13386 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
13388 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
13389 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
13390 /// A pointer to the contents in the success state.
13391 /// Reading from this pointer when `result_ok` is not set is undefined.
13392 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
13393 /// A pointer to the contents in the error state.
13394 /// Reading from this pointer when `result_ok` is set is undefined.
13395 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13398 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
13399 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13401 pub struct CResult_QueryChannelRangeDecodeErrorZ {
13402 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
13403 /// `err` or `result` depending on the state of `result_ok`.
13404 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
13405 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
13406 pub result_ok: bool,
13409 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13410 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
13411 CResult_QueryChannelRangeDecodeErrorZ {
13412 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13413 result: Box::into_raw(Box::new(o)),
13419 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13420 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
13421 CResult_QueryChannelRangeDecodeErrorZ {
13422 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13423 err: Box::into_raw(Box::new(e)),
13428 /// Checks if the given object is currently in the success state
13430 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
13434 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13435 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
13436 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
13437 fn drop(&mut self) {
13438 if self.result_ok {
13439 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13440 let _ = unsafe { Box::from_raw(self.contents.result) };
13443 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13444 let _ = unsafe { Box::from_raw(self.contents.err) };
13449 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
13450 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13451 let contents = if o.result_ok {
13452 let result = unsafe { o.contents.result };
13453 unsafe { o.contents.result = std::ptr::null_mut() };
13454 CResult_QueryChannelRangeDecodeErrorZPtr { result }
13456 let err = unsafe { o.contents.err };
13457 unsafe { o.contents.err = std::ptr::null_mut(); }
13458 CResult_QueryChannelRangeDecodeErrorZPtr { err }
13462 result_ok: o.result_ok,
13466 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
13467 fn clone(&self) -> Self {
13468 if self.result_ok {
13469 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13470 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
13473 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13474 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13480 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13481 /// but with all dynamically-allocated buffers duplicated in new buffers.
13482 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13484 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
13485 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
13486 /// A pointer to the contents in the success state.
13487 /// Reading from this pointer when `result_ok` is not set is undefined.
13488 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
13489 /// A pointer to the contents in the error state.
13490 /// Reading from this pointer when `result_ok` is set is undefined.
13491 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13494 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
13495 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13497 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
13498 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
13499 /// `err` or `result` depending on the state of `result_ok`.
13500 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
13501 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
13502 pub result_ok: bool,
13505 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13506 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
13507 CResult_ReplyChannelRangeDecodeErrorZ {
13508 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13509 result: Box::into_raw(Box::new(o)),
13515 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13516 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
13517 CResult_ReplyChannelRangeDecodeErrorZ {
13518 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13519 err: Box::into_raw(Box::new(e)),
13524 /// Checks if the given object is currently in the success state
13526 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
13530 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13531 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
13532 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
13533 fn drop(&mut self) {
13534 if self.result_ok {
13535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13536 let _ = unsafe { Box::from_raw(self.contents.result) };
13539 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13540 let _ = unsafe { Box::from_raw(self.contents.err) };
13545 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
13546 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13547 let contents = if o.result_ok {
13548 let result = unsafe { o.contents.result };
13549 unsafe { o.contents.result = std::ptr::null_mut() };
13550 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
13552 let err = unsafe { o.contents.err };
13553 unsafe { o.contents.err = std::ptr::null_mut(); }
13554 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
13558 result_ok: o.result_ok,
13562 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
13563 fn clone(&self) -> Self {
13564 if self.result_ok {
13565 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13566 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
13569 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13570 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13576 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13577 /// but with all dynamically-allocated buffers duplicated in new buffers.
13578 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13580 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
13581 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
13582 /// A pointer to the contents in the success state.
13583 /// Reading from this pointer when `result_ok` is not set is undefined.
13584 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
13585 /// A pointer to the contents in the error state.
13586 /// Reading from this pointer when `result_ok` is set is undefined.
13587 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13590 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
13591 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
13592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13593 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
13594 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
13595 /// `err` or `result` depending on the state of `result_ok`.
13596 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
13597 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
13598 pub result_ok: bool,
13601 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
13602 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
13603 CResult_GossipTimestampFilterDecodeErrorZ {
13604 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
13605 result: Box::into_raw(Box::new(o)),
13611 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
13612 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
13613 CResult_GossipTimestampFilterDecodeErrorZ {
13614 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
13615 err: Box::into_raw(Box::new(e)),
13620 /// Checks if the given object is currently in the success state
13622 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
13626 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
13627 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
13628 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
13629 fn drop(&mut self) {
13630 if self.result_ok {
13631 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13632 let _ = unsafe { Box::from_raw(self.contents.result) };
13635 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13636 let _ = unsafe { Box::from_raw(self.contents.err) };
13641 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
13642 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
13643 let contents = if o.result_ok {
13644 let result = unsafe { o.contents.result };
13645 unsafe { o.contents.result = std::ptr::null_mut() };
13646 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
13648 let err = unsafe { o.contents.err };
13649 unsafe { o.contents.err = std::ptr::null_mut(); }
13650 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
13654 result_ok: o.result_ok,
13658 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
13659 fn clone(&self) -> Self {
13660 if self.result_ok {
13661 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
13662 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
13665 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
13666 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13672 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
13673 /// but with all dynamically-allocated buffers duplicated in new buffers.
13674 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
13676 /// The contents of CResult_InvoiceSignOrCreationErrorZ
13677 pub union CResult_InvoiceSignOrCreationErrorZPtr {
13678 /// A pointer to the contents in the success state.
13679 /// Reading from this pointer when `result_ok` is not set is undefined.
13680 pub result: *mut crate::lightning_invoice::Invoice,
13681 /// A pointer to the contents in the error state.
13682 /// Reading from this pointer when `result_ok` is set is undefined.
13683 pub err: *mut crate::lightning_invoice::SignOrCreationError,
13686 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
13687 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
13688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13689 pub struct CResult_InvoiceSignOrCreationErrorZ {
13690 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
13691 /// `err` or `result` depending on the state of `result_ok`.
13692 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
13693 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
13694 pub result_ok: bool,
13697 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
13698 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
13699 CResult_InvoiceSignOrCreationErrorZ {
13700 contents: CResult_InvoiceSignOrCreationErrorZPtr {
13701 result: Box::into_raw(Box::new(o)),
13707 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
13708 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
13709 CResult_InvoiceSignOrCreationErrorZ {
13710 contents: CResult_InvoiceSignOrCreationErrorZPtr {
13711 err: Box::into_raw(Box::new(e)),
13716 /// Checks if the given object is currently in the success state
13718 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
13722 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
13723 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
13724 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
13725 fn drop(&mut self) {
13726 if self.result_ok {
13727 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13728 let _ = unsafe { Box::from_raw(self.contents.result) };
13731 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13732 let _ = unsafe { Box::from_raw(self.contents.err) };
13737 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
13738 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
13739 let contents = if o.result_ok {
13740 let result = unsafe { o.contents.result };
13741 unsafe { o.contents.result = std::ptr::null_mut() };
13742 CResult_InvoiceSignOrCreationErrorZPtr { result }
13744 let err = unsafe { o.contents.err };
13745 unsafe { o.contents.err = std::ptr::null_mut(); }
13746 CResult_InvoiceSignOrCreationErrorZPtr { err }
13750 result_ok: o.result_ok,
13754 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
13755 fn clone(&self) -> Self {
13756 if self.result_ok {
13757 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
13758 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
13761 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
13762 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
13768 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
13769 /// but with all dynamically-allocated buffers duplicated in new buffers.
13770 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
13772 /// An enum which can either contain a crate::lightning::chain::Filter or not
13773 pub enum COption_FilterZ {
13774 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
13775 Some(crate::lightning::chain::Filter),
13776 /// When we're in this state, this COption_FilterZ contains nothing
13779 impl COption_FilterZ {
13780 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13781 if let Self::Some(_) = self { true } else { false }
13783 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13786 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
13787 if let Self::Some(v) = self { v } else { unreachable!() }
13791 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
13792 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
13793 COption_FilterZ::Some(o)
13796 /// Constructs a new COption_FilterZ containing nothing
13797 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
13798 COption_FilterZ::None
13801 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
13802 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
13804 /// The contents of CResult_LockedChannelMonitorNoneZ
13805 pub union CResult_LockedChannelMonitorNoneZPtr {
13806 /// A pointer to the contents in the success state.
13807 /// Reading from this pointer when `result_ok` is not set is undefined.
13808 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
13809 /// Note that this value is always NULL, as there are no contents in the Err variant
13810 pub err: *mut std::ffi::c_void,
13813 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
13814 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
13815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13816 pub struct CResult_LockedChannelMonitorNoneZ {
13817 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
13818 /// `err` or `result` depending on the state of `result_ok`.
13819 pub contents: CResult_LockedChannelMonitorNoneZPtr,
13820 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
13821 pub result_ok: bool,
13824 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
13825 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
13826 CResult_LockedChannelMonitorNoneZ {
13827 contents: CResult_LockedChannelMonitorNoneZPtr {
13828 result: Box::into_raw(Box::new(o)),
13834 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
13835 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
13836 CResult_LockedChannelMonitorNoneZ {
13837 contents: CResult_LockedChannelMonitorNoneZPtr {
13838 err: std::ptr::null_mut(),
13843 /// Checks if the given object is currently in the success state
13845 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
13849 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
13850 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
13851 impl Drop for CResult_LockedChannelMonitorNoneZ {
13852 fn drop(&mut self) {
13853 if self.result_ok {
13854 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13855 let _ = unsafe { Box::from_raw(self.contents.result) };
13861 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
13862 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
13863 let contents = if o.result_ok {
13864 let result = unsafe { o.contents.result };
13865 unsafe { o.contents.result = std::ptr::null_mut() };
13866 CResult_LockedChannelMonitorNoneZPtr { result }
13868 let _ = unsafe { Box::from_raw(o.contents.err) };
13869 o.contents.err = std::ptr::null_mut();
13870 CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
13874 result_ok: o.result_ok,
13879 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
13880 /// This corresponds to std::vector in C++
13881 pub struct CVec_OutPointZ {
13882 /// The elements in the array.
13883 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13884 pub data: *mut crate::lightning::chain::transaction::OutPoint,
13885 /// The number of elements pointed to by `data`.
13888 impl CVec_OutPointZ {
13889 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
13890 if self.datalen == 0 { return Vec::new(); }
13891 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13892 self.data = std::ptr::null_mut();
13896 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
13897 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
13900 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
13901 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
13902 let datalen = v.len();
13903 let data = Box::into_raw(v.into_boxed_slice());
13904 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13908 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13909 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
13910 impl Drop for CVec_OutPointZ {
13911 fn drop(&mut self) {
13912 if self.datalen == 0 { return; }
13913 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
13916 impl Clone for CVec_OutPointZ {
13917 fn clone(&self) -> Self {
13918 let mut res = Vec::new();
13919 if self.datalen == 0 { return Self::from(res); }
13920 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });