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::None = self { false } else { true }
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 /// An enum which can either contain a or not
599 pub enum COption_NoneZ {
600 /// When we're in this state, this COption_NoneZ contains a
602 /// When we're in this state, this COption_NoneZ contains nothing
606 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
607 if let Self::None = self { false } else { true }
609 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
614 /// Constructs a new COption_NoneZ containing a
615 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
619 /// Constructs a new COption_NoneZ containing nothing
620 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
624 /// Frees any resources associated with the , if we are in the Some state
625 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
627 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
628 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
629 /// A pointer to the contents in the success state.
630 /// Reading from this pointer when `result_ok` is not set is undefined.
631 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
632 /// A pointer to the contents in the error state.
633 /// Reading from this pointer when `result_ok` is set is undefined.
634 pub err: *mut crate::lightning::ln::msgs::DecodeError,
637 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
638 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
640 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
641 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
642 /// `err` or `result` depending on the state of `result_ok`.
643 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
644 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
648 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
649 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
650 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
651 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
652 result: Box::into_raw(Box::new(o)),
658 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
659 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
660 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
661 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
662 err: Box::into_raw(Box::new(e)),
667 /// Checks if the given object is currently in the success state
669 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
673 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
674 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
675 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
678 if unsafe { !(self.contents.result as *mut ()).is_null() } {
679 let _ = unsafe { Box::from_raw(self.contents.result) };
682 if unsafe { !(self.contents.err as *mut ()).is_null() } {
683 let _ = unsafe { Box::from_raw(self.contents.err) };
688 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
689 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
690 let contents = if o.result_ok {
691 let result = unsafe { o.contents.result };
692 unsafe { o.contents.result = std::ptr::null_mut() };
693 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
695 let err = unsafe { o.contents.err };
696 unsafe { o.contents.err = std::ptr::null_mut(); }
697 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
701 result_ok: o.result_ok,
705 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
706 fn clone(&self) -> Self {
708 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
709 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
712 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
713 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
719 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
720 /// but with all dynamically-allocated buffers duplicated in new buffers.
721 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
723 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
724 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
725 /// A pointer to the contents in the success state.
726 /// Reading from this pointer when `result_ok` is not set is undefined.
727 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
728 /// A pointer to the contents in the error state.
729 /// Reading from this pointer when `result_ok` is set is undefined.
730 pub err: *mut crate::lightning::ln::msgs::DecodeError,
733 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
734 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
736 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
737 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
738 /// `err` or `result` depending on the state of `result_ok`.
739 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
740 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
744 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
745 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
746 CResult_ChannelTransactionParametersDecodeErrorZ {
747 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
748 result: Box::into_raw(Box::new(o)),
754 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
755 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
756 CResult_ChannelTransactionParametersDecodeErrorZ {
757 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
758 err: Box::into_raw(Box::new(e)),
763 /// Checks if the given object is currently in the success state
765 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
769 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
770 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
771 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
774 if unsafe { !(self.contents.result as *mut ()).is_null() } {
775 let _ = unsafe { Box::from_raw(self.contents.result) };
778 if unsafe { !(self.contents.err as *mut ()).is_null() } {
779 let _ = unsafe { Box::from_raw(self.contents.err) };
784 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
785 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
786 let contents = if o.result_ok {
787 let result = unsafe { o.contents.result };
788 unsafe { o.contents.result = std::ptr::null_mut() };
789 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
791 let err = unsafe { o.contents.err };
792 unsafe { o.contents.err = std::ptr::null_mut(); }
793 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
797 result_ok: o.result_ok,
801 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
802 fn clone(&self) -> Self {
804 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
805 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
808 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
809 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
815 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
816 /// but with all dynamically-allocated buffers duplicated in new buffers.
817 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
819 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
820 /// This corresponds to std::vector in C++
821 pub struct CVec_SignatureZ {
822 /// The elements in the array.
823 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
824 pub data: *mut crate::c_types::Signature,
825 /// The number of elements pointed to by `data`.
828 impl CVec_SignatureZ {
829 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
830 if self.datalen == 0 { return Vec::new(); }
831 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
832 self.data = std::ptr::null_mut();
836 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
837 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
840 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
841 fn from(v: Vec<crate::c_types::Signature>) -> Self {
842 let datalen = v.len();
843 let data = Box::into_raw(v.into_boxed_slice());
844 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
848 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
849 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
850 impl Drop for CVec_SignatureZ {
852 if self.datalen == 0 { return; }
853 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
856 impl Clone for CVec_SignatureZ {
857 fn clone(&self) -> Self {
858 let mut res = Vec::new();
859 if self.datalen == 0 { return Self::from(res); }
860 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
865 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
866 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
867 /// A pointer to the contents in the success state.
868 /// Reading from this pointer when `result_ok` is not set is undefined.
869 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
870 /// A pointer to the contents in the error state.
871 /// Reading from this pointer when `result_ok` is set is undefined.
872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
875 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
876 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
878 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
879 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
880 /// `err` or `result` depending on the state of `result_ok`.
881 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
882 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
886 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
887 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
888 CResult_HolderCommitmentTransactionDecodeErrorZ {
889 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
890 result: Box::into_raw(Box::new(o)),
896 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
897 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
898 CResult_HolderCommitmentTransactionDecodeErrorZ {
899 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
900 err: Box::into_raw(Box::new(e)),
905 /// Checks if the given object is currently in the success state
907 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
911 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
912 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
913 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
917 let _ = unsafe { Box::from_raw(self.contents.result) };
920 if unsafe { !(self.contents.err as *mut ()).is_null() } {
921 let _ = unsafe { Box::from_raw(self.contents.err) };
926 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
927 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
928 let contents = if o.result_ok {
929 let result = unsafe { o.contents.result };
930 unsafe { o.contents.result = std::ptr::null_mut() };
931 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
933 let err = unsafe { o.contents.err };
934 unsafe { o.contents.err = std::ptr::null_mut(); }
935 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
939 result_ok: o.result_ok,
943 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
944 fn clone(&self) -> Self {
946 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
947 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
950 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
951 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
957 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
958 /// but with all dynamically-allocated buffers duplicated in new buffers.
959 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
961 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
962 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
963 /// A pointer to the contents in the success state.
964 /// Reading from this pointer when `result_ok` is not set is undefined.
965 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
966 /// A pointer to the contents in the error state.
967 /// Reading from this pointer when `result_ok` is set is undefined.
968 pub err: *mut crate::lightning::ln::msgs::DecodeError,
971 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
972 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
974 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
975 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
976 /// `err` or `result` depending on the state of `result_ok`.
977 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
978 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
982 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
983 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
984 CResult_BuiltCommitmentTransactionDecodeErrorZ {
985 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
986 result: Box::into_raw(Box::new(o)),
992 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
993 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
994 CResult_BuiltCommitmentTransactionDecodeErrorZ {
995 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
996 err: Box::into_raw(Box::new(e)),
1001 /// Checks if the given object is currently in the success state
1003 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1007 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1008 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1009 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1010 fn drop(&mut self) {
1012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1013 let _ = unsafe { Box::from_raw(self.contents.result) };
1016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1017 let _ = unsafe { Box::from_raw(self.contents.err) };
1022 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1023 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1024 let contents = if o.result_ok {
1025 let result = unsafe { o.contents.result };
1026 unsafe { o.contents.result = std::ptr::null_mut() };
1027 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1029 let err = unsafe { o.contents.err };
1030 unsafe { o.contents.err = std::ptr::null_mut(); }
1031 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1035 result_ok: o.result_ok,
1039 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1040 fn clone(&self) -> Self {
1042 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1043 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1046 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1047 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1053 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1054 /// but with all dynamically-allocated buffers duplicated in new buffers.
1055 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1057 /// The contents of CResult_TrustedClosingTransactionNoneZ
1058 pub union CResult_TrustedClosingTransactionNoneZPtr {
1059 /// A pointer to the contents in the success state.
1060 /// Reading from this pointer when `result_ok` is not set is undefined.
1061 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1062 /// Note that this value is always NULL, as there are no contents in the Err variant
1063 pub err: *mut std::ffi::c_void,
1066 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1067 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1069 pub struct CResult_TrustedClosingTransactionNoneZ {
1070 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1071 /// `err` or `result` depending on the state of `result_ok`.
1072 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1073 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1074 pub result_ok: bool,
1077 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1078 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1079 CResult_TrustedClosingTransactionNoneZ {
1080 contents: CResult_TrustedClosingTransactionNoneZPtr {
1081 result: Box::into_raw(Box::new(o)),
1087 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1088 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1089 CResult_TrustedClosingTransactionNoneZ {
1090 contents: CResult_TrustedClosingTransactionNoneZPtr {
1091 err: std::ptr::null_mut(),
1096 /// Checks if the given object is currently in the success state
1098 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1102 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1103 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1104 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1105 fn drop(&mut self) {
1107 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1108 let _ = unsafe { Box::from_raw(self.contents.result) };
1114 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1115 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1116 let contents = if o.result_ok {
1117 let result = unsafe { o.contents.result };
1118 unsafe { o.contents.result = std::ptr::null_mut() };
1119 CResult_TrustedClosingTransactionNoneZPtr { result }
1121 let _ = unsafe { Box::from_raw(o.contents.err) };
1122 o.contents.err = std::ptr::null_mut();
1123 CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1127 result_ok: o.result_ok,
1132 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1133 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1134 /// A pointer to the contents in the success state.
1135 /// Reading from this pointer when `result_ok` is not set is undefined.
1136 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1137 /// A pointer to the contents in the error state.
1138 /// Reading from this pointer when `result_ok` is set is undefined.
1139 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1142 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1143 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1145 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1146 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1147 /// `err` or `result` depending on the state of `result_ok`.
1148 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1149 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1150 pub result_ok: bool,
1153 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1154 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1155 CResult_CommitmentTransactionDecodeErrorZ {
1156 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1157 result: Box::into_raw(Box::new(o)),
1163 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1164 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1165 CResult_CommitmentTransactionDecodeErrorZ {
1166 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1167 err: Box::into_raw(Box::new(e)),
1172 /// Checks if the given object is currently in the success state
1174 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1178 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1179 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1180 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1181 fn drop(&mut self) {
1183 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1184 let _ = unsafe { Box::from_raw(self.contents.result) };
1187 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1188 let _ = unsafe { Box::from_raw(self.contents.err) };
1193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1194 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1195 let contents = if o.result_ok {
1196 let result = unsafe { o.contents.result };
1197 unsafe { o.contents.result = std::ptr::null_mut() };
1198 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1200 let err = unsafe { o.contents.err };
1201 unsafe { o.contents.err = std::ptr::null_mut(); }
1202 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1206 result_ok: o.result_ok,
1210 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1211 fn clone(&self) -> Self {
1213 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1214 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1217 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1218 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1224 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1225 /// but with all dynamically-allocated buffers duplicated in new buffers.
1226 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1228 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1229 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1230 /// A pointer to the contents in the success state.
1231 /// Reading from this pointer when `result_ok` is not set is undefined.
1232 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1233 /// Note that this value is always NULL, as there are no contents in the Err variant
1234 pub err: *mut std::ffi::c_void,
1237 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1238 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1240 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1241 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1242 /// `err` or `result` depending on the state of `result_ok`.
1243 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1244 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1245 pub result_ok: bool,
1248 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1249 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1250 CResult_TrustedCommitmentTransactionNoneZ {
1251 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1252 result: Box::into_raw(Box::new(o)),
1258 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1259 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1260 CResult_TrustedCommitmentTransactionNoneZ {
1261 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1262 err: std::ptr::null_mut(),
1267 /// Checks if the given object is currently in the success state
1269 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1273 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1274 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1275 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1276 fn drop(&mut self) {
1278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1279 let _ = unsafe { Box::from_raw(self.contents.result) };
1285 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1286 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1287 let contents = if o.result_ok {
1288 let result = unsafe { o.contents.result };
1289 unsafe { o.contents.result = std::ptr::null_mut() };
1290 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1292 let _ = unsafe { Box::from_raw(o.contents.err) };
1293 o.contents.err = std::ptr::null_mut();
1294 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1298 result_ok: o.result_ok,
1303 /// The contents of CResult_CVec_SignatureZNoneZ
1304 pub union CResult_CVec_SignatureZNoneZPtr {
1305 /// A pointer to the contents in the success state.
1306 /// Reading from this pointer when `result_ok` is not set is undefined.
1307 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1308 /// Note that this value is always NULL, as there are no contents in the Err variant
1309 pub err: *mut std::ffi::c_void,
1312 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1313 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1315 pub struct CResult_CVec_SignatureZNoneZ {
1316 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1317 /// `err` or `result` depending on the state of `result_ok`.
1318 pub contents: CResult_CVec_SignatureZNoneZPtr,
1319 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1320 pub result_ok: bool,
1323 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1324 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1325 CResult_CVec_SignatureZNoneZ {
1326 contents: CResult_CVec_SignatureZNoneZPtr {
1327 result: Box::into_raw(Box::new(o)),
1333 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1334 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1335 CResult_CVec_SignatureZNoneZ {
1336 contents: CResult_CVec_SignatureZNoneZPtr {
1337 err: std::ptr::null_mut(),
1342 /// Checks if the given object is currently in the success state
1344 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1348 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1349 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1350 impl Drop for CResult_CVec_SignatureZNoneZ {
1351 fn drop(&mut self) {
1353 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1354 let _ = unsafe { Box::from_raw(self.contents.result) };
1360 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1361 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1362 let contents = if o.result_ok {
1363 let result = unsafe { o.contents.result };
1364 unsafe { o.contents.result = std::ptr::null_mut() };
1365 CResult_CVec_SignatureZNoneZPtr { result }
1367 let _ = unsafe { Box::from_raw(o.contents.err) };
1368 o.contents.err = std::ptr::null_mut();
1369 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1373 result_ok: o.result_ok,
1377 impl Clone for CResult_CVec_SignatureZNoneZ {
1378 fn clone(&self) -> Self {
1380 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1381 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1384 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1385 err: std::ptr::null_mut()
1391 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1392 /// but with all dynamically-allocated buffers duplicated in new buffers.
1393 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1395 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1396 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1397 /// A pointer to the contents in the success state.
1398 /// Reading from this pointer when `result_ok` is not set is undefined.
1399 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1400 /// A pointer to the contents in the error state.
1401 /// Reading from this pointer when `result_ok` is set is undefined.
1402 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1405 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1406 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1408 pub struct CResult_ShutdownScriptDecodeErrorZ {
1409 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1410 /// `err` or `result` depending on the state of `result_ok`.
1411 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1412 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1413 pub result_ok: bool,
1416 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1417 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1418 CResult_ShutdownScriptDecodeErrorZ {
1419 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1420 result: Box::into_raw(Box::new(o)),
1426 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1427 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1428 CResult_ShutdownScriptDecodeErrorZ {
1429 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1430 err: Box::into_raw(Box::new(e)),
1435 /// Checks if the given object is currently in the success state
1437 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1441 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1442 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1443 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1444 fn drop(&mut self) {
1446 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1447 let _ = unsafe { Box::from_raw(self.contents.result) };
1450 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1451 let _ = unsafe { Box::from_raw(self.contents.err) };
1456 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1457 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1458 let contents = if o.result_ok {
1459 let result = unsafe { o.contents.result };
1460 unsafe { o.contents.result = std::ptr::null_mut() };
1461 CResult_ShutdownScriptDecodeErrorZPtr { result }
1463 let err = unsafe { o.contents.err };
1464 unsafe { o.contents.err = std::ptr::null_mut(); }
1465 CResult_ShutdownScriptDecodeErrorZPtr { err }
1469 result_ok: o.result_ok,
1473 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1474 fn clone(&self) -> Self {
1476 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1477 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1480 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1481 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1487 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1488 /// but with all dynamically-allocated buffers duplicated in new buffers.
1489 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1491 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1492 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1493 /// A pointer to the contents in the success state.
1494 /// Reading from this pointer when `result_ok` is not set is undefined.
1495 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1496 /// A pointer to the contents in the error state.
1497 /// Reading from this pointer when `result_ok` is set is undefined.
1498 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1501 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1502 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1504 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1505 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1506 /// `err` or `result` depending on the state of `result_ok`.
1507 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1508 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1509 pub result_ok: bool,
1512 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1513 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1514 CResult_ShutdownScriptInvalidShutdownScriptZ {
1515 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1516 result: Box::into_raw(Box::new(o)),
1522 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1523 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1524 CResult_ShutdownScriptInvalidShutdownScriptZ {
1525 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1526 err: Box::into_raw(Box::new(e)),
1531 /// Checks if the given object is currently in the success state
1533 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1537 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1538 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1539 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1540 fn drop(&mut self) {
1542 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1543 let _ = unsafe { Box::from_raw(self.contents.result) };
1546 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1547 let _ = unsafe { Box::from_raw(self.contents.err) };
1552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1553 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1554 let contents = if o.result_ok {
1555 let result = unsafe { o.contents.result };
1556 unsafe { o.contents.result = std::ptr::null_mut() };
1557 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1559 let err = unsafe { o.contents.err };
1560 unsafe { o.contents.err = std::ptr::null_mut(); }
1561 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1565 result_ok: o.result_ok,
1569 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1570 fn clone(&self) -> Self {
1572 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1573 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1576 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1577 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1583 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1584 /// but with all dynamically-allocated buffers duplicated in new buffers.
1585 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1587 /// The contents of CResult_NoneErrorZ
1588 pub union CResult_NoneErrorZPtr {
1589 /// Note that this value is always NULL, as there are no contents in the OK variant
1590 pub result: *mut std::ffi::c_void,
1591 /// A pointer to the contents in the error state.
1592 /// Reading from this pointer when `result_ok` is set is undefined.
1593 pub err: *mut crate::c_types::IOError,
1596 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1597 /// containing a () on success and a crate::c_types::IOError on failure.
1598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1599 pub struct CResult_NoneErrorZ {
1600 /// The contents of this CResult_NoneErrorZ, accessible via either
1601 /// `err` or `result` depending on the state of `result_ok`.
1602 pub contents: CResult_NoneErrorZPtr,
1603 /// Whether this CResult_NoneErrorZ represents a success state.
1604 pub result_ok: bool,
1607 /// Creates a new CResult_NoneErrorZ in the success state.
1608 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1609 CResult_NoneErrorZ {
1610 contents: CResult_NoneErrorZPtr {
1611 result: std::ptr::null_mut(),
1617 /// Creates a new CResult_NoneErrorZ in the error state.
1618 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1619 CResult_NoneErrorZ {
1620 contents: CResult_NoneErrorZPtr {
1621 err: Box::into_raw(Box::new(e)),
1626 /// Checks if the given object is currently in the success state
1628 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1632 /// Frees any resources used by the CResult_NoneErrorZ.
1633 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1634 impl Drop for CResult_NoneErrorZ {
1635 fn drop(&mut self) {
1638 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1639 let _ = unsafe { Box::from_raw(self.contents.err) };
1644 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1645 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1646 let contents = if o.result_ok {
1647 let _ = unsafe { Box::from_raw(o.contents.result) };
1648 o.contents.result = std::ptr::null_mut();
1649 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1651 let err = unsafe { o.contents.err };
1652 unsafe { o.contents.err = std::ptr::null_mut(); }
1653 CResult_NoneErrorZPtr { err }
1657 result_ok: o.result_ok,
1661 impl Clone for CResult_NoneErrorZ {
1662 fn clone(&self) -> Self {
1664 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1665 result: std::ptr::null_mut()
1668 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1669 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1675 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1676 /// but with all dynamically-allocated buffers duplicated in new buffers.
1677 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1679 /// The contents of CResult_RouteHopDecodeErrorZ
1680 pub union CResult_RouteHopDecodeErrorZPtr {
1681 /// A pointer to the contents in the success state.
1682 /// Reading from this pointer when `result_ok` is not set is undefined.
1683 pub result: *mut crate::lightning::routing::router::RouteHop,
1684 /// A pointer to the contents in the error state.
1685 /// Reading from this pointer when `result_ok` is set is undefined.
1686 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1689 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1690 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1692 pub struct CResult_RouteHopDecodeErrorZ {
1693 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1694 /// `err` or `result` depending on the state of `result_ok`.
1695 pub contents: CResult_RouteHopDecodeErrorZPtr,
1696 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1697 pub result_ok: bool,
1700 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1701 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1702 CResult_RouteHopDecodeErrorZ {
1703 contents: CResult_RouteHopDecodeErrorZPtr {
1704 result: Box::into_raw(Box::new(o)),
1710 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1711 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1712 CResult_RouteHopDecodeErrorZ {
1713 contents: CResult_RouteHopDecodeErrorZPtr {
1714 err: Box::into_raw(Box::new(e)),
1719 /// Checks if the given object is currently in the success state
1721 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1725 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1726 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1727 impl Drop for CResult_RouteHopDecodeErrorZ {
1728 fn drop(&mut self) {
1730 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1731 let _ = unsafe { Box::from_raw(self.contents.result) };
1734 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1735 let _ = unsafe { Box::from_raw(self.contents.err) };
1740 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1741 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1742 let contents = if o.result_ok {
1743 let result = unsafe { o.contents.result };
1744 unsafe { o.contents.result = std::ptr::null_mut() };
1745 CResult_RouteHopDecodeErrorZPtr { result }
1747 let err = unsafe { o.contents.err };
1748 unsafe { o.contents.err = std::ptr::null_mut(); }
1749 CResult_RouteHopDecodeErrorZPtr { err }
1753 result_ok: o.result_ok,
1757 impl Clone for CResult_RouteHopDecodeErrorZ {
1758 fn clone(&self) -> Self {
1760 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1761 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1764 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1765 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1771 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1772 /// but with all dynamically-allocated buffers duplicated in new buffers.
1773 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1775 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1776 /// This corresponds to std::vector in C++
1777 pub struct CVec_RouteHopZ {
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::lightning::routing::router::RouteHop,
1781 /// The number of elements pointed to by `data`.
1784 impl CVec_RouteHopZ {
1785 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
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::lightning::routing::router::RouteHop] {
1793 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1796 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1797 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> 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_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1806 impl Drop for CVec_RouteHopZ {
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_RouteHopZ {
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 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1822 /// This corresponds to std::vector in C++
1823 pub struct CVec_CVec_RouteHopZZ {
1824 /// The elements in the array.
1825 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1826 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1827 /// The number of elements pointed to by `data`.
1830 impl CVec_CVec_RouteHopZZ {
1831 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1832 if self.datalen == 0 { return Vec::new(); }
1833 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1834 self.data = std::ptr::null_mut();
1838 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1839 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1842 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1843 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1844 let datalen = v.len();
1845 let data = Box::into_raw(v.into_boxed_slice());
1846 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1850 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1851 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1852 impl Drop for CVec_CVec_RouteHopZZ {
1853 fn drop(&mut self) {
1854 if self.datalen == 0 { return; }
1855 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1858 impl Clone for CVec_CVec_RouteHopZZ {
1859 fn clone(&self) -> Self {
1860 let mut res = Vec::new();
1861 if self.datalen == 0 { return Self::from(res); }
1862 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1867 /// The contents of CResult_RouteDecodeErrorZ
1868 pub union CResult_RouteDecodeErrorZPtr {
1869 /// A pointer to the contents in the success state.
1870 /// Reading from this pointer when `result_ok` is not set is undefined.
1871 pub result: *mut crate::lightning::routing::router::Route,
1872 /// A pointer to the contents in the error state.
1873 /// Reading from this pointer when `result_ok` is set is undefined.
1874 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1877 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1878 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1879 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1880 pub struct CResult_RouteDecodeErrorZ {
1881 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1882 /// `err` or `result` depending on the state of `result_ok`.
1883 pub contents: CResult_RouteDecodeErrorZPtr,
1884 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1885 pub result_ok: bool,
1888 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1889 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1890 CResult_RouteDecodeErrorZ {
1891 contents: CResult_RouteDecodeErrorZPtr {
1892 result: Box::into_raw(Box::new(o)),
1898 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1899 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1900 CResult_RouteDecodeErrorZ {
1901 contents: CResult_RouteDecodeErrorZPtr {
1902 err: Box::into_raw(Box::new(e)),
1907 /// Checks if the given object is currently in the success state
1909 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
1913 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1914 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1915 impl Drop for CResult_RouteDecodeErrorZ {
1916 fn drop(&mut self) {
1918 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1919 let _ = unsafe { Box::from_raw(self.contents.result) };
1922 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1923 let _ = unsafe { Box::from_raw(self.contents.err) };
1928 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1929 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1930 let contents = if o.result_ok {
1931 let result = unsafe { o.contents.result };
1932 unsafe { o.contents.result = std::ptr::null_mut() };
1933 CResult_RouteDecodeErrorZPtr { result }
1935 let err = unsafe { o.contents.err };
1936 unsafe { o.contents.err = std::ptr::null_mut(); }
1937 CResult_RouteDecodeErrorZPtr { err }
1941 result_ok: o.result_ok,
1945 impl Clone for CResult_RouteDecodeErrorZ {
1946 fn clone(&self) -> Self {
1948 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1949 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1952 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1953 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1959 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1960 /// but with all dynamically-allocated buffers duplicated in new buffers.
1961 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1963 /// The contents of CResult_RouteParametersDecodeErrorZ
1964 pub union CResult_RouteParametersDecodeErrorZPtr {
1965 /// A pointer to the contents in the success state.
1966 /// Reading from this pointer when `result_ok` is not set is undefined.
1967 pub result: *mut crate::lightning::routing::router::RouteParameters,
1968 /// A pointer to the contents in the error state.
1969 /// Reading from this pointer when `result_ok` is set is undefined.
1970 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1973 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1974 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1976 pub struct CResult_RouteParametersDecodeErrorZ {
1977 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1978 /// `err` or `result` depending on the state of `result_ok`.
1979 pub contents: CResult_RouteParametersDecodeErrorZPtr,
1980 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1981 pub result_ok: bool,
1984 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1985 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1986 CResult_RouteParametersDecodeErrorZ {
1987 contents: CResult_RouteParametersDecodeErrorZPtr {
1988 result: Box::into_raw(Box::new(o)),
1994 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
1995 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
1996 CResult_RouteParametersDecodeErrorZ {
1997 contents: CResult_RouteParametersDecodeErrorZPtr {
1998 err: Box::into_raw(Box::new(e)),
2003 /// Checks if the given object is currently in the success state
2005 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2009 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2010 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2011 impl Drop for CResult_RouteParametersDecodeErrorZ {
2012 fn drop(&mut self) {
2014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2015 let _ = unsafe { Box::from_raw(self.contents.result) };
2018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2019 let _ = unsafe { Box::from_raw(self.contents.err) };
2024 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2026 let contents = if o.result_ok {
2027 let result = unsafe { o.contents.result };
2028 unsafe { o.contents.result = std::ptr::null_mut() };
2029 CResult_RouteParametersDecodeErrorZPtr { result }
2031 let err = unsafe { o.contents.err };
2032 unsafe { o.contents.err = std::ptr::null_mut(); }
2033 CResult_RouteParametersDecodeErrorZPtr { err }
2037 result_ok: o.result_ok,
2041 impl Clone for CResult_RouteParametersDecodeErrorZ {
2042 fn clone(&self) -> Self {
2044 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2045 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2048 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2049 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2055 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2056 /// but with all dynamically-allocated buffers duplicated in new buffers.
2057 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2059 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2060 /// This corresponds to std::vector in C++
2061 pub struct CVec_RouteHintZ {
2062 /// The elements in the array.
2063 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2064 pub data: *mut crate::lightning::routing::router::RouteHint,
2065 /// The number of elements pointed to by `data`.
2068 impl CVec_RouteHintZ {
2069 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2070 if self.datalen == 0 { return Vec::new(); }
2071 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2072 self.data = std::ptr::null_mut();
2076 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2077 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2080 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2081 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2082 let datalen = v.len();
2083 let data = Box::into_raw(v.into_boxed_slice());
2084 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2088 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2089 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2090 impl Drop for CVec_RouteHintZ {
2091 fn drop(&mut self) {
2092 if self.datalen == 0 { return; }
2093 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2096 impl Clone for CVec_RouteHintZ {
2097 fn clone(&self) -> Self {
2098 let mut res = Vec::new();
2099 if self.datalen == 0 { return Self::from(res); }
2100 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2106 /// An enum which can either contain a u64 or not
2107 pub enum COption_u64Z {
2108 /// When we're in this state, this COption_u64Z contains a u64
2110 /// When we're in this state, this COption_u64Z contains nothing
2114 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2115 if let Self::None = self { false } else { true }
2117 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2120 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2121 if let Self::Some(v) = self { v } else { unreachable!() }
2125 /// Constructs a new COption_u64Z containing a u64
2126 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2127 COption_u64Z::Some(o)
2130 /// Constructs a new COption_u64Z containing nothing
2131 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2135 /// Frees any resources associated with the u64, if we are in the Some state
2136 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2138 /// Creates a new COption_u64Z which has the same data as `orig`
2139 /// but with all dynamically-allocated buffers duplicated in new buffers.
2140 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2142 /// The contents of CResult_PayeeDecodeErrorZ
2143 pub union CResult_PayeeDecodeErrorZPtr {
2144 /// A pointer to the contents in the success state.
2145 /// Reading from this pointer when `result_ok` is not set is undefined.
2146 pub result: *mut crate::lightning::routing::router::Payee,
2147 /// A pointer to the contents in the error state.
2148 /// Reading from this pointer when `result_ok` is set is undefined.
2149 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2152 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2153 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2154 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2155 pub struct CResult_PayeeDecodeErrorZ {
2156 /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2157 /// `err` or `result` depending on the state of `result_ok`.
2158 pub contents: CResult_PayeeDecodeErrorZPtr,
2159 /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2160 pub result_ok: bool,
2163 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2164 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2165 CResult_PayeeDecodeErrorZ {
2166 contents: CResult_PayeeDecodeErrorZPtr {
2167 result: Box::into_raw(Box::new(o)),
2173 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2174 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2175 CResult_PayeeDecodeErrorZ {
2176 contents: CResult_PayeeDecodeErrorZPtr {
2177 err: Box::into_raw(Box::new(e)),
2182 /// Checks if the given object is currently in the success state
2184 pub extern "C" fn CResult_PayeeDecodeErrorZ_is_ok(o: &CResult_PayeeDecodeErrorZ) -> bool {
2188 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2189 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2190 impl Drop for CResult_PayeeDecodeErrorZ {
2191 fn drop(&mut self) {
2193 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2194 let _ = unsafe { Box::from_raw(self.contents.result) };
2197 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2198 let _ = unsafe { Box::from_raw(self.contents.err) };
2203 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2204 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2205 let contents = if o.result_ok {
2206 let result = unsafe { o.contents.result };
2207 unsafe { o.contents.result = std::ptr::null_mut() };
2208 CResult_PayeeDecodeErrorZPtr { result }
2210 let err = unsafe { o.contents.err };
2211 unsafe { o.contents.err = std::ptr::null_mut(); }
2212 CResult_PayeeDecodeErrorZPtr { err }
2216 result_ok: o.result_ok,
2220 impl Clone for CResult_PayeeDecodeErrorZ {
2221 fn clone(&self) -> Self {
2223 Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2224 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2227 Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2228 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2234 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2235 /// but with all dynamically-allocated buffers duplicated in new buffers.
2236 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2238 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2239 /// This corresponds to std::vector in C++
2240 pub struct CVec_RouteHintHopZ {
2241 /// The elements in the array.
2242 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2243 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2244 /// The number of elements pointed to by `data`.
2247 impl CVec_RouteHintHopZ {
2248 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2249 if self.datalen == 0 { return Vec::new(); }
2250 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2251 self.data = std::ptr::null_mut();
2255 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2256 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2259 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2260 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2261 let datalen = v.len();
2262 let data = Box::into_raw(v.into_boxed_slice());
2263 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2267 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2268 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2269 impl Drop for CVec_RouteHintHopZ {
2270 fn drop(&mut self) {
2271 if self.datalen == 0 { return; }
2272 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2275 impl Clone for CVec_RouteHintHopZ {
2276 fn clone(&self) -> Self {
2277 let mut res = Vec::new();
2278 if self.datalen == 0 { return Self::from(res); }
2279 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2284 /// The contents of CResult_RouteHintDecodeErrorZ
2285 pub union CResult_RouteHintDecodeErrorZPtr {
2286 /// A pointer to the contents in the success state.
2287 /// Reading from this pointer when `result_ok` is not set is undefined.
2288 pub result: *mut crate::lightning::routing::router::RouteHint,
2289 /// A pointer to the contents in the error state.
2290 /// Reading from this pointer when `result_ok` is set is undefined.
2291 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2294 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2295 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2296 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2297 pub struct CResult_RouteHintDecodeErrorZ {
2298 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2299 /// `err` or `result` depending on the state of `result_ok`.
2300 pub contents: CResult_RouteHintDecodeErrorZPtr,
2301 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2302 pub result_ok: bool,
2305 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2306 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2307 CResult_RouteHintDecodeErrorZ {
2308 contents: CResult_RouteHintDecodeErrorZPtr {
2309 result: Box::into_raw(Box::new(o)),
2315 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2316 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2317 CResult_RouteHintDecodeErrorZ {
2318 contents: CResult_RouteHintDecodeErrorZPtr {
2319 err: Box::into_raw(Box::new(e)),
2324 /// Checks if the given object is currently in the success state
2326 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2330 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2331 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2332 impl Drop for CResult_RouteHintDecodeErrorZ {
2333 fn drop(&mut self) {
2335 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2336 let _ = unsafe { Box::from_raw(self.contents.result) };
2339 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2340 let _ = unsafe { Box::from_raw(self.contents.err) };
2345 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2346 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2347 let contents = if o.result_ok {
2348 let result = unsafe { o.contents.result };
2349 unsafe { o.contents.result = std::ptr::null_mut() };
2350 CResult_RouteHintDecodeErrorZPtr { result }
2352 let err = unsafe { o.contents.err };
2353 unsafe { o.contents.err = std::ptr::null_mut(); }
2354 CResult_RouteHintDecodeErrorZPtr { err }
2358 result_ok: o.result_ok,
2362 impl Clone for CResult_RouteHintDecodeErrorZ {
2363 fn clone(&self) -> Self {
2365 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2366 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2369 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2370 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2376 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2377 /// but with all dynamically-allocated buffers duplicated in new buffers.
2378 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2380 /// The contents of CResult_RouteHintHopDecodeErrorZ
2381 pub union CResult_RouteHintHopDecodeErrorZPtr {
2382 /// A pointer to the contents in the success state.
2383 /// Reading from this pointer when `result_ok` is not set is undefined.
2384 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2385 /// A pointer to the contents in the error state.
2386 /// Reading from this pointer when `result_ok` is set is undefined.
2387 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2390 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2391 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2393 pub struct CResult_RouteHintHopDecodeErrorZ {
2394 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2395 /// `err` or `result` depending on the state of `result_ok`.
2396 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2397 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2398 pub result_ok: bool,
2401 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2402 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2403 CResult_RouteHintHopDecodeErrorZ {
2404 contents: CResult_RouteHintHopDecodeErrorZPtr {
2405 result: Box::into_raw(Box::new(o)),
2411 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2412 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2413 CResult_RouteHintHopDecodeErrorZ {
2414 contents: CResult_RouteHintHopDecodeErrorZPtr {
2415 err: Box::into_raw(Box::new(e)),
2420 /// Checks if the given object is currently in the success state
2422 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2426 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2427 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2428 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2429 fn drop(&mut self) {
2431 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2432 let _ = unsafe { Box::from_raw(self.contents.result) };
2435 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2436 let _ = unsafe { Box::from_raw(self.contents.err) };
2441 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2442 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2443 let contents = if o.result_ok {
2444 let result = unsafe { o.contents.result };
2445 unsafe { o.contents.result = std::ptr::null_mut() };
2446 CResult_RouteHintHopDecodeErrorZPtr { result }
2448 let err = unsafe { o.contents.err };
2449 unsafe { o.contents.err = std::ptr::null_mut(); }
2450 CResult_RouteHintHopDecodeErrorZPtr { err }
2454 result_ok: o.result_ok,
2458 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2459 fn clone(&self) -> Self {
2461 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2462 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2465 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2466 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2472 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2473 /// but with all dynamically-allocated buffers duplicated in new buffers.
2474 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2476 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2477 /// This corresponds to std::vector in C++
2478 pub struct CVec_ChannelDetailsZ {
2479 /// The elements in the array.
2480 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2481 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2482 /// The number of elements pointed to by `data`.
2485 impl CVec_ChannelDetailsZ {
2486 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2487 if self.datalen == 0 { return Vec::new(); }
2488 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2489 self.data = std::ptr::null_mut();
2493 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2494 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2497 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2498 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2499 let datalen = v.len();
2500 let data = Box::into_raw(v.into_boxed_slice());
2501 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2505 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2506 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2507 impl Drop for CVec_ChannelDetailsZ {
2508 fn drop(&mut self) {
2509 if self.datalen == 0 { return; }
2510 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2513 impl Clone for CVec_ChannelDetailsZ {
2514 fn clone(&self) -> Self {
2515 let mut res = Vec::new();
2516 if self.datalen == 0 { return Self::from(res); }
2517 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2522 /// The contents of CResult_RouteLightningErrorZ
2523 pub union CResult_RouteLightningErrorZPtr {
2524 /// A pointer to the contents in the success state.
2525 /// Reading from this pointer when `result_ok` is not set is undefined.
2526 pub result: *mut crate::lightning::routing::router::Route,
2527 /// A pointer to the contents in the error state.
2528 /// Reading from this pointer when `result_ok` is set is undefined.
2529 pub err: *mut crate::lightning::ln::msgs::LightningError,
2532 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2533 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2534 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2535 pub struct CResult_RouteLightningErrorZ {
2536 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2537 /// `err` or `result` depending on the state of `result_ok`.
2538 pub contents: CResult_RouteLightningErrorZPtr,
2539 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2540 pub result_ok: bool,
2543 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2544 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2545 CResult_RouteLightningErrorZ {
2546 contents: CResult_RouteLightningErrorZPtr {
2547 result: Box::into_raw(Box::new(o)),
2553 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2554 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2555 CResult_RouteLightningErrorZ {
2556 contents: CResult_RouteLightningErrorZPtr {
2557 err: Box::into_raw(Box::new(e)),
2562 /// Checks if the given object is currently in the success state
2564 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2568 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2569 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2570 impl Drop for CResult_RouteLightningErrorZ {
2571 fn drop(&mut self) {
2573 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2574 let _ = unsafe { Box::from_raw(self.contents.result) };
2577 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2578 let _ = unsafe { Box::from_raw(self.contents.err) };
2583 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2584 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2585 let contents = if o.result_ok {
2586 let result = unsafe { o.contents.result };
2587 unsafe { o.contents.result = std::ptr::null_mut() };
2588 CResult_RouteLightningErrorZPtr { result }
2590 let err = unsafe { o.contents.err };
2591 unsafe { o.contents.err = std::ptr::null_mut(); }
2592 CResult_RouteLightningErrorZPtr { err }
2596 result_ok: o.result_ok,
2600 impl Clone for CResult_RouteLightningErrorZ {
2601 fn clone(&self) -> Self {
2603 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2604 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2607 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2608 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2614 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2615 /// but with all dynamically-allocated buffers duplicated in new buffers.
2616 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2618 /// The contents of CResult_TxOutAccessErrorZ
2619 pub union CResult_TxOutAccessErrorZPtr {
2620 /// A pointer to the contents in the success state.
2621 /// Reading from this pointer when `result_ok` is not set is undefined.
2622 pub result: *mut crate::c_types::TxOut,
2623 /// A pointer to the contents in the error state.
2624 /// Reading from this pointer when `result_ok` is set is undefined.
2625 pub err: *mut crate::lightning::chain::AccessError,
2628 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2629 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2631 pub struct CResult_TxOutAccessErrorZ {
2632 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2633 /// `err` or `result` depending on the state of `result_ok`.
2634 pub contents: CResult_TxOutAccessErrorZPtr,
2635 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2636 pub result_ok: bool,
2639 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2640 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2641 CResult_TxOutAccessErrorZ {
2642 contents: CResult_TxOutAccessErrorZPtr {
2643 result: Box::into_raw(Box::new(o)),
2649 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2650 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2651 CResult_TxOutAccessErrorZ {
2652 contents: CResult_TxOutAccessErrorZPtr {
2653 err: Box::into_raw(Box::new(e)),
2658 /// Checks if the given object is currently in the success state
2660 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2664 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2665 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2666 impl Drop for CResult_TxOutAccessErrorZ {
2667 fn drop(&mut self) {
2669 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2670 let _ = unsafe { Box::from_raw(self.contents.result) };
2673 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2674 let _ = unsafe { Box::from_raw(self.contents.err) };
2679 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2680 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2681 let contents = if o.result_ok {
2682 let result = unsafe { o.contents.result };
2683 unsafe { o.contents.result = std::ptr::null_mut() };
2684 CResult_TxOutAccessErrorZPtr { result }
2686 let err = unsafe { o.contents.err };
2687 unsafe { o.contents.err = std::ptr::null_mut(); }
2688 CResult_TxOutAccessErrorZPtr { err }
2692 result_ok: o.result_ok,
2696 impl Clone for CResult_TxOutAccessErrorZ {
2697 fn clone(&self) -> Self {
2699 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2700 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2703 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2704 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2710 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2711 /// but with all dynamically-allocated buffers duplicated in new buffers.
2712 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2714 /// A tuple of 2 elements. See the individual fields for the types contained.
2715 pub struct C2Tuple_usizeTransactionZ {
2716 /// The element at position 0
2718 /// The element at position 1
2719 pub b: crate::c_types::Transaction,
2721 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2722 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2729 impl C2Tuple_usizeTransactionZ {
2730 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2734 impl Clone for C2Tuple_usizeTransactionZ {
2735 fn clone(&self) -> Self {
2737 a: Clone::clone(&self.a),
2738 b: Clone::clone(&self.b),
2743 /// Creates a new tuple which has the same data as `orig`
2744 /// but with all dynamically-allocated buffers duplicated in new buffers.
2745 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2746 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2748 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2749 C2Tuple_usizeTransactionZ { a, b, }
2753 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2754 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2756 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2757 /// This corresponds to std::vector in C++
2758 pub struct CVec_C2Tuple_usizeTransactionZZ {
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::derived::C2Tuple_usizeTransactionZ,
2762 /// The number of elements pointed to by `data`.
2765 impl CVec_C2Tuple_usizeTransactionZZ {
2766 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
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::derived::C2Tuple_usizeTransactionZ] {
2774 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2777 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2778 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> 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_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2787 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
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_C2Tuple_usizeTransactionZZ {
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 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2803 /// This corresponds to std::vector in C++
2804 pub struct CVec_TxidZ {
2805 /// The elements in the array.
2806 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2807 pub data: *mut crate::c_types::ThirtyTwoBytes,
2808 /// The number of elements pointed to by `data`.
2812 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2813 if self.datalen == 0 { return Vec::new(); }
2814 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2815 self.data = std::ptr::null_mut();
2819 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2820 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2823 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2824 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2825 let datalen = v.len();
2826 let data = Box::into_raw(v.into_boxed_slice());
2827 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2832 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2833 impl Drop for CVec_TxidZ {
2834 fn drop(&mut self) {
2835 if self.datalen == 0 { return; }
2836 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2839 impl Clone for CVec_TxidZ {
2840 fn clone(&self) -> Self {
2841 let mut res = Vec::new();
2842 if self.datalen == 0 { return Self::from(res); }
2843 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2848 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2849 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2850 /// Note that this value is always NULL, as there are no contents in the OK variant
2851 pub result: *mut std::ffi::c_void,
2852 /// A pointer to the contents in the error state.
2853 /// Reading from this pointer when `result_ok` is set is undefined.
2854 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2857 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2858 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2860 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2861 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2862 /// `err` or `result` depending on the state of `result_ok`.
2863 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2864 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2865 pub result_ok: bool,
2868 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2869 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2870 CResult_NoneChannelMonitorUpdateErrZ {
2871 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2872 result: std::ptr::null_mut(),
2878 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2879 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2880 CResult_NoneChannelMonitorUpdateErrZ {
2881 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2882 err: Box::into_raw(Box::new(e)),
2887 /// Checks if the given object is currently in the success state
2889 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
2893 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2894 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2895 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2896 fn drop(&mut self) {
2899 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2900 let _ = unsafe { Box::from_raw(self.contents.err) };
2905 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2906 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2907 let contents = if o.result_ok {
2908 let _ = unsafe { Box::from_raw(o.contents.result) };
2909 o.contents.result = std::ptr::null_mut();
2910 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2912 let err = unsafe { o.contents.err };
2913 unsafe { o.contents.err = std::ptr::null_mut(); }
2914 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2918 result_ok: o.result_ok,
2922 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2923 fn clone(&self) -> Self {
2925 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2926 result: std::ptr::null_mut()
2929 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2930 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2936 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2937 /// but with all dynamically-allocated buffers duplicated in new buffers.
2938 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2940 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2941 /// This corresponds to std::vector in C++
2942 pub struct CVec_MonitorEventZ {
2943 /// The elements in the array.
2944 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2945 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2946 /// The number of elements pointed to by `data`.
2949 impl CVec_MonitorEventZ {
2950 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2951 if self.datalen == 0 { return Vec::new(); }
2952 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2953 self.data = std::ptr::null_mut();
2957 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2958 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2961 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2962 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2963 let datalen = v.len();
2964 let data = Box::into_raw(v.into_boxed_slice());
2965 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2969 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2970 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2971 impl Drop for CVec_MonitorEventZ {
2972 fn drop(&mut self) {
2973 if self.datalen == 0 { return; }
2974 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2977 impl Clone for CVec_MonitorEventZ {
2978 fn clone(&self) -> Self {
2979 let mut res = Vec::new();
2980 if self.datalen == 0 { return Self::from(res); }
2981 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2987 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2988 pub enum COption_C2Tuple_usizeTransactionZZ {
2989 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2990 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2991 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2994 impl COption_C2Tuple_usizeTransactionZZ {
2995 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2996 if let Self::None = self { false } else { true }
2998 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3001 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3002 if let Self::Some(v) = self { v } else { unreachable!() }
3006 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3007 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3008 COption_C2Tuple_usizeTransactionZZ::Some(o)
3011 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3012 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3013 COption_C2Tuple_usizeTransactionZZ::None
3016 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3017 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3019 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3020 /// but with all dynamically-allocated buffers duplicated in new buffers.
3021 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3024 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3025 pub enum COption_ClosureReasonZ {
3026 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3027 Some(crate::lightning::util::events::ClosureReason),
3028 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3031 impl COption_ClosureReasonZ {
3032 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3033 if let Self::None = self { false } else { true }
3035 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3038 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3039 if let Self::Some(v) = self { v } else { unreachable!() }
3043 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3044 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3045 COption_ClosureReasonZ::Some(o)
3048 /// Constructs a new COption_ClosureReasonZ containing nothing
3049 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3050 COption_ClosureReasonZ::None
3053 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3054 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3056 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3057 /// but with all dynamically-allocated buffers duplicated in new buffers.
3058 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3060 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3061 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3062 /// A pointer to the contents in the success state.
3063 /// Reading from this pointer when `result_ok` is not set is undefined.
3064 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3065 /// A pointer to the contents in the error state.
3066 /// Reading from this pointer when `result_ok` is set is undefined.
3067 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3070 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3071 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3073 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3074 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3075 /// `err` or `result` depending on the state of `result_ok`.
3076 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3077 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3078 pub result_ok: bool,
3081 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3082 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3083 CResult_COption_ClosureReasonZDecodeErrorZ {
3084 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3085 result: Box::into_raw(Box::new(o)),
3091 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3092 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3093 CResult_COption_ClosureReasonZDecodeErrorZ {
3094 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3095 err: Box::into_raw(Box::new(e)),
3100 /// Checks if the given object is currently in the success state
3102 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3106 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3107 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3108 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3109 fn drop(&mut self) {
3111 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3112 let _ = unsafe { Box::from_raw(self.contents.result) };
3115 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3116 let _ = unsafe { Box::from_raw(self.contents.err) };
3121 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3122 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3123 let contents = if o.result_ok {
3124 let result = unsafe { o.contents.result };
3125 unsafe { o.contents.result = std::ptr::null_mut() };
3126 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3128 let err = unsafe { o.contents.err };
3129 unsafe { o.contents.err = std::ptr::null_mut(); }
3130 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3134 result_ok: o.result_ok,
3138 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3139 fn clone(&self) -> Self {
3141 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3142 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3145 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3146 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3152 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3153 /// but with all dynamically-allocated buffers duplicated in new buffers.
3154 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3157 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3158 pub enum COption_NetworkUpdateZ {
3159 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3160 Some(crate::lightning::routing::network_graph::NetworkUpdate),
3161 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3164 impl COption_NetworkUpdateZ {
3165 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3166 if let Self::None = self { false } else { true }
3168 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3171 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3172 if let Self::Some(v) = self { v } else { unreachable!() }
3176 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3177 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3178 COption_NetworkUpdateZ::Some(o)
3181 /// Constructs a new COption_NetworkUpdateZ containing nothing
3182 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3183 COption_NetworkUpdateZ::None
3186 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3187 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3189 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3190 /// but with all dynamically-allocated buffers duplicated in new buffers.
3191 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3193 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3194 /// This corresponds to std::vector in C++
3195 pub struct CVec_SpendableOutputDescriptorZ {
3196 /// The elements in the array.
3197 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3198 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3199 /// The number of elements pointed to by `data`.
3202 impl CVec_SpendableOutputDescriptorZ {
3203 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3204 if self.datalen == 0 { return Vec::new(); }
3205 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3206 self.data = std::ptr::null_mut();
3210 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3211 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3214 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3215 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3216 let datalen = v.len();
3217 let data = Box::into_raw(v.into_boxed_slice());
3218 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3222 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3223 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3224 impl Drop for CVec_SpendableOutputDescriptorZ {
3225 fn drop(&mut self) {
3226 if self.datalen == 0 { return; }
3227 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3230 impl Clone for CVec_SpendableOutputDescriptorZ {
3231 fn clone(&self) -> Self {
3232 let mut res = Vec::new();
3233 if self.datalen == 0 { return Self::from(res); }
3234 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3240 /// An enum which can either contain a crate::lightning::util::events::Event or not
3241 pub enum COption_EventZ {
3242 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3243 Some(crate::lightning::util::events::Event),
3244 /// When we're in this state, this COption_EventZ contains nothing
3247 impl COption_EventZ {
3248 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3249 if let Self::None = self { false } else { true }
3251 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3254 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3255 if let Self::Some(v) = self { v } else { unreachable!() }
3259 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3260 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3261 COption_EventZ::Some(o)
3264 /// Constructs a new COption_EventZ containing nothing
3265 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3266 COption_EventZ::None
3269 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3270 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3272 /// Creates a new COption_EventZ which has the same data as `orig`
3273 /// but with all dynamically-allocated buffers duplicated in new buffers.
3274 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3276 /// The contents of CResult_COption_EventZDecodeErrorZ
3277 pub union CResult_COption_EventZDecodeErrorZPtr {
3278 /// A pointer to the contents in the success state.
3279 /// Reading from this pointer when `result_ok` is not set is undefined.
3280 pub result: *mut crate::c_types::derived::COption_EventZ,
3281 /// A pointer to the contents in the error state.
3282 /// Reading from this pointer when `result_ok` is set is undefined.
3283 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3286 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3287 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3288 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3289 pub struct CResult_COption_EventZDecodeErrorZ {
3290 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3291 /// `err` or `result` depending on the state of `result_ok`.
3292 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3293 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3294 pub result_ok: bool,
3297 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3298 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3299 CResult_COption_EventZDecodeErrorZ {
3300 contents: CResult_COption_EventZDecodeErrorZPtr {
3301 result: Box::into_raw(Box::new(o)),
3307 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3308 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3309 CResult_COption_EventZDecodeErrorZ {
3310 contents: CResult_COption_EventZDecodeErrorZPtr {
3311 err: Box::into_raw(Box::new(e)),
3316 /// Checks if the given object is currently in the success state
3318 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3322 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3323 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3324 impl Drop for CResult_COption_EventZDecodeErrorZ {
3325 fn drop(&mut self) {
3327 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3328 let _ = unsafe { Box::from_raw(self.contents.result) };
3331 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3332 let _ = unsafe { Box::from_raw(self.contents.err) };
3337 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3338 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3339 let contents = if o.result_ok {
3340 let result = unsafe { o.contents.result };
3341 unsafe { o.contents.result = std::ptr::null_mut() };
3342 CResult_COption_EventZDecodeErrorZPtr { result }
3344 let err = unsafe { o.contents.err };
3345 unsafe { o.contents.err = std::ptr::null_mut(); }
3346 CResult_COption_EventZDecodeErrorZPtr { err }
3350 result_ok: o.result_ok,
3354 impl Clone for CResult_COption_EventZDecodeErrorZ {
3355 fn clone(&self) -> Self {
3357 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3358 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3361 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3362 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3368 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3369 /// but with all dynamically-allocated buffers duplicated in new buffers.
3370 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3372 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3373 /// This corresponds to std::vector in C++
3374 pub struct CVec_MessageSendEventZ {
3375 /// The elements in the array.
3376 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3377 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3378 /// The number of elements pointed to by `data`.
3381 impl CVec_MessageSendEventZ {
3382 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3383 if self.datalen == 0 { return Vec::new(); }
3384 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3385 self.data = std::ptr::null_mut();
3389 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3390 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3393 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3394 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3395 let datalen = v.len();
3396 let data = Box::into_raw(v.into_boxed_slice());
3397 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3402 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3403 impl Drop for CVec_MessageSendEventZ {
3404 fn drop(&mut self) {
3405 if self.datalen == 0 { return; }
3406 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3409 impl Clone for CVec_MessageSendEventZ {
3410 fn clone(&self) -> Self {
3411 let mut res = Vec::new();
3412 if self.datalen == 0 { return Self::from(res); }
3413 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3418 /// The contents of CResult_ScoringParametersDecodeErrorZ
3419 pub union CResult_ScoringParametersDecodeErrorZPtr {
3420 /// A pointer to the contents in the success state.
3421 /// Reading from this pointer when `result_ok` is not set is undefined.
3422 pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3423 /// A pointer to the contents in the error state.
3424 /// Reading from this pointer when `result_ok` is set is undefined.
3425 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3428 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3429 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3431 pub struct CResult_ScoringParametersDecodeErrorZ {
3432 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3433 /// `err` or `result` depending on the state of `result_ok`.
3434 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3435 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3436 pub result_ok: bool,
3439 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3440 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3441 CResult_ScoringParametersDecodeErrorZ {
3442 contents: CResult_ScoringParametersDecodeErrorZPtr {
3443 result: Box::into_raw(Box::new(o)),
3449 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3450 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3451 CResult_ScoringParametersDecodeErrorZ {
3452 contents: CResult_ScoringParametersDecodeErrorZPtr {
3453 err: Box::into_raw(Box::new(e)),
3458 /// Checks if the given object is currently in the success state
3460 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3464 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3465 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3466 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3467 fn drop(&mut self) {
3469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3470 let _ = unsafe { Box::from_raw(self.contents.result) };
3473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3474 let _ = unsafe { Box::from_raw(self.contents.err) };
3479 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3481 let contents = if o.result_ok {
3482 let result = unsafe { o.contents.result };
3483 unsafe { o.contents.result = std::ptr::null_mut() };
3484 CResult_ScoringParametersDecodeErrorZPtr { result }
3486 let err = unsafe { o.contents.err };
3487 unsafe { o.contents.err = std::ptr::null_mut(); }
3488 CResult_ScoringParametersDecodeErrorZPtr { err }
3492 result_ok: o.result_ok,
3497 /// The contents of CResult_ScorerDecodeErrorZ
3498 pub union CResult_ScorerDecodeErrorZPtr {
3499 /// A pointer to the contents in the success state.
3500 /// Reading from this pointer when `result_ok` is not set is undefined.
3501 pub result: *mut crate::lightning::routing::scoring::Scorer,
3502 /// A pointer to the contents in the error state.
3503 /// Reading from this pointer when `result_ok` is set is undefined.
3504 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3507 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3508 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3510 pub struct CResult_ScorerDecodeErrorZ {
3511 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3512 /// `err` or `result` depending on the state of `result_ok`.
3513 pub contents: CResult_ScorerDecodeErrorZPtr,
3514 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3515 pub result_ok: bool,
3518 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3519 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3520 CResult_ScorerDecodeErrorZ {
3521 contents: CResult_ScorerDecodeErrorZPtr {
3522 result: Box::into_raw(Box::new(o)),
3528 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3529 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3530 CResult_ScorerDecodeErrorZ {
3531 contents: CResult_ScorerDecodeErrorZPtr {
3532 err: Box::into_raw(Box::new(e)),
3537 /// Checks if the given object is currently in the success state
3539 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3543 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3544 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3545 impl Drop for CResult_ScorerDecodeErrorZ {
3546 fn drop(&mut self) {
3548 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3549 let _ = unsafe { Box::from_raw(self.contents.result) };
3552 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3553 let _ = unsafe { Box::from_raw(self.contents.err) };
3558 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3559 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3560 let contents = if o.result_ok {
3561 let result = unsafe { o.contents.result };
3562 unsafe { o.contents.result = std::ptr::null_mut() };
3563 CResult_ScorerDecodeErrorZPtr { result }
3565 let err = unsafe { o.contents.err };
3566 unsafe { o.contents.err = std::ptr::null_mut(); }
3567 CResult_ScorerDecodeErrorZPtr { err }
3571 result_ok: o.result_ok,
3576 /// The contents of CResult_InitFeaturesDecodeErrorZ
3577 pub union CResult_InitFeaturesDecodeErrorZPtr {
3578 /// A pointer to the contents in the success state.
3579 /// Reading from this pointer when `result_ok` is not set is undefined.
3580 pub result: *mut crate::lightning::ln::features::InitFeatures,
3581 /// A pointer to the contents in the error state.
3582 /// Reading from this pointer when `result_ok` is set is undefined.
3583 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3586 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3587 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3589 pub struct CResult_InitFeaturesDecodeErrorZ {
3590 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3591 /// `err` or `result` depending on the state of `result_ok`.
3592 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3593 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3594 pub result_ok: bool,
3597 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
3598 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
3599 CResult_InitFeaturesDecodeErrorZ {
3600 contents: CResult_InitFeaturesDecodeErrorZPtr {
3601 result: Box::into_raw(Box::new(o)),
3607 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3608 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3609 CResult_InitFeaturesDecodeErrorZ {
3610 contents: CResult_InitFeaturesDecodeErrorZPtr {
3611 err: Box::into_raw(Box::new(e)),
3616 /// Checks if the given object is currently in the success state
3618 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
3622 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3623 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3624 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3625 fn drop(&mut self) {
3627 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3628 let _ = unsafe { Box::from_raw(self.contents.result) };
3631 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3632 let _ = unsafe { Box::from_raw(self.contents.err) };
3637 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3638 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3639 let contents = if o.result_ok {
3640 let result = unsafe { o.contents.result };
3641 unsafe { o.contents.result = std::ptr::null_mut() };
3642 CResult_InitFeaturesDecodeErrorZPtr { result }
3644 let err = unsafe { o.contents.err };
3645 unsafe { o.contents.err = std::ptr::null_mut(); }
3646 CResult_InitFeaturesDecodeErrorZPtr { err }
3650 result_ok: o.result_ok,
3655 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3656 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3657 /// A pointer to the contents in the success state.
3658 /// Reading from this pointer when `result_ok` is not set is undefined.
3659 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3660 /// A pointer to the contents in the error state.
3661 /// Reading from this pointer when `result_ok` is set is undefined.
3662 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3665 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3666 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3668 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3669 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3670 /// `err` or `result` depending on the state of `result_ok`.
3671 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3672 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3673 pub result_ok: bool,
3676 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3677 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3678 CResult_ChannelFeaturesDecodeErrorZ {
3679 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3680 result: Box::into_raw(Box::new(o)),
3686 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3687 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3688 CResult_ChannelFeaturesDecodeErrorZ {
3689 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3690 err: Box::into_raw(Box::new(e)),
3695 /// Checks if the given object is currently in the success state
3697 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
3701 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3702 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3703 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3704 fn drop(&mut self) {
3706 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3707 let _ = unsafe { Box::from_raw(self.contents.result) };
3710 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3711 let _ = unsafe { Box::from_raw(self.contents.err) };
3716 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3717 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3718 let contents = if o.result_ok {
3719 let result = unsafe { o.contents.result };
3720 unsafe { o.contents.result = std::ptr::null_mut() };
3721 CResult_ChannelFeaturesDecodeErrorZPtr { result }
3723 let err = unsafe { o.contents.err };
3724 unsafe { o.contents.err = std::ptr::null_mut(); }
3725 CResult_ChannelFeaturesDecodeErrorZPtr { err }
3729 result_ok: o.result_ok,
3734 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3735 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3736 /// A pointer to the contents in the success state.
3737 /// Reading from this pointer when `result_ok` is not set is undefined.
3738 pub result: *mut crate::lightning::ln::features::NodeFeatures,
3739 /// A pointer to the contents in the error state.
3740 /// Reading from this pointer when `result_ok` is set is undefined.
3741 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3744 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3745 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3746 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3747 pub struct CResult_NodeFeaturesDecodeErrorZ {
3748 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3749 /// `err` or `result` depending on the state of `result_ok`.
3750 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3751 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3752 pub result_ok: bool,
3755 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3756 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3757 CResult_NodeFeaturesDecodeErrorZ {
3758 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3759 result: Box::into_raw(Box::new(o)),
3765 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3766 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3767 CResult_NodeFeaturesDecodeErrorZ {
3768 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3769 err: Box::into_raw(Box::new(e)),
3774 /// Checks if the given object is currently in the success state
3776 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
3780 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3781 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3782 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3783 fn drop(&mut self) {
3785 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3786 let _ = unsafe { Box::from_raw(self.contents.result) };
3789 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3790 let _ = unsafe { Box::from_raw(self.contents.err) };
3795 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3796 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3797 let contents = if o.result_ok {
3798 let result = unsafe { o.contents.result };
3799 unsafe { o.contents.result = std::ptr::null_mut() };
3800 CResult_NodeFeaturesDecodeErrorZPtr { result }
3802 let err = unsafe { o.contents.err };
3803 unsafe { o.contents.err = std::ptr::null_mut(); }
3804 CResult_NodeFeaturesDecodeErrorZPtr { err }
3808 result_ok: o.result_ok,
3813 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3814 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3815 /// A pointer to the contents in the success state.
3816 /// Reading from this pointer when `result_ok` is not set is undefined.
3817 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3818 /// A pointer to the contents in the error state.
3819 /// Reading from this pointer when `result_ok` is set is undefined.
3820 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3823 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3824 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3825 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3826 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3827 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3828 /// `err` or `result` depending on the state of `result_ok`.
3829 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3830 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3831 pub result_ok: bool,
3834 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3835 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3836 CResult_InvoiceFeaturesDecodeErrorZ {
3837 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3838 result: Box::into_raw(Box::new(o)),
3844 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3845 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3846 CResult_InvoiceFeaturesDecodeErrorZ {
3847 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3848 err: Box::into_raw(Box::new(e)),
3853 /// Checks if the given object is currently in the success state
3855 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
3859 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3860 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3861 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3862 fn drop(&mut self) {
3864 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3865 let _ = unsafe { Box::from_raw(self.contents.result) };
3868 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3869 let _ = unsafe { Box::from_raw(self.contents.err) };
3874 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3875 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3876 let contents = if o.result_ok {
3877 let result = unsafe { o.contents.result };
3878 unsafe { o.contents.result = std::ptr::null_mut() };
3879 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3881 let err = unsafe { o.contents.err };
3882 unsafe { o.contents.err = std::ptr::null_mut(); }
3883 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3887 result_ok: o.result_ok,
3892 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
3893 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3894 /// A pointer to the contents in the success state.
3895 /// Reading from this pointer when `result_ok` is not set is undefined.
3896 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
3897 /// A pointer to the contents in the error state.
3898 /// Reading from this pointer when `result_ok` is set is undefined.
3899 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3902 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
3903 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3904 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3905 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
3906 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
3907 /// `err` or `result` depending on the state of `result_ok`.
3908 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
3909 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
3910 pub result_ok: bool,
3913 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
3914 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
3915 CResult_ChannelTypeFeaturesDecodeErrorZ {
3916 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3917 result: Box::into_raw(Box::new(o)),
3923 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
3924 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
3925 CResult_ChannelTypeFeaturesDecodeErrorZ {
3926 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3927 err: Box::into_raw(Box::new(e)),
3932 /// Checks if the given object is currently in the success state
3934 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
3938 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
3939 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
3940 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
3941 fn drop(&mut self) {
3943 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3944 let _ = unsafe { Box::from_raw(self.contents.result) };
3947 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3948 let _ = unsafe { Box::from_raw(self.contents.err) };
3953 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
3954 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3955 let contents = if o.result_ok {
3956 let result = unsafe { o.contents.result };
3957 unsafe { o.contents.result = std::ptr::null_mut() };
3958 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
3960 let err = unsafe { o.contents.err };
3961 unsafe { o.contents.err = std::ptr::null_mut(); }
3962 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
3966 result_ok: o.result_ok,
3971 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3972 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3973 /// A pointer to the contents in the success state.
3974 /// Reading from this pointer when `result_ok` is not set is undefined.
3975 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3976 /// A pointer to the contents in the error state.
3977 /// Reading from this pointer when `result_ok` is set is undefined.
3978 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3981 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3982 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3984 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3985 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3986 /// `err` or `result` depending on the state of `result_ok`.
3987 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3988 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3989 pub result_ok: bool,
3992 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
3993 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3994 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3995 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3996 result: Box::into_raw(Box::new(o)),
4002 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4003 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4004 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4005 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4006 err: Box::into_raw(Box::new(e)),
4011 /// Checks if the given object is currently in the success state
4013 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4017 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4018 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4019 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4020 fn drop(&mut self) {
4022 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4023 let _ = unsafe { Box::from_raw(self.contents.result) };
4026 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4027 let _ = unsafe { Box::from_raw(self.contents.err) };
4032 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4033 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4034 let contents = if o.result_ok {
4035 let result = unsafe { o.contents.result };
4036 unsafe { o.contents.result = std::ptr::null_mut() };
4037 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4039 let err = unsafe { o.contents.err };
4040 unsafe { o.contents.err = std::ptr::null_mut(); }
4041 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4045 result_ok: o.result_ok,
4049 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4050 fn clone(&self) -> Self {
4052 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4053 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4056 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4057 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4063 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4064 /// but with all dynamically-allocated buffers duplicated in new buffers.
4065 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4067 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4068 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4069 /// A pointer to the contents in the success state.
4070 /// Reading from this pointer when `result_ok` is not set is undefined.
4071 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4072 /// A pointer to the contents in the error state.
4073 /// Reading from this pointer when `result_ok` is set is undefined.
4074 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4077 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4078 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4079 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4080 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4081 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4082 /// `err` or `result` depending on the state of `result_ok`.
4083 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4084 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4085 pub result_ok: bool,
4088 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4089 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4090 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4091 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4092 result: Box::into_raw(Box::new(o)),
4098 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4099 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4100 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4101 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4102 err: Box::into_raw(Box::new(e)),
4107 /// Checks if the given object is currently in the success state
4109 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4113 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4114 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4115 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4116 fn drop(&mut self) {
4118 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4119 let _ = unsafe { Box::from_raw(self.contents.result) };
4122 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4123 let _ = unsafe { Box::from_raw(self.contents.err) };
4128 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4129 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4130 let contents = if o.result_ok {
4131 let result = unsafe { o.contents.result };
4132 unsafe { o.contents.result = std::ptr::null_mut() };
4133 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4135 let err = unsafe { o.contents.err };
4136 unsafe { o.contents.err = std::ptr::null_mut(); }
4137 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4141 result_ok: o.result_ok,
4145 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4146 fn clone(&self) -> Self {
4148 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4149 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4152 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4153 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4159 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4160 /// but with all dynamically-allocated buffers duplicated in new buffers.
4161 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4163 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4164 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4165 /// A pointer to the contents in the success state.
4166 /// Reading from this pointer when `result_ok` is not set is undefined.
4167 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4168 /// A pointer to the contents in the error state.
4169 /// Reading from this pointer when `result_ok` is set is undefined.
4170 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4173 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4174 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4175 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4176 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4177 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4178 /// `err` or `result` depending on the state of `result_ok`.
4179 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4180 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4181 pub result_ok: bool,
4184 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4185 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4186 CResult_SpendableOutputDescriptorDecodeErrorZ {
4187 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4188 result: Box::into_raw(Box::new(o)),
4194 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4195 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4196 CResult_SpendableOutputDescriptorDecodeErrorZ {
4197 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4198 err: Box::into_raw(Box::new(e)),
4203 /// Checks if the given object is currently in the success state
4205 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4209 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4210 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4211 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4212 fn drop(&mut self) {
4214 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4215 let _ = unsafe { Box::from_raw(self.contents.result) };
4218 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4219 let _ = unsafe { Box::from_raw(self.contents.err) };
4224 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4225 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4226 let contents = if o.result_ok {
4227 let result = unsafe { o.contents.result };
4228 unsafe { o.contents.result = std::ptr::null_mut() };
4229 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4231 let err = unsafe { o.contents.err };
4232 unsafe { o.contents.err = std::ptr::null_mut(); }
4233 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4237 result_ok: o.result_ok,
4241 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4242 fn clone(&self) -> Self {
4244 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4245 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4248 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4249 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4255 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4256 /// but with all dynamically-allocated buffers duplicated in new buffers.
4257 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4259 /// The contents of CResult_NoneNoneZ
4260 pub union CResult_NoneNoneZPtr {
4261 /// Note that this value is always NULL, as there are no contents in the OK variant
4262 pub result: *mut std::ffi::c_void,
4263 /// Note that this value is always NULL, as there are no contents in the Err variant
4264 pub err: *mut std::ffi::c_void,
4267 /// A CResult_NoneNoneZ represents the result of a fallible operation,
4268 /// containing a () on success and a () on failure.
4269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4270 pub struct CResult_NoneNoneZ {
4271 /// The contents of this CResult_NoneNoneZ, accessible via either
4272 /// `err` or `result` depending on the state of `result_ok`.
4273 pub contents: CResult_NoneNoneZPtr,
4274 /// Whether this CResult_NoneNoneZ represents a success state.
4275 pub result_ok: bool,
4278 /// Creates a new CResult_NoneNoneZ in the success state.
4279 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
4281 contents: CResult_NoneNoneZPtr {
4282 result: std::ptr::null_mut(),
4288 /// Creates a new CResult_NoneNoneZ in the error state.
4289 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
4291 contents: CResult_NoneNoneZPtr {
4292 err: std::ptr::null_mut(),
4297 /// Checks if the given object is currently in the success state
4299 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
4303 /// Frees any resources used by the CResult_NoneNoneZ.
4304 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
4305 impl Drop for CResult_NoneNoneZ {
4306 fn drop(&mut self) {
4312 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
4313 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
4314 let contents = if o.result_ok {
4315 let _ = unsafe { Box::from_raw(o.contents.result) };
4316 o.contents.result = std::ptr::null_mut();
4317 CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
4319 let _ = unsafe { Box::from_raw(o.contents.err) };
4320 o.contents.err = std::ptr::null_mut();
4321 CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
4325 result_ok: o.result_ok,
4329 impl Clone for CResult_NoneNoneZ {
4330 fn clone(&self) -> Self {
4332 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
4333 result: std::ptr::null_mut()
4336 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
4337 err: std::ptr::null_mut()
4343 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
4344 /// but with all dynamically-allocated buffers duplicated in new buffers.
4345 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
4347 /// A tuple of 2 elements. See the individual fields for the types contained.
4348 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4349 /// The element at position 0
4350 pub a: crate::c_types::Signature,
4351 /// The element at position 1
4352 pub b: crate::c_types::derived::CVec_SignatureZ,
4354 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4355 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4362 impl C2Tuple_SignatureCVec_SignatureZZ {
4363 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4367 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4368 fn clone(&self) -> Self {
4370 a: Clone::clone(&self.a),
4371 b: Clone::clone(&self.b),
4376 /// Creates a new tuple which has the same data as `orig`
4377 /// but with all dynamically-allocated buffers duplicated in new buffers.
4378 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4379 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4381 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4382 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4386 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4387 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4389 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4390 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4391 /// A pointer to the contents in the success state.
4392 /// Reading from this pointer when `result_ok` is not set is undefined.
4393 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4394 /// Note that this value is always NULL, as there are no contents in the Err variant
4395 pub err: *mut std::ffi::c_void,
4398 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4399 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4401 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4402 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4403 /// `err` or `result` depending on the state of `result_ok`.
4404 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4405 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4406 pub result_ok: bool,
4409 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4410 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4411 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4412 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4413 result: Box::into_raw(Box::new(o)),
4419 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4420 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4421 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4422 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4423 err: std::ptr::null_mut(),
4428 /// Checks if the given object is currently in the success state
4430 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4434 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4435 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4436 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4437 fn drop(&mut self) {
4439 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4440 let _ = unsafe { Box::from_raw(self.contents.result) };
4446 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4447 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4448 let contents = if o.result_ok {
4449 let result = unsafe { o.contents.result };
4450 unsafe { o.contents.result = std::ptr::null_mut() };
4451 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4453 let _ = unsafe { Box::from_raw(o.contents.err) };
4454 o.contents.err = std::ptr::null_mut();
4455 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
4459 result_ok: o.result_ok,
4463 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4464 fn clone(&self) -> Self {
4466 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4467 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4470 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4471 err: std::ptr::null_mut()
4477 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4478 /// but with all dynamically-allocated buffers duplicated in new buffers.
4479 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4481 /// The contents of CResult_SignatureNoneZ
4482 pub union CResult_SignatureNoneZPtr {
4483 /// A pointer to the contents in the success state.
4484 /// Reading from this pointer when `result_ok` is not set is undefined.
4485 pub result: *mut crate::c_types::Signature,
4486 /// Note that this value is always NULL, as there are no contents in the Err variant
4487 pub err: *mut std::ffi::c_void,
4490 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4491 /// containing a crate::c_types::Signature on success and a () on failure.
4492 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4493 pub struct CResult_SignatureNoneZ {
4494 /// The contents of this CResult_SignatureNoneZ, accessible via either
4495 /// `err` or `result` depending on the state of `result_ok`.
4496 pub contents: CResult_SignatureNoneZPtr,
4497 /// Whether this CResult_SignatureNoneZ represents a success state.
4498 pub result_ok: bool,
4501 /// Creates a new CResult_SignatureNoneZ in the success state.
4502 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4503 CResult_SignatureNoneZ {
4504 contents: CResult_SignatureNoneZPtr {
4505 result: Box::into_raw(Box::new(o)),
4511 /// Creates a new CResult_SignatureNoneZ in the error state.
4512 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4513 CResult_SignatureNoneZ {
4514 contents: CResult_SignatureNoneZPtr {
4515 err: std::ptr::null_mut(),
4520 /// Checks if the given object is currently in the success state
4522 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4526 /// Frees any resources used by the CResult_SignatureNoneZ.
4527 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4528 impl Drop for CResult_SignatureNoneZ {
4529 fn drop(&mut self) {
4531 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4532 let _ = unsafe { Box::from_raw(self.contents.result) };
4538 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4539 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4540 let contents = if o.result_ok {
4541 let result = unsafe { o.contents.result };
4542 unsafe { o.contents.result = std::ptr::null_mut() };
4543 CResult_SignatureNoneZPtr { result }
4545 let _ = unsafe { Box::from_raw(o.contents.err) };
4546 o.contents.err = std::ptr::null_mut();
4547 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
4551 result_ok: o.result_ok,
4555 impl Clone for CResult_SignatureNoneZ {
4556 fn clone(&self) -> Self {
4558 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4559 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4562 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4563 err: std::ptr::null_mut()
4569 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4570 /// but with all dynamically-allocated buffers duplicated in new buffers.
4571 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4573 /// The contents of CResult_SignDecodeErrorZ
4574 pub union CResult_SignDecodeErrorZPtr {
4575 /// A pointer to the contents in the success state.
4576 /// Reading from this pointer when `result_ok` is not set is undefined.
4577 pub result: *mut crate::lightning::chain::keysinterface::Sign,
4578 /// A pointer to the contents in the error state.
4579 /// Reading from this pointer when `result_ok` is set is undefined.
4580 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4583 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4584 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4586 pub struct CResult_SignDecodeErrorZ {
4587 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
4588 /// `err` or `result` depending on the state of `result_ok`.
4589 pub contents: CResult_SignDecodeErrorZPtr,
4590 /// Whether this CResult_SignDecodeErrorZ represents a success state.
4591 pub result_ok: bool,
4594 /// Creates a new CResult_SignDecodeErrorZ in the success state.
4595 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4596 CResult_SignDecodeErrorZ {
4597 contents: CResult_SignDecodeErrorZPtr {
4598 result: Box::into_raw(Box::new(o)),
4604 /// Creates a new CResult_SignDecodeErrorZ in the error state.
4605 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4606 CResult_SignDecodeErrorZ {
4607 contents: CResult_SignDecodeErrorZPtr {
4608 err: Box::into_raw(Box::new(e)),
4613 /// Checks if the given object is currently in the success state
4615 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
4619 /// Frees any resources used by the CResult_SignDecodeErrorZ.
4620 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4621 impl Drop for CResult_SignDecodeErrorZ {
4622 fn drop(&mut self) {
4624 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4625 let _ = unsafe { Box::from_raw(self.contents.result) };
4628 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4629 let _ = unsafe { Box::from_raw(self.contents.err) };
4634 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4635 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
4636 let contents = if o.result_ok {
4637 let result = unsafe { o.contents.result };
4638 unsafe { o.contents.result = std::ptr::null_mut() };
4639 CResult_SignDecodeErrorZPtr { result }
4641 let err = unsafe { o.contents.err };
4642 unsafe { o.contents.err = std::ptr::null_mut(); }
4643 CResult_SignDecodeErrorZPtr { err }
4647 result_ok: o.result_ok,
4651 impl Clone for CResult_SignDecodeErrorZ {
4652 fn clone(&self) -> Self {
4654 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4655 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4658 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4659 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4665 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
4666 /// but with all dynamically-allocated buffers duplicated in new buffers.
4667 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
4669 /// A dynamically-allocated array of u8s of arbitrary size.
4670 /// This corresponds to std::vector in C++
4671 pub struct CVec_u8Z {
4672 /// The elements in the array.
4673 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4675 /// The number of elements pointed to by `data`.
4679 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
4680 if self.datalen == 0 { return Vec::new(); }
4681 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4682 self.data = std::ptr::null_mut();
4686 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
4687 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4690 impl From<Vec<u8>> for CVec_u8Z {
4691 fn from(v: Vec<u8>) -> Self {
4692 let datalen = v.len();
4693 let data = Box::into_raw(v.into_boxed_slice());
4694 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4698 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4699 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
4700 impl Drop for CVec_u8Z {
4701 fn drop(&mut self) {
4702 if self.datalen == 0 { return; }
4703 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4706 impl Clone for CVec_u8Z {
4707 fn clone(&self) -> Self {
4708 let mut res = Vec::new();
4709 if self.datalen == 0 { return Self::from(res); }
4710 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4715 /// The contents of CResult_RecoverableSignatureNoneZ
4716 pub union CResult_RecoverableSignatureNoneZPtr {
4717 /// A pointer to the contents in the success state.
4718 /// Reading from this pointer when `result_ok` is not set is undefined.
4719 pub result: *mut crate::c_types::RecoverableSignature,
4720 /// Note that this value is always NULL, as there are no contents in the Err variant
4721 pub err: *mut std::ffi::c_void,
4724 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4725 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
4726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4727 pub struct CResult_RecoverableSignatureNoneZ {
4728 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4729 /// `err` or `result` depending on the state of `result_ok`.
4730 pub contents: CResult_RecoverableSignatureNoneZPtr,
4731 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4732 pub result_ok: bool,
4735 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4736 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4737 CResult_RecoverableSignatureNoneZ {
4738 contents: CResult_RecoverableSignatureNoneZPtr {
4739 result: Box::into_raw(Box::new(o)),
4745 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4746 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4747 CResult_RecoverableSignatureNoneZ {
4748 contents: CResult_RecoverableSignatureNoneZPtr {
4749 err: std::ptr::null_mut(),
4754 /// Checks if the given object is currently in the success state
4756 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
4760 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4761 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4762 impl Drop for CResult_RecoverableSignatureNoneZ {
4763 fn drop(&mut self) {
4765 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4766 let _ = unsafe { Box::from_raw(self.contents.result) };
4772 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4773 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4774 let contents = if o.result_ok {
4775 let result = unsafe { o.contents.result };
4776 unsafe { o.contents.result = std::ptr::null_mut() };
4777 CResult_RecoverableSignatureNoneZPtr { result }
4779 let _ = unsafe { Box::from_raw(o.contents.err) };
4780 o.contents.err = std::ptr::null_mut();
4781 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
4785 result_ok: o.result_ok,
4789 impl Clone for CResult_RecoverableSignatureNoneZ {
4790 fn clone(&self) -> Self {
4792 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4793 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4796 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4797 err: std::ptr::null_mut()
4803 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4804 /// but with all dynamically-allocated buffers duplicated in new buffers.
4805 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4807 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4808 /// This corresponds to std::vector in C++
4809 pub struct CVec_CVec_u8ZZ {
4810 /// The elements in the array.
4811 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4812 pub data: *mut crate::c_types::derived::CVec_u8Z,
4813 /// The number of elements pointed to by `data`.
4816 impl CVec_CVec_u8ZZ {
4817 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4818 if self.datalen == 0 { return Vec::new(); }
4819 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4820 self.data = std::ptr::null_mut();
4824 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4825 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4828 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4829 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4830 let datalen = v.len();
4831 let data = Box::into_raw(v.into_boxed_slice());
4832 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4836 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4837 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4838 impl Drop for CVec_CVec_u8ZZ {
4839 fn drop(&mut self) {
4840 if self.datalen == 0 { return; }
4841 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4844 impl Clone for CVec_CVec_u8ZZ {
4845 fn clone(&self) -> Self {
4846 let mut res = Vec::new();
4847 if self.datalen == 0 { return Self::from(res); }
4848 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4853 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4854 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4855 /// A pointer to the contents in the success state.
4856 /// Reading from this pointer when `result_ok` is not set is undefined.
4857 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4858 /// Note that this value is always NULL, as there are no contents in the Err variant
4859 pub err: *mut std::ffi::c_void,
4862 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4863 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4865 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4866 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4867 /// `err` or `result` depending on the state of `result_ok`.
4868 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4869 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4870 pub result_ok: bool,
4873 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4874 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4875 CResult_CVec_CVec_u8ZZNoneZ {
4876 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4877 result: Box::into_raw(Box::new(o)),
4883 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4884 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4885 CResult_CVec_CVec_u8ZZNoneZ {
4886 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4887 err: std::ptr::null_mut(),
4892 /// Checks if the given object is currently in the success state
4894 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
4898 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4899 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4900 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4901 fn drop(&mut self) {
4903 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4904 let _ = unsafe { Box::from_raw(self.contents.result) };
4910 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4911 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4912 let contents = if o.result_ok {
4913 let result = unsafe { o.contents.result };
4914 unsafe { o.contents.result = std::ptr::null_mut() };
4915 CResult_CVec_CVec_u8ZZNoneZPtr { result }
4917 let _ = unsafe { Box::from_raw(o.contents.err) };
4918 o.contents.err = std::ptr::null_mut();
4919 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4923 result_ok: o.result_ok,
4927 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4928 fn clone(&self) -> Self {
4930 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4931 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4934 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4935 err: std::ptr::null_mut()
4941 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4942 /// but with all dynamically-allocated buffers duplicated in new buffers.
4943 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4945 /// The contents of CResult_InMemorySignerDecodeErrorZ
4946 pub union CResult_InMemorySignerDecodeErrorZPtr {
4947 /// A pointer to the contents in the success state.
4948 /// Reading from this pointer when `result_ok` is not set is undefined.
4949 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4950 /// A pointer to the contents in the error state.
4951 /// Reading from this pointer when `result_ok` is set is undefined.
4952 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4955 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4956 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4957 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4958 pub struct CResult_InMemorySignerDecodeErrorZ {
4959 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4960 /// `err` or `result` depending on the state of `result_ok`.
4961 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4962 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4963 pub result_ok: bool,
4966 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4967 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4968 CResult_InMemorySignerDecodeErrorZ {
4969 contents: CResult_InMemorySignerDecodeErrorZPtr {
4970 result: Box::into_raw(Box::new(o)),
4976 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4977 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4978 CResult_InMemorySignerDecodeErrorZ {
4979 contents: CResult_InMemorySignerDecodeErrorZPtr {
4980 err: Box::into_raw(Box::new(e)),
4985 /// Checks if the given object is currently in the success state
4987 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
4991 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
4992 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4993 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4994 fn drop(&mut self) {
4996 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4997 let _ = unsafe { Box::from_raw(self.contents.result) };
5000 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5001 let _ = unsafe { Box::from_raw(self.contents.err) };
5006 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5007 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5008 let contents = if o.result_ok {
5009 let result = unsafe { o.contents.result };
5010 unsafe { o.contents.result = std::ptr::null_mut() };
5011 CResult_InMemorySignerDecodeErrorZPtr { result }
5013 let err = unsafe { o.contents.err };
5014 unsafe { o.contents.err = std::ptr::null_mut(); }
5015 CResult_InMemorySignerDecodeErrorZPtr { err }
5019 result_ok: o.result_ok,
5023 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5024 fn clone(&self) -> Self {
5026 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5027 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5030 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5031 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5037 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5038 /// but with all dynamically-allocated buffers duplicated in new buffers.
5039 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5041 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5042 /// This corresponds to std::vector in C++
5043 pub struct CVec_TxOutZ {
5044 /// The elements in the array.
5045 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5046 pub data: *mut crate::c_types::TxOut,
5047 /// The number of elements pointed to by `data`.
5051 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5052 if self.datalen == 0 { return Vec::new(); }
5053 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5054 self.data = std::ptr::null_mut();
5058 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5059 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5062 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5063 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5064 let datalen = v.len();
5065 let data = Box::into_raw(v.into_boxed_slice());
5066 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5070 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5071 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5072 impl Drop for CVec_TxOutZ {
5073 fn drop(&mut self) {
5074 if self.datalen == 0 { return; }
5075 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5078 impl Clone for CVec_TxOutZ {
5079 fn clone(&self) -> Self {
5080 let mut res = Vec::new();
5081 if self.datalen == 0 { return Self::from(res); }
5082 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5087 /// The contents of CResult_TransactionNoneZ
5088 pub union CResult_TransactionNoneZPtr {
5089 /// A pointer to the contents in the success state.
5090 /// Reading from this pointer when `result_ok` is not set is undefined.
5091 pub result: *mut crate::c_types::Transaction,
5092 /// Note that this value is always NULL, as there are no contents in the Err variant
5093 pub err: *mut std::ffi::c_void,
5096 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5097 /// containing a crate::c_types::Transaction on success and a () on failure.
5098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5099 pub struct CResult_TransactionNoneZ {
5100 /// The contents of this CResult_TransactionNoneZ, accessible via either
5101 /// `err` or `result` depending on the state of `result_ok`.
5102 pub contents: CResult_TransactionNoneZPtr,
5103 /// Whether this CResult_TransactionNoneZ represents a success state.
5104 pub result_ok: bool,
5107 /// Creates a new CResult_TransactionNoneZ in the success state.
5108 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5109 CResult_TransactionNoneZ {
5110 contents: CResult_TransactionNoneZPtr {
5111 result: Box::into_raw(Box::new(o)),
5117 /// Creates a new CResult_TransactionNoneZ in the error state.
5118 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5119 CResult_TransactionNoneZ {
5120 contents: CResult_TransactionNoneZPtr {
5121 err: std::ptr::null_mut(),
5126 /// Checks if the given object is currently in the success state
5128 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5132 /// Frees any resources used by the CResult_TransactionNoneZ.
5133 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5134 impl Drop for CResult_TransactionNoneZ {
5135 fn drop(&mut self) {
5137 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5138 let _ = unsafe { Box::from_raw(self.contents.result) };
5144 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5145 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5146 let contents = if o.result_ok {
5147 let result = unsafe { o.contents.result };
5148 unsafe { o.contents.result = std::ptr::null_mut() };
5149 CResult_TransactionNoneZPtr { result }
5151 let _ = unsafe { Box::from_raw(o.contents.err) };
5152 o.contents.err = std::ptr::null_mut();
5153 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
5157 result_ok: o.result_ok,
5161 impl Clone for CResult_TransactionNoneZ {
5162 fn clone(&self) -> Self {
5164 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5165 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5168 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5169 err: std::ptr::null_mut()
5175 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5176 /// but with all dynamically-allocated buffers duplicated in new buffers.
5177 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5179 /// A tuple of 2 elements. See the individual fields for the types contained.
5180 pub struct C2Tuple_BlockHashChannelMonitorZ {
5181 /// The element at position 0
5182 pub a: crate::c_types::ThirtyTwoBytes,
5183 /// The element at position 1
5184 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5186 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5187 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5194 impl C2Tuple_BlockHashChannelMonitorZ {
5195 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5199 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5201 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5202 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5206 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5207 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5209 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5210 /// This corresponds to std::vector in C++
5211 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5212 /// The elements in the array.
5213 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5214 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5215 /// The number of elements pointed to by `data`.
5218 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5219 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5220 if self.datalen == 0 { return Vec::new(); }
5221 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5222 self.data = std::ptr::null_mut();
5226 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5227 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5230 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5231 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5232 let datalen = v.len();
5233 let data = Box::into_raw(v.into_boxed_slice());
5234 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5238 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5239 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5240 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5241 fn drop(&mut self) {
5242 if self.datalen == 0 { return; }
5243 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5247 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5248 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5249 /// A pointer to the contents in the success state.
5250 /// Reading from this pointer when `result_ok` is not set is undefined.
5251 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5252 /// A pointer to the contents in the error state.
5253 /// Reading from this pointer when `result_ok` is set is undefined.
5254 pub err: *mut crate::c_types::IOError,
5257 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5258 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5259 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5260 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5261 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5262 /// `err` or `result` depending on the state of `result_ok`.
5263 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5264 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5265 pub result_ok: bool,
5268 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5269 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5270 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5271 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5272 result: Box::into_raw(Box::new(o)),
5278 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5279 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5280 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5281 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5282 err: Box::into_raw(Box::new(e)),
5287 /// Checks if the given object is currently in the success state
5289 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5293 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5294 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5295 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5296 fn drop(&mut self) {
5298 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5299 let _ = unsafe { Box::from_raw(self.contents.result) };
5302 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5303 let _ = unsafe { Box::from_raw(self.contents.err) };
5308 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5309 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5310 let contents = if o.result_ok {
5311 let result = unsafe { o.contents.result };
5312 unsafe { o.contents.result = std::ptr::null_mut() };
5313 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5315 let err = unsafe { o.contents.err };
5316 unsafe { o.contents.err = std::ptr::null_mut(); }
5317 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5321 result_ok: o.result_ok,
5327 /// An enum which can either contain a u16 or not
5328 pub enum COption_u16Z {
5329 /// When we're in this state, this COption_u16Z contains a u16
5331 /// When we're in this state, this COption_u16Z contains nothing
5335 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5336 if let Self::None = self { false } else { true }
5338 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5341 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5342 if let Self::Some(v) = self { v } else { unreachable!() }
5346 /// Constructs a new COption_u16Z containing a u16
5347 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5348 COption_u16Z::Some(o)
5351 /// Constructs a new COption_u16Z containing nothing
5352 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5356 /// Frees any resources associated with the u16, if we are in the Some state
5357 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5359 /// Creates a new COption_u16Z which has the same data as `orig`
5360 /// but with all dynamically-allocated buffers duplicated in new buffers.
5361 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5363 /// The contents of CResult_NoneAPIErrorZ
5364 pub union CResult_NoneAPIErrorZPtr {
5365 /// Note that this value is always NULL, as there are no contents in the OK variant
5366 pub result: *mut std::ffi::c_void,
5367 /// A pointer to the contents in the error state.
5368 /// Reading from this pointer when `result_ok` is set is undefined.
5369 pub err: *mut crate::lightning::util::errors::APIError,
5372 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5373 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
5374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5375 pub struct CResult_NoneAPIErrorZ {
5376 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
5377 /// `err` or `result` depending on the state of `result_ok`.
5378 pub contents: CResult_NoneAPIErrorZPtr,
5379 /// Whether this CResult_NoneAPIErrorZ represents a success state.
5380 pub result_ok: bool,
5383 /// Creates a new CResult_NoneAPIErrorZ in the success state.
5384 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
5385 CResult_NoneAPIErrorZ {
5386 contents: CResult_NoneAPIErrorZPtr {
5387 result: std::ptr::null_mut(),
5393 /// Creates a new CResult_NoneAPIErrorZ in the error state.
5394 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
5395 CResult_NoneAPIErrorZ {
5396 contents: CResult_NoneAPIErrorZPtr {
5397 err: Box::into_raw(Box::new(e)),
5402 /// Checks if the given object is currently in the success state
5404 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
5408 /// Frees any resources used by the CResult_NoneAPIErrorZ.
5409 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
5410 impl Drop for CResult_NoneAPIErrorZ {
5411 fn drop(&mut self) {
5414 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5415 let _ = unsafe { Box::from_raw(self.contents.err) };
5420 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
5421 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
5422 let contents = if o.result_ok {
5423 let _ = unsafe { Box::from_raw(o.contents.result) };
5424 o.contents.result = std::ptr::null_mut();
5425 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
5427 let err = unsafe { o.contents.err };
5428 unsafe { o.contents.err = std::ptr::null_mut(); }
5429 CResult_NoneAPIErrorZPtr { err }
5433 result_ok: o.result_ok,
5437 impl Clone for CResult_NoneAPIErrorZ {
5438 fn clone(&self) -> Self {
5440 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
5441 result: std::ptr::null_mut()
5444 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
5445 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5451 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
5452 /// but with all dynamically-allocated buffers duplicated in new buffers.
5453 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
5455 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5456 /// This corresponds to std::vector in C++
5457 pub struct CVec_CResult_NoneAPIErrorZZ {
5458 /// The elements in the array.
5459 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5460 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
5461 /// The number of elements pointed to by `data`.
5464 impl CVec_CResult_NoneAPIErrorZZ {
5465 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
5466 if self.datalen == 0 { return Vec::new(); }
5467 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5468 self.data = std::ptr::null_mut();
5472 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
5473 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5476 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
5477 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
5478 let datalen = v.len();
5479 let data = Box::into_raw(v.into_boxed_slice());
5480 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5484 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5485 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
5486 impl Drop for CVec_CResult_NoneAPIErrorZZ {
5487 fn drop(&mut self) {
5488 if self.datalen == 0 { return; }
5489 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5492 impl Clone for CVec_CResult_NoneAPIErrorZZ {
5493 fn clone(&self) -> Self {
5494 let mut res = Vec::new();
5495 if self.datalen == 0 { return Self::from(res); }
5496 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5501 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5502 /// This corresponds to std::vector in C++
5503 pub struct CVec_APIErrorZ {
5504 /// The elements in the array.
5505 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5506 pub data: *mut crate::lightning::util::errors::APIError,
5507 /// The number of elements pointed to by `data`.
5510 impl CVec_APIErrorZ {
5511 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
5512 if self.datalen == 0 { return Vec::new(); }
5513 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5514 self.data = std::ptr::null_mut();
5518 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
5519 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5522 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
5523 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
5524 let datalen = v.len();
5525 let data = Box::into_raw(v.into_boxed_slice());
5526 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5530 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5531 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
5532 impl Drop for CVec_APIErrorZ {
5533 fn drop(&mut self) {
5534 if self.datalen == 0 { return; }
5535 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5538 impl Clone for CVec_APIErrorZ {
5539 fn clone(&self) -> Self {
5540 let mut res = Vec::new();
5541 if self.datalen == 0 { return Self::from(res); }
5542 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5547 /// The contents of CResult__u832APIErrorZ
5548 pub union CResult__u832APIErrorZPtr {
5549 /// A pointer to the contents in the success state.
5550 /// Reading from this pointer when `result_ok` is not set is undefined.
5551 pub result: *mut crate::c_types::ThirtyTwoBytes,
5552 /// A pointer to the contents in the error state.
5553 /// Reading from this pointer when `result_ok` is set is undefined.
5554 pub err: *mut crate::lightning::util::errors::APIError,
5557 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
5558 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5559 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5560 pub struct CResult__u832APIErrorZ {
5561 /// The contents of this CResult__u832APIErrorZ, accessible via either
5562 /// `err` or `result` depending on the state of `result_ok`.
5563 pub contents: CResult__u832APIErrorZPtr,
5564 /// Whether this CResult__u832APIErrorZ represents a success state.
5565 pub result_ok: bool,
5568 /// Creates a new CResult__u832APIErrorZ in the success state.
5569 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
5570 CResult__u832APIErrorZ {
5571 contents: CResult__u832APIErrorZPtr {
5572 result: Box::into_raw(Box::new(o)),
5578 /// Creates a new CResult__u832APIErrorZ in the error state.
5579 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
5580 CResult__u832APIErrorZ {
5581 contents: CResult__u832APIErrorZPtr {
5582 err: Box::into_raw(Box::new(e)),
5587 /// Checks if the given object is currently in the success state
5589 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
5593 /// Frees any resources used by the CResult__u832APIErrorZ.
5594 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
5595 impl Drop for CResult__u832APIErrorZ {
5596 fn drop(&mut self) {
5598 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5599 let _ = unsafe { Box::from_raw(self.contents.result) };
5602 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5603 let _ = unsafe { Box::from_raw(self.contents.err) };
5608 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
5609 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5610 let contents = if o.result_ok {
5611 let result = unsafe { o.contents.result };
5612 unsafe { o.contents.result = std::ptr::null_mut() };
5613 CResult__u832APIErrorZPtr { result }
5615 let err = unsafe { o.contents.err };
5616 unsafe { o.contents.err = std::ptr::null_mut(); }
5617 CResult__u832APIErrorZPtr { err }
5621 result_ok: o.result_ok,
5625 impl Clone for CResult__u832APIErrorZ {
5626 fn clone(&self) -> Self {
5628 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
5629 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5632 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
5633 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5639 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
5640 /// but with all dynamically-allocated buffers duplicated in new buffers.
5641 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
5643 /// The contents of CResult_PaymentIdPaymentSendFailureZ
5644 pub union CResult_PaymentIdPaymentSendFailureZPtr {
5645 /// A pointer to the contents in the success state.
5646 /// Reading from this pointer when `result_ok` is not set is undefined.
5647 pub result: *mut crate::c_types::ThirtyTwoBytes,
5648 /// A pointer to the contents in the error state.
5649 /// Reading from this pointer when `result_ok` is set is undefined.
5650 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5653 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5654 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5655 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5656 pub struct CResult_PaymentIdPaymentSendFailureZ {
5657 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5658 /// `err` or `result` depending on the state of `result_ok`.
5659 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
5660 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5661 pub result_ok: bool,
5664 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
5665 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
5666 CResult_PaymentIdPaymentSendFailureZ {
5667 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5668 result: Box::into_raw(Box::new(o)),
5674 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
5675 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
5676 CResult_PaymentIdPaymentSendFailureZ {
5677 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5678 err: Box::into_raw(Box::new(e)),
5683 /// Checks if the given object is currently in the success state
5685 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
5689 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
5690 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
5691 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
5692 fn drop(&mut self) {
5694 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5695 let _ = unsafe { Box::from_raw(self.contents.result) };
5698 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5699 let _ = unsafe { Box::from_raw(self.contents.err) };
5704 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
5705 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5706 let contents = if o.result_ok {
5707 let result = unsafe { o.contents.result };
5708 unsafe { o.contents.result = std::ptr::null_mut() };
5709 CResult_PaymentIdPaymentSendFailureZPtr { result }
5711 let err = unsafe { o.contents.err };
5712 unsafe { o.contents.err = std::ptr::null_mut(); }
5713 CResult_PaymentIdPaymentSendFailureZPtr { err }
5717 result_ok: o.result_ok,
5721 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
5722 fn clone(&self) -> Self {
5724 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5725 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5728 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5729 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5735 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
5736 /// but with all dynamically-allocated buffers duplicated in new buffers.
5737 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
5739 /// The contents of CResult_NonePaymentSendFailureZ
5740 pub union CResult_NonePaymentSendFailureZPtr {
5741 /// Note that this value is always NULL, as there are no contents in the OK variant
5742 pub result: *mut std::ffi::c_void,
5743 /// A pointer to the contents in the error state.
5744 /// Reading from this pointer when `result_ok` is set is undefined.
5745 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5748 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5749 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5751 pub struct CResult_NonePaymentSendFailureZ {
5752 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5753 /// `err` or `result` depending on the state of `result_ok`.
5754 pub contents: CResult_NonePaymentSendFailureZPtr,
5755 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
5756 pub result_ok: bool,
5759 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
5760 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
5761 CResult_NonePaymentSendFailureZ {
5762 contents: CResult_NonePaymentSendFailureZPtr {
5763 result: std::ptr::null_mut(),
5769 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
5770 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
5771 CResult_NonePaymentSendFailureZ {
5772 contents: CResult_NonePaymentSendFailureZPtr {
5773 err: Box::into_raw(Box::new(e)),
5778 /// Checks if the given object is currently in the success state
5780 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
5784 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5785 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5786 impl Drop for CResult_NonePaymentSendFailureZ {
5787 fn drop(&mut self) {
5790 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5791 let _ = unsafe { Box::from_raw(self.contents.err) };
5796 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5797 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5798 let contents = if o.result_ok {
5799 let _ = unsafe { Box::from_raw(o.contents.result) };
5800 o.contents.result = std::ptr::null_mut();
5801 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
5803 let err = unsafe { o.contents.err };
5804 unsafe { o.contents.err = std::ptr::null_mut(); }
5805 CResult_NonePaymentSendFailureZPtr { err }
5809 result_ok: o.result_ok,
5813 impl Clone for CResult_NonePaymentSendFailureZ {
5814 fn clone(&self) -> Self {
5816 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5817 result: std::ptr::null_mut()
5820 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5821 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5827 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5828 /// but with all dynamically-allocated buffers duplicated in new buffers.
5829 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5831 /// A tuple of 2 elements. See the individual fields for the types contained.
5832 pub struct C2Tuple_PaymentHashPaymentIdZ {
5833 /// The element at position 0
5834 pub a: crate::c_types::ThirtyTwoBytes,
5835 /// The element at position 1
5836 pub b: crate::c_types::ThirtyTwoBytes,
5838 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5839 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5846 impl C2Tuple_PaymentHashPaymentIdZ {
5847 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5851 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5852 fn clone(&self) -> Self {
5854 a: Clone::clone(&self.a),
5855 b: Clone::clone(&self.b),
5860 /// Creates a new tuple which has the same data as `orig`
5861 /// but with all dynamically-allocated buffers duplicated in new buffers.
5862 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5863 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5865 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5866 C2Tuple_PaymentHashPaymentIdZ { a, b, }
5870 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5871 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5873 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5874 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5875 /// A pointer to the contents in the success state.
5876 /// Reading from this pointer when `result_ok` is not set is undefined.
5877 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5878 /// A pointer to the contents in the error state.
5879 /// Reading from this pointer when `result_ok` is set is undefined.
5880 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5883 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5884 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5886 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5887 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5888 /// `err` or `result` depending on the state of `result_ok`.
5889 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5890 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5891 pub result_ok: bool,
5894 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5895 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5896 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5897 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5898 result: Box::into_raw(Box::new(o)),
5904 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5905 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5906 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5907 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5908 err: Box::into_raw(Box::new(e)),
5913 /// Checks if the given object is currently in the success state
5915 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
5919 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5920 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5921 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5922 fn drop(&mut self) {
5924 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5925 let _ = unsafe { Box::from_raw(self.contents.result) };
5928 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5929 let _ = unsafe { Box::from_raw(self.contents.err) };
5934 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5935 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5936 let contents = if o.result_ok {
5937 let result = unsafe { o.contents.result };
5938 unsafe { o.contents.result = std::ptr::null_mut() };
5939 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5941 let err = unsafe { o.contents.err };
5942 unsafe { o.contents.err = std::ptr::null_mut(); }
5943 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5947 result_ok: o.result_ok,
5951 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5952 fn clone(&self) -> Self {
5954 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5955 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5958 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5959 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5965 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5966 /// but with all dynamically-allocated buffers duplicated in new buffers.
5967 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5969 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5970 /// This corresponds to std::vector in C++
5971 pub struct CVec_NetAddressZ {
5972 /// The elements in the array.
5973 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5974 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5975 /// The number of elements pointed to by `data`.
5978 impl CVec_NetAddressZ {
5979 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5980 if self.datalen == 0 { return Vec::new(); }
5981 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5982 self.data = std::ptr::null_mut();
5986 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5987 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5990 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5991 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5992 let datalen = v.len();
5993 let data = Box::into_raw(v.into_boxed_slice());
5994 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5998 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5999 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6000 impl Drop for CVec_NetAddressZ {
6001 fn drop(&mut self) {
6002 if self.datalen == 0 { return; }
6003 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6006 impl Clone for CVec_NetAddressZ {
6007 fn clone(&self) -> Self {
6008 let mut res = Vec::new();
6009 if self.datalen == 0 { return Self::from(res); }
6010 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6015 /// A tuple of 2 elements. See the individual fields for the types contained.
6016 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6017 /// The element at position 0
6018 pub a: crate::c_types::ThirtyTwoBytes,
6019 /// The element at position 1
6020 pub b: crate::c_types::ThirtyTwoBytes,
6022 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6023 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6030 impl C2Tuple_PaymentHashPaymentSecretZ {
6031 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6035 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6036 fn clone(&self) -> Self {
6038 a: Clone::clone(&self.a),
6039 b: Clone::clone(&self.b),
6044 /// Creates a new tuple which has the same data as `orig`
6045 /// but with all dynamically-allocated buffers duplicated in new buffers.
6046 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6047 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6049 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6050 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6054 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6055 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6057 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6058 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6059 /// A pointer to the contents in the success state.
6060 /// Reading from this pointer when `result_ok` is not set is undefined.
6061 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6062 /// Note that this value is always NULL, as there are no contents in the Err variant
6063 pub err: *mut std::ffi::c_void,
6066 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6067 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6069 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6070 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6071 /// `err` or `result` depending on the state of `result_ok`.
6072 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6073 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6074 pub result_ok: bool,
6077 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6078 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6079 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6080 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6081 result: Box::into_raw(Box::new(o)),
6087 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6088 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6089 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6090 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6091 err: std::ptr::null_mut(),
6096 /// Checks if the given object is currently in the success state
6098 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6102 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6103 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6104 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6105 fn drop(&mut self) {
6107 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6108 let _ = unsafe { Box::from_raw(self.contents.result) };
6114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6115 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6116 let contents = if o.result_ok {
6117 let result = unsafe { o.contents.result };
6118 unsafe { o.contents.result = std::ptr::null_mut() };
6119 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6121 let _ = unsafe { Box::from_raw(o.contents.err) };
6122 o.contents.err = std::ptr::null_mut();
6123 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: std::ptr::null_mut() }
6127 result_ok: o.result_ok,
6131 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6132 fn clone(&self) -> Self {
6134 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6135 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6138 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6139 err: std::ptr::null_mut()
6145 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6146 /// but with all dynamically-allocated buffers duplicated in new buffers.
6147 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6149 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6150 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6151 /// A pointer to the contents in the success state.
6152 /// Reading from this pointer when `result_ok` is not set is undefined.
6153 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6154 /// A pointer to the contents in the error state.
6155 /// Reading from this pointer when `result_ok` is set is undefined.
6156 pub err: *mut crate::lightning::util::errors::APIError,
6159 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6160 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6162 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6163 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6164 /// `err` or `result` depending on the state of `result_ok`.
6165 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6166 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6167 pub result_ok: bool,
6170 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6171 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6172 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6173 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6174 result: Box::into_raw(Box::new(o)),
6180 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6181 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6182 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6183 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6184 err: Box::into_raw(Box::new(e)),
6189 /// Checks if the given object is currently in the success state
6191 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6195 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6196 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6197 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6198 fn drop(&mut self) {
6200 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6201 let _ = unsafe { Box::from_raw(self.contents.result) };
6204 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6205 let _ = unsafe { Box::from_raw(self.contents.err) };
6210 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6211 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6212 let contents = if o.result_ok {
6213 let result = unsafe { o.contents.result };
6214 unsafe { o.contents.result = std::ptr::null_mut() };
6215 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6217 let err = unsafe { o.contents.err };
6218 unsafe { o.contents.err = std::ptr::null_mut(); }
6219 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6223 result_ok: o.result_ok,
6227 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6228 fn clone(&self) -> Self {
6230 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6231 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6234 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6235 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6241 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6242 /// but with all dynamically-allocated buffers duplicated in new buffers.
6243 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6245 /// The contents of CResult_PaymentSecretNoneZ
6246 pub union CResult_PaymentSecretNoneZPtr {
6247 /// A pointer to the contents in the success state.
6248 /// Reading from this pointer when `result_ok` is not set is undefined.
6249 pub result: *mut crate::c_types::ThirtyTwoBytes,
6250 /// Note that this value is always NULL, as there are no contents in the Err variant
6251 pub err: *mut std::ffi::c_void,
6254 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6255 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6256 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6257 pub struct CResult_PaymentSecretNoneZ {
6258 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6259 /// `err` or `result` depending on the state of `result_ok`.
6260 pub contents: CResult_PaymentSecretNoneZPtr,
6261 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6262 pub result_ok: bool,
6265 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6266 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6267 CResult_PaymentSecretNoneZ {
6268 contents: CResult_PaymentSecretNoneZPtr {
6269 result: Box::into_raw(Box::new(o)),
6275 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6276 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6277 CResult_PaymentSecretNoneZ {
6278 contents: CResult_PaymentSecretNoneZPtr {
6279 err: std::ptr::null_mut(),
6284 /// Checks if the given object is currently in the success state
6286 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6290 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6291 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6292 impl Drop for CResult_PaymentSecretNoneZ {
6293 fn drop(&mut self) {
6295 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6296 let _ = unsafe { Box::from_raw(self.contents.result) };
6302 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6303 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6304 let contents = if o.result_ok {
6305 let result = unsafe { o.contents.result };
6306 unsafe { o.contents.result = std::ptr::null_mut() };
6307 CResult_PaymentSecretNoneZPtr { result }
6309 let _ = unsafe { Box::from_raw(o.contents.err) };
6310 o.contents.err = std::ptr::null_mut();
6311 CResult_PaymentSecretNoneZPtr { err: std::ptr::null_mut() }
6315 result_ok: o.result_ok,
6319 impl Clone for CResult_PaymentSecretNoneZ {
6320 fn clone(&self) -> Self {
6322 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6323 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6326 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6327 err: std::ptr::null_mut()
6333 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6334 /// but with all dynamically-allocated buffers duplicated in new buffers.
6335 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6337 /// The contents of CResult_PaymentSecretAPIErrorZ
6338 pub union CResult_PaymentSecretAPIErrorZPtr {
6339 /// A pointer to the contents in the success state.
6340 /// Reading from this pointer when `result_ok` is not set is undefined.
6341 pub result: *mut crate::c_types::ThirtyTwoBytes,
6342 /// A pointer to the contents in the error state.
6343 /// Reading from this pointer when `result_ok` is set is undefined.
6344 pub err: *mut crate::lightning::util::errors::APIError,
6347 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6348 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6350 pub struct CResult_PaymentSecretAPIErrorZ {
6351 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6352 /// `err` or `result` depending on the state of `result_ok`.
6353 pub contents: CResult_PaymentSecretAPIErrorZPtr,
6354 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6355 pub result_ok: bool,
6358 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6359 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6360 CResult_PaymentSecretAPIErrorZ {
6361 contents: CResult_PaymentSecretAPIErrorZPtr {
6362 result: Box::into_raw(Box::new(o)),
6368 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
6369 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
6370 CResult_PaymentSecretAPIErrorZ {
6371 contents: CResult_PaymentSecretAPIErrorZPtr {
6372 err: Box::into_raw(Box::new(e)),
6377 /// Checks if the given object is currently in the success state
6379 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
6383 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
6384 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
6385 impl Drop for CResult_PaymentSecretAPIErrorZ {
6386 fn drop(&mut self) {
6388 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6389 let _ = unsafe { Box::from_raw(self.contents.result) };
6392 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6393 let _ = unsafe { Box::from_raw(self.contents.err) };
6398 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
6399 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6400 let contents = if o.result_ok {
6401 let result = unsafe { o.contents.result };
6402 unsafe { o.contents.result = std::ptr::null_mut() };
6403 CResult_PaymentSecretAPIErrorZPtr { result }
6405 let err = unsafe { o.contents.err };
6406 unsafe { o.contents.err = std::ptr::null_mut(); }
6407 CResult_PaymentSecretAPIErrorZPtr { err }
6411 result_ok: o.result_ok,
6415 impl Clone for CResult_PaymentSecretAPIErrorZ {
6416 fn clone(&self) -> Self {
6418 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
6419 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6422 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
6423 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6429 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
6430 /// but with all dynamically-allocated buffers duplicated in new buffers.
6431 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
6433 /// The contents of CResult_PaymentPreimageAPIErrorZ
6434 pub union CResult_PaymentPreimageAPIErrorZPtr {
6435 /// A pointer to the contents in the success state.
6436 /// Reading from this pointer when `result_ok` is not set is undefined.
6437 pub result: *mut crate::c_types::ThirtyTwoBytes,
6438 /// A pointer to the contents in the error state.
6439 /// Reading from this pointer when `result_ok` is set is undefined.
6440 pub err: *mut crate::lightning::util::errors::APIError,
6443 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
6444 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6446 pub struct CResult_PaymentPreimageAPIErrorZ {
6447 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
6448 /// `err` or `result` depending on the state of `result_ok`.
6449 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
6450 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
6451 pub result_ok: bool,
6454 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
6455 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
6456 CResult_PaymentPreimageAPIErrorZ {
6457 contents: CResult_PaymentPreimageAPIErrorZPtr {
6458 result: Box::into_raw(Box::new(o)),
6464 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
6465 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
6466 CResult_PaymentPreimageAPIErrorZ {
6467 contents: CResult_PaymentPreimageAPIErrorZPtr {
6468 err: Box::into_raw(Box::new(e)),
6473 /// Checks if the given object is currently in the success state
6475 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
6479 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
6480 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
6481 impl Drop for CResult_PaymentPreimageAPIErrorZ {
6482 fn drop(&mut self) {
6484 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6485 let _ = unsafe { Box::from_raw(self.contents.result) };
6488 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6489 let _ = unsafe { Box::from_raw(self.contents.err) };
6494 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
6495 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6496 let contents = if o.result_ok {
6497 let result = unsafe { o.contents.result };
6498 unsafe { o.contents.result = std::ptr::null_mut() };
6499 CResult_PaymentPreimageAPIErrorZPtr { result }
6501 let err = unsafe { o.contents.err };
6502 unsafe { o.contents.err = std::ptr::null_mut(); }
6503 CResult_PaymentPreimageAPIErrorZPtr { err }
6507 result_ok: o.result_ok,
6511 impl Clone for CResult_PaymentPreimageAPIErrorZ {
6512 fn clone(&self) -> Self {
6514 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
6515 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6518 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
6519 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6525 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
6526 /// but with all dynamically-allocated buffers duplicated in new buffers.
6527 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
6529 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6530 /// This corresponds to std::vector in C++
6531 pub struct CVec_ChannelMonitorZ {
6532 /// The elements in the array.
6533 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6534 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
6535 /// The number of elements pointed to by `data`.
6538 impl CVec_ChannelMonitorZ {
6539 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
6540 if self.datalen == 0 { return Vec::new(); }
6541 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6542 self.data = std::ptr::null_mut();
6546 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
6547 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6550 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
6551 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
6552 let datalen = v.len();
6553 let data = Box::into_raw(v.into_boxed_slice());
6554 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6558 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6559 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
6560 impl Drop for CVec_ChannelMonitorZ {
6561 fn drop(&mut self) {
6562 if self.datalen == 0 { return; }
6563 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6567 /// A tuple of 2 elements. See the individual fields for the types contained.
6568 pub struct C2Tuple_BlockHashChannelManagerZ {
6569 /// The element at position 0
6570 pub a: crate::c_types::ThirtyTwoBytes,
6571 /// The element at position 1
6572 pub b: crate::lightning::ln::channelmanager::ChannelManager,
6574 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
6575 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
6582 impl C2Tuple_BlockHashChannelManagerZ {
6583 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
6587 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
6589 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
6590 C2Tuple_BlockHashChannelManagerZ { a, b, }
6594 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
6595 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
6597 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6598 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6599 /// A pointer to the contents in the success state.
6600 /// Reading from this pointer when `result_ok` is not set is undefined.
6601 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
6602 /// A pointer to the contents in the error state.
6603 /// Reading from this pointer when `result_ok` is set is undefined.
6604 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6607 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6608 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6609 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6610 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6611 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6612 /// `err` or `result` depending on the state of `result_ok`.
6613 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
6614 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6615 pub result_ok: bool,
6618 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
6619 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6620 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6621 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6622 result: Box::into_raw(Box::new(o)),
6628 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
6629 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6630 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6631 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6632 err: Box::into_raw(Box::new(e)),
6637 /// Checks if the given object is currently in the success state
6639 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
6643 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
6644 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
6645 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6646 fn drop(&mut self) {
6648 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6649 let _ = unsafe { Box::from_raw(self.contents.result) };
6652 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6653 let _ = unsafe { Box::from_raw(self.contents.err) };
6658 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6659 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6660 let contents = if o.result_ok {
6661 let result = unsafe { o.contents.result };
6662 unsafe { o.contents.result = std::ptr::null_mut() };
6663 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
6665 let err = unsafe { o.contents.err };
6666 unsafe { o.contents.err = std::ptr::null_mut(); }
6667 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
6671 result_ok: o.result_ok,
6676 /// The contents of CResult_ChannelConfigDecodeErrorZ
6677 pub union CResult_ChannelConfigDecodeErrorZPtr {
6678 /// A pointer to the contents in the success state.
6679 /// Reading from this pointer when `result_ok` is not set is undefined.
6680 pub result: *mut crate::lightning::util::config::ChannelConfig,
6681 /// A pointer to the contents in the error state.
6682 /// Reading from this pointer when `result_ok` is set is undefined.
6683 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6686 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6687 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6689 pub struct CResult_ChannelConfigDecodeErrorZ {
6690 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6691 /// `err` or `result` depending on the state of `result_ok`.
6692 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
6693 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6694 pub result_ok: bool,
6697 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
6698 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
6699 CResult_ChannelConfigDecodeErrorZ {
6700 contents: CResult_ChannelConfigDecodeErrorZPtr {
6701 result: Box::into_raw(Box::new(o)),
6707 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
6708 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
6709 CResult_ChannelConfigDecodeErrorZ {
6710 contents: CResult_ChannelConfigDecodeErrorZPtr {
6711 err: Box::into_raw(Box::new(e)),
6716 /// Checks if the given object is currently in the success state
6718 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
6722 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
6723 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
6724 impl Drop for CResult_ChannelConfigDecodeErrorZ {
6725 fn drop(&mut self) {
6727 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6728 let _ = unsafe { Box::from_raw(self.contents.result) };
6731 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6732 let _ = unsafe { Box::from_raw(self.contents.err) };
6737 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
6738 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
6739 let contents = if o.result_ok {
6740 let result = unsafe { o.contents.result };
6741 unsafe { o.contents.result = std::ptr::null_mut() };
6742 CResult_ChannelConfigDecodeErrorZPtr { result }
6744 let err = unsafe { o.contents.err };
6745 unsafe { o.contents.err = std::ptr::null_mut(); }
6746 CResult_ChannelConfigDecodeErrorZPtr { err }
6750 result_ok: o.result_ok,
6754 impl Clone for CResult_ChannelConfigDecodeErrorZ {
6755 fn clone(&self) -> Self {
6757 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
6758 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
6761 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
6762 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6768 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
6769 /// but with all dynamically-allocated buffers duplicated in new buffers.
6770 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
6772 /// The contents of CResult_OutPointDecodeErrorZ
6773 pub union CResult_OutPointDecodeErrorZPtr {
6774 /// A pointer to the contents in the success state.
6775 /// Reading from this pointer when `result_ok` is not set is undefined.
6776 pub result: *mut crate::lightning::chain::transaction::OutPoint,
6777 /// A pointer to the contents in the error state.
6778 /// Reading from this pointer when `result_ok` is set is undefined.
6779 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6782 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6783 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6785 pub struct CResult_OutPointDecodeErrorZ {
6786 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6787 /// `err` or `result` depending on the state of `result_ok`.
6788 pub contents: CResult_OutPointDecodeErrorZPtr,
6789 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
6790 pub result_ok: bool,
6793 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
6794 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
6795 CResult_OutPointDecodeErrorZ {
6796 contents: CResult_OutPointDecodeErrorZPtr {
6797 result: Box::into_raw(Box::new(o)),
6803 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
6804 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
6805 CResult_OutPointDecodeErrorZ {
6806 contents: CResult_OutPointDecodeErrorZPtr {
6807 err: Box::into_raw(Box::new(e)),
6812 /// Checks if the given object is currently in the success state
6814 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
6818 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
6819 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
6820 impl Drop for CResult_OutPointDecodeErrorZ {
6821 fn drop(&mut self) {
6823 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6824 let _ = unsafe { Box::from_raw(self.contents.result) };
6827 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6828 let _ = unsafe { Box::from_raw(self.contents.err) };
6833 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
6834 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
6835 let contents = if o.result_ok {
6836 let result = unsafe { o.contents.result };
6837 unsafe { o.contents.result = std::ptr::null_mut() };
6838 CResult_OutPointDecodeErrorZPtr { result }
6840 let err = unsafe { o.contents.err };
6841 unsafe { o.contents.err = std::ptr::null_mut(); }
6842 CResult_OutPointDecodeErrorZPtr { err }
6846 result_ok: o.result_ok,
6850 impl Clone for CResult_OutPointDecodeErrorZ {
6851 fn clone(&self) -> Self {
6853 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
6854 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
6857 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
6858 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6864 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
6865 /// but with all dynamically-allocated buffers duplicated in new buffers.
6866 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
6868 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
6869 pub enum COption_TypeZ {
6870 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
6871 Some(crate::lightning::ln::wire::Type),
6872 /// When we're in this state, this COption_TypeZ contains nothing
6875 impl COption_TypeZ {
6876 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6877 if let Self::None = self { false } else { true }
6879 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6882 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
6883 if let Self::Some(v) = self { v } else { unreachable!() }
6887 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
6888 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
6889 COption_TypeZ::Some(o)
6892 /// Constructs a new COption_TypeZ containing nothing
6893 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
6897 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
6898 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
6900 /// The contents of CResult_COption_TypeZDecodeErrorZ
6901 pub union CResult_COption_TypeZDecodeErrorZPtr {
6902 /// A pointer to the contents in the success state.
6903 /// Reading from this pointer when `result_ok` is not set is undefined.
6904 pub result: *mut crate::c_types::derived::COption_TypeZ,
6905 /// A pointer to the contents in the error state.
6906 /// Reading from this pointer when `result_ok` is set is undefined.
6907 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6910 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6911 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6913 pub struct CResult_COption_TypeZDecodeErrorZ {
6914 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6915 /// `err` or `result` depending on the state of `result_ok`.
6916 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
6917 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6918 pub result_ok: bool,
6921 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
6922 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
6923 CResult_COption_TypeZDecodeErrorZ {
6924 contents: CResult_COption_TypeZDecodeErrorZPtr {
6925 result: Box::into_raw(Box::new(o)),
6931 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
6932 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
6933 CResult_COption_TypeZDecodeErrorZ {
6934 contents: CResult_COption_TypeZDecodeErrorZPtr {
6935 err: Box::into_raw(Box::new(e)),
6940 /// Checks if the given object is currently in the success state
6942 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
6946 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
6947 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
6948 impl Drop for CResult_COption_TypeZDecodeErrorZ {
6949 fn drop(&mut self) {
6951 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6952 let _ = unsafe { Box::from_raw(self.contents.result) };
6955 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6956 let _ = unsafe { Box::from_raw(self.contents.err) };
6961 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
6962 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6963 let contents = if o.result_ok {
6964 let result = unsafe { o.contents.result };
6965 unsafe { o.contents.result = std::ptr::null_mut() };
6966 CResult_COption_TypeZDecodeErrorZPtr { result }
6968 let err = unsafe { o.contents.err };
6969 unsafe { o.contents.err = std::ptr::null_mut(); }
6970 CResult_COption_TypeZDecodeErrorZPtr { err }
6974 result_ok: o.result_ok,
6979 /// The contents of CResult_PaymentIdPaymentErrorZ
6980 pub union CResult_PaymentIdPaymentErrorZPtr {
6981 /// A pointer to the contents in the success state.
6982 /// Reading from this pointer when `result_ok` is not set is undefined.
6983 pub result: *mut crate::c_types::ThirtyTwoBytes,
6984 /// A pointer to the contents in the error state.
6985 /// Reading from this pointer when `result_ok` is set is undefined.
6986 pub err: *mut crate::lightning_invoice::payment::PaymentError,
6989 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
6990 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
6991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6992 pub struct CResult_PaymentIdPaymentErrorZ {
6993 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
6994 /// `err` or `result` depending on the state of `result_ok`.
6995 pub contents: CResult_PaymentIdPaymentErrorZPtr,
6996 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
6997 pub result_ok: bool,
7000 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
7001 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
7002 CResult_PaymentIdPaymentErrorZ {
7003 contents: CResult_PaymentIdPaymentErrorZPtr {
7004 result: Box::into_raw(Box::new(o)),
7010 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
7011 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
7012 CResult_PaymentIdPaymentErrorZ {
7013 contents: CResult_PaymentIdPaymentErrorZPtr {
7014 err: Box::into_raw(Box::new(e)),
7019 /// Checks if the given object is currently in the success state
7021 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
7025 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
7026 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
7027 impl Drop for CResult_PaymentIdPaymentErrorZ {
7028 fn drop(&mut self) {
7030 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7031 let _ = unsafe { Box::from_raw(self.contents.result) };
7034 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7035 let _ = unsafe { Box::from_raw(self.contents.err) };
7040 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
7041 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
7042 let contents = if o.result_ok {
7043 let result = unsafe { o.contents.result };
7044 unsafe { o.contents.result = std::ptr::null_mut() };
7045 CResult_PaymentIdPaymentErrorZPtr { result }
7047 let err = unsafe { o.contents.err };
7048 unsafe { o.contents.err = std::ptr::null_mut(); }
7049 CResult_PaymentIdPaymentErrorZPtr { err }
7053 result_ok: o.result_ok,
7057 impl Clone for CResult_PaymentIdPaymentErrorZ {
7058 fn clone(&self) -> Self {
7060 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
7061 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7064 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
7065 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
7071 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
7072 /// but with all dynamically-allocated buffers duplicated in new buffers.
7073 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
7075 /// The contents of CResult_SiPrefixNoneZ
7076 pub union CResult_SiPrefixNoneZPtr {
7077 /// A pointer to the contents in the success state.
7078 /// Reading from this pointer when `result_ok` is not set is undefined.
7079 pub result: *mut crate::lightning_invoice::SiPrefix,
7080 /// Note that this value is always NULL, as there are no contents in the Err variant
7081 pub err: *mut std::ffi::c_void,
7084 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
7085 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
7086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7087 pub struct CResult_SiPrefixNoneZ {
7088 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
7089 /// `err` or `result` depending on the state of `result_ok`.
7090 pub contents: CResult_SiPrefixNoneZPtr,
7091 /// Whether this CResult_SiPrefixNoneZ represents a success state.
7092 pub result_ok: bool,
7095 /// Creates a new CResult_SiPrefixNoneZ in the success state.
7096 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
7097 CResult_SiPrefixNoneZ {
7098 contents: CResult_SiPrefixNoneZPtr {
7099 result: Box::into_raw(Box::new(o)),
7105 /// Creates a new CResult_SiPrefixNoneZ in the error state.
7106 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
7107 CResult_SiPrefixNoneZ {
7108 contents: CResult_SiPrefixNoneZPtr {
7109 err: std::ptr::null_mut(),
7114 /// Checks if the given object is currently in the success state
7116 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
7120 /// Frees any resources used by the CResult_SiPrefixNoneZ.
7121 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
7122 impl Drop for CResult_SiPrefixNoneZ {
7123 fn drop(&mut self) {
7125 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7126 let _ = unsafe { Box::from_raw(self.contents.result) };
7132 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
7133 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
7134 let contents = if o.result_ok {
7135 let result = unsafe { o.contents.result };
7136 unsafe { o.contents.result = std::ptr::null_mut() };
7137 CResult_SiPrefixNoneZPtr { result }
7139 let _ = unsafe { Box::from_raw(o.contents.err) };
7140 o.contents.err = std::ptr::null_mut();
7141 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
7145 result_ok: o.result_ok,
7149 impl Clone for CResult_SiPrefixNoneZ {
7150 fn clone(&self) -> Self {
7152 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
7153 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
7156 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
7157 err: std::ptr::null_mut()
7163 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
7164 /// but with all dynamically-allocated buffers duplicated in new buffers.
7165 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
7167 /// The contents of CResult_InvoiceNoneZ
7168 pub union CResult_InvoiceNoneZPtr {
7169 /// A pointer to the contents in the success state.
7170 /// Reading from this pointer when `result_ok` is not set is undefined.
7171 pub result: *mut crate::lightning_invoice::Invoice,
7172 /// Note that this value is always NULL, as there are no contents in the Err variant
7173 pub err: *mut std::ffi::c_void,
7176 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
7177 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
7178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7179 pub struct CResult_InvoiceNoneZ {
7180 /// The contents of this CResult_InvoiceNoneZ, accessible via either
7181 /// `err` or `result` depending on the state of `result_ok`.
7182 pub contents: CResult_InvoiceNoneZPtr,
7183 /// Whether this CResult_InvoiceNoneZ represents a success state.
7184 pub result_ok: bool,
7187 /// Creates a new CResult_InvoiceNoneZ in the success state.
7188 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
7189 CResult_InvoiceNoneZ {
7190 contents: CResult_InvoiceNoneZPtr {
7191 result: Box::into_raw(Box::new(o)),
7197 /// Creates a new CResult_InvoiceNoneZ in the error state.
7198 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
7199 CResult_InvoiceNoneZ {
7200 contents: CResult_InvoiceNoneZPtr {
7201 err: std::ptr::null_mut(),
7206 /// Checks if the given object is currently in the success state
7208 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
7212 /// Frees any resources used by the CResult_InvoiceNoneZ.
7213 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
7214 impl Drop for CResult_InvoiceNoneZ {
7215 fn drop(&mut self) {
7217 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7218 let _ = unsafe { Box::from_raw(self.contents.result) };
7224 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
7225 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
7226 let contents = if o.result_ok {
7227 let result = unsafe { o.contents.result };
7228 unsafe { o.contents.result = std::ptr::null_mut() };
7229 CResult_InvoiceNoneZPtr { result }
7231 let _ = unsafe { Box::from_raw(o.contents.err) };
7232 o.contents.err = std::ptr::null_mut();
7233 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
7237 result_ok: o.result_ok,
7241 impl Clone for CResult_InvoiceNoneZ {
7242 fn clone(&self) -> Self {
7244 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
7245 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7248 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
7249 err: std::ptr::null_mut()
7255 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
7256 /// but with all dynamically-allocated buffers duplicated in new buffers.
7257 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
7259 /// The contents of CResult_SignedRawInvoiceNoneZ
7260 pub union CResult_SignedRawInvoiceNoneZPtr {
7261 /// A pointer to the contents in the success state.
7262 /// Reading from this pointer when `result_ok` is not set is undefined.
7263 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
7264 /// Note that this value is always NULL, as there are no contents in the Err variant
7265 pub err: *mut std::ffi::c_void,
7268 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
7269 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
7270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7271 pub struct CResult_SignedRawInvoiceNoneZ {
7272 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
7273 /// `err` or `result` depending on the state of `result_ok`.
7274 pub contents: CResult_SignedRawInvoiceNoneZPtr,
7275 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
7276 pub result_ok: bool,
7279 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
7280 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
7281 CResult_SignedRawInvoiceNoneZ {
7282 contents: CResult_SignedRawInvoiceNoneZPtr {
7283 result: Box::into_raw(Box::new(o)),
7289 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
7290 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
7291 CResult_SignedRawInvoiceNoneZ {
7292 contents: CResult_SignedRawInvoiceNoneZPtr {
7293 err: std::ptr::null_mut(),
7298 /// Checks if the given object is currently in the success state
7300 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
7304 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
7305 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
7306 impl Drop for CResult_SignedRawInvoiceNoneZ {
7307 fn drop(&mut self) {
7309 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7310 let _ = unsafe { Box::from_raw(self.contents.result) };
7316 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
7317 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
7318 let contents = if o.result_ok {
7319 let result = unsafe { o.contents.result };
7320 unsafe { o.contents.result = std::ptr::null_mut() };
7321 CResult_SignedRawInvoiceNoneZPtr { result }
7323 let _ = unsafe { Box::from_raw(o.contents.err) };
7324 o.contents.err = std::ptr::null_mut();
7325 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
7329 result_ok: o.result_ok,
7333 impl Clone for CResult_SignedRawInvoiceNoneZ {
7334 fn clone(&self) -> Self {
7336 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
7337 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
7340 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
7341 err: std::ptr::null_mut()
7347 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
7348 /// but with all dynamically-allocated buffers duplicated in new buffers.
7349 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
7351 /// A tuple of 3 elements. See the individual fields for the types contained.
7352 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7353 /// The element at position 0
7354 pub a: crate::lightning_invoice::RawInvoice,
7355 /// The element at position 1
7356 pub b: crate::c_types::ThirtyTwoBytes,
7357 /// The element at position 2
7358 pub c: crate::lightning_invoice::InvoiceSignature,
7360 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7361 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
7369 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7370 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
7371 (self.a, self.b, self.c)
7374 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7375 fn clone(&self) -> Self {
7377 a: Clone::clone(&self.a),
7378 b: Clone::clone(&self.b),
7379 c: Clone::clone(&self.c),
7384 /// Creates a new tuple which has the same data as `orig`
7385 /// but with all dynamically-allocated buffers duplicated in new buffers.
7386 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
7387 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
7389 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 {
7390 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
7394 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
7395 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
7397 /// The contents of CResult_PayeePubKeyErrorZ
7398 pub union CResult_PayeePubKeyErrorZPtr {
7399 /// A pointer to the contents in the success state.
7400 /// Reading from this pointer when `result_ok` is not set is undefined.
7401 pub result: *mut crate::lightning_invoice::PayeePubKey,
7402 /// A pointer to the contents in the error state.
7403 /// Reading from this pointer when `result_ok` is set is undefined.
7404 pub err: *mut crate::c_types::Secp256k1Error,
7407 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
7408 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
7409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7410 pub struct CResult_PayeePubKeyErrorZ {
7411 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
7412 /// `err` or `result` depending on the state of `result_ok`.
7413 pub contents: CResult_PayeePubKeyErrorZPtr,
7414 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
7415 pub result_ok: bool,
7418 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
7419 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
7420 CResult_PayeePubKeyErrorZ {
7421 contents: CResult_PayeePubKeyErrorZPtr {
7422 result: Box::into_raw(Box::new(o)),
7428 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
7429 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
7430 CResult_PayeePubKeyErrorZ {
7431 contents: CResult_PayeePubKeyErrorZPtr {
7432 err: Box::into_raw(Box::new(e)),
7437 /// Checks if the given object is currently in the success state
7439 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
7443 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
7444 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
7445 impl Drop for CResult_PayeePubKeyErrorZ {
7446 fn drop(&mut self) {
7448 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7449 let _ = unsafe { Box::from_raw(self.contents.result) };
7452 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7453 let _ = unsafe { Box::from_raw(self.contents.err) };
7458 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
7459 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
7460 let contents = if o.result_ok {
7461 let result = unsafe { o.contents.result };
7462 unsafe { o.contents.result = std::ptr::null_mut() };
7463 CResult_PayeePubKeyErrorZPtr { result }
7465 let err = unsafe { o.contents.err };
7466 unsafe { o.contents.err = std::ptr::null_mut(); }
7467 CResult_PayeePubKeyErrorZPtr { err }
7471 result_ok: o.result_ok,
7475 impl Clone for CResult_PayeePubKeyErrorZ {
7476 fn clone(&self) -> Self {
7478 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
7479 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
7482 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
7483 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
7489 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
7490 /// but with all dynamically-allocated buffers duplicated in new buffers.
7491 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
7493 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
7494 /// This corresponds to std::vector in C++
7495 pub struct CVec_PrivateRouteZ {
7496 /// The elements in the array.
7497 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7498 pub data: *mut crate::lightning_invoice::PrivateRoute,
7499 /// The number of elements pointed to by `data`.
7502 impl CVec_PrivateRouteZ {
7503 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
7504 if self.datalen == 0 { return Vec::new(); }
7505 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7506 self.data = std::ptr::null_mut();
7510 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
7511 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7514 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
7515 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
7516 let datalen = v.len();
7517 let data = Box::into_raw(v.into_boxed_slice());
7518 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7522 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7523 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
7524 impl Drop for CVec_PrivateRouteZ {
7525 fn drop(&mut self) {
7526 if self.datalen == 0 { return; }
7527 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7530 impl Clone for CVec_PrivateRouteZ {
7531 fn clone(&self) -> Self {
7532 let mut res = Vec::new();
7533 if self.datalen == 0 { return Self::from(res); }
7534 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7539 /// The contents of CResult_PositiveTimestampCreationErrorZ
7540 pub union CResult_PositiveTimestampCreationErrorZPtr {
7541 /// A pointer to the contents in the success state.
7542 /// Reading from this pointer when `result_ok` is not set is undefined.
7543 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
7544 /// A pointer to the contents in the error state.
7545 /// Reading from this pointer when `result_ok` is set is undefined.
7546 pub err: *mut crate::lightning_invoice::CreationError,
7549 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7550 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7552 pub struct CResult_PositiveTimestampCreationErrorZ {
7553 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7554 /// `err` or `result` depending on the state of `result_ok`.
7555 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
7556 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7557 pub result_ok: bool,
7560 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
7561 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
7562 CResult_PositiveTimestampCreationErrorZ {
7563 contents: CResult_PositiveTimestampCreationErrorZPtr {
7564 result: Box::into_raw(Box::new(o)),
7570 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
7571 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
7572 CResult_PositiveTimestampCreationErrorZ {
7573 contents: CResult_PositiveTimestampCreationErrorZPtr {
7574 err: Box::into_raw(Box::new(e)),
7579 /// Checks if the given object is currently in the success state
7581 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
7585 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
7586 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
7587 impl Drop for CResult_PositiveTimestampCreationErrorZ {
7588 fn drop(&mut self) {
7590 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7591 let _ = unsafe { Box::from_raw(self.contents.result) };
7594 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7595 let _ = unsafe { Box::from_raw(self.contents.err) };
7600 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
7601 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
7602 let contents = if o.result_ok {
7603 let result = unsafe { o.contents.result };
7604 unsafe { o.contents.result = std::ptr::null_mut() };
7605 CResult_PositiveTimestampCreationErrorZPtr { result }
7607 let err = unsafe { o.contents.err };
7608 unsafe { o.contents.err = std::ptr::null_mut(); }
7609 CResult_PositiveTimestampCreationErrorZPtr { err }
7613 result_ok: o.result_ok,
7617 impl Clone for CResult_PositiveTimestampCreationErrorZ {
7618 fn clone(&self) -> Self {
7620 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
7621 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
7624 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
7625 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7631 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
7632 /// but with all dynamically-allocated buffers duplicated in new buffers.
7633 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
7635 /// The contents of CResult_NoneSemanticErrorZ
7636 pub union CResult_NoneSemanticErrorZPtr {
7637 /// Note that this value is always NULL, as there are no contents in the OK variant
7638 pub result: *mut std::ffi::c_void,
7639 /// A pointer to the contents in the error state.
7640 /// Reading from this pointer when `result_ok` is set is undefined.
7641 pub err: *mut crate::lightning_invoice::SemanticError,
7644 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7645 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7647 pub struct CResult_NoneSemanticErrorZ {
7648 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
7649 /// `err` or `result` depending on the state of `result_ok`.
7650 pub contents: CResult_NoneSemanticErrorZPtr,
7651 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
7652 pub result_ok: bool,
7655 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
7656 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
7657 CResult_NoneSemanticErrorZ {
7658 contents: CResult_NoneSemanticErrorZPtr {
7659 result: std::ptr::null_mut(),
7665 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
7666 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
7667 CResult_NoneSemanticErrorZ {
7668 contents: CResult_NoneSemanticErrorZPtr {
7669 err: Box::into_raw(Box::new(e)),
7674 /// Checks if the given object is currently in the success state
7676 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
7680 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
7681 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
7682 impl Drop for CResult_NoneSemanticErrorZ {
7683 fn drop(&mut self) {
7686 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7687 let _ = unsafe { Box::from_raw(self.contents.err) };
7692 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
7693 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
7694 let contents = if o.result_ok {
7695 let _ = unsafe { Box::from_raw(o.contents.result) };
7696 o.contents.result = std::ptr::null_mut();
7697 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
7699 let err = unsafe { o.contents.err };
7700 unsafe { o.contents.err = std::ptr::null_mut(); }
7701 CResult_NoneSemanticErrorZPtr { err }
7705 result_ok: o.result_ok,
7709 impl Clone for CResult_NoneSemanticErrorZ {
7710 fn clone(&self) -> Self {
7712 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
7713 result: std::ptr::null_mut()
7716 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
7717 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7723 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
7724 /// but with all dynamically-allocated buffers duplicated in new buffers.
7725 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
7727 /// The contents of CResult_InvoiceSemanticErrorZ
7728 pub union CResult_InvoiceSemanticErrorZPtr {
7729 /// A pointer to the contents in the success state.
7730 /// Reading from this pointer when `result_ok` is not set is undefined.
7731 pub result: *mut crate::lightning_invoice::Invoice,
7732 /// A pointer to the contents in the error state.
7733 /// Reading from this pointer when `result_ok` is set is undefined.
7734 pub err: *mut crate::lightning_invoice::SemanticError,
7737 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7738 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7739 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7740 pub struct CResult_InvoiceSemanticErrorZ {
7741 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7742 /// `err` or `result` depending on the state of `result_ok`.
7743 pub contents: CResult_InvoiceSemanticErrorZPtr,
7744 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7745 pub result_ok: bool,
7748 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
7749 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
7750 CResult_InvoiceSemanticErrorZ {
7751 contents: CResult_InvoiceSemanticErrorZPtr {
7752 result: Box::into_raw(Box::new(o)),
7758 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
7759 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
7760 CResult_InvoiceSemanticErrorZ {
7761 contents: CResult_InvoiceSemanticErrorZPtr {
7762 err: Box::into_raw(Box::new(e)),
7767 /// Checks if the given object is currently in the success state
7769 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
7773 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
7774 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
7775 impl Drop for CResult_InvoiceSemanticErrorZ {
7776 fn drop(&mut self) {
7778 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7779 let _ = unsafe { Box::from_raw(self.contents.result) };
7782 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7783 let _ = unsafe { Box::from_raw(self.contents.err) };
7788 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
7789 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
7790 let contents = if o.result_ok {
7791 let result = unsafe { o.contents.result };
7792 unsafe { o.contents.result = std::ptr::null_mut() };
7793 CResult_InvoiceSemanticErrorZPtr { result }
7795 let err = unsafe { o.contents.err };
7796 unsafe { o.contents.err = std::ptr::null_mut(); }
7797 CResult_InvoiceSemanticErrorZPtr { err }
7801 result_ok: o.result_ok,
7805 impl Clone for CResult_InvoiceSemanticErrorZ {
7806 fn clone(&self) -> Self {
7808 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
7809 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7812 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
7813 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7819 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
7820 /// but with all dynamically-allocated buffers duplicated in new buffers.
7821 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
7823 /// The contents of CResult_DescriptionCreationErrorZ
7824 pub union CResult_DescriptionCreationErrorZPtr {
7825 /// A pointer to the contents in the success state.
7826 /// Reading from this pointer when `result_ok` is not set is undefined.
7827 pub result: *mut crate::lightning_invoice::Description,
7828 /// A pointer to the contents in the error state.
7829 /// Reading from this pointer when `result_ok` is set is undefined.
7830 pub err: *mut crate::lightning_invoice::CreationError,
7833 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7834 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7835 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7836 pub struct CResult_DescriptionCreationErrorZ {
7837 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7838 /// `err` or `result` depending on the state of `result_ok`.
7839 pub contents: CResult_DescriptionCreationErrorZPtr,
7840 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
7841 pub result_ok: bool,
7844 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
7845 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
7846 CResult_DescriptionCreationErrorZ {
7847 contents: CResult_DescriptionCreationErrorZPtr {
7848 result: Box::into_raw(Box::new(o)),
7854 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
7855 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
7856 CResult_DescriptionCreationErrorZ {
7857 contents: CResult_DescriptionCreationErrorZPtr {
7858 err: Box::into_raw(Box::new(e)),
7863 /// Checks if the given object is currently in the success state
7865 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
7869 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
7870 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
7871 impl Drop for CResult_DescriptionCreationErrorZ {
7872 fn drop(&mut self) {
7874 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7875 let _ = unsafe { Box::from_raw(self.contents.result) };
7878 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7879 let _ = unsafe { Box::from_raw(self.contents.err) };
7884 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
7885 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
7886 let contents = if o.result_ok {
7887 let result = unsafe { o.contents.result };
7888 unsafe { o.contents.result = std::ptr::null_mut() };
7889 CResult_DescriptionCreationErrorZPtr { result }
7891 let err = unsafe { o.contents.err };
7892 unsafe { o.contents.err = std::ptr::null_mut(); }
7893 CResult_DescriptionCreationErrorZPtr { err }
7897 result_ok: o.result_ok,
7901 impl Clone for CResult_DescriptionCreationErrorZ {
7902 fn clone(&self) -> Self {
7904 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
7905 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
7908 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
7909 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7915 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
7916 /// but with all dynamically-allocated buffers duplicated in new buffers.
7917 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
7919 /// The contents of CResult_ExpiryTimeCreationErrorZ
7920 pub union CResult_ExpiryTimeCreationErrorZPtr {
7921 /// A pointer to the contents in the success state.
7922 /// Reading from this pointer when `result_ok` is not set is undefined.
7923 pub result: *mut crate::lightning_invoice::ExpiryTime,
7924 /// A pointer to the contents in the error state.
7925 /// Reading from this pointer when `result_ok` is set is undefined.
7926 pub err: *mut crate::lightning_invoice::CreationError,
7929 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
7930 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
7931 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7932 pub struct CResult_ExpiryTimeCreationErrorZ {
7933 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
7934 /// `err` or `result` depending on the state of `result_ok`.
7935 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
7936 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
7937 pub result_ok: bool,
7940 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
7941 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
7942 CResult_ExpiryTimeCreationErrorZ {
7943 contents: CResult_ExpiryTimeCreationErrorZPtr {
7944 result: Box::into_raw(Box::new(o)),
7950 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
7951 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
7952 CResult_ExpiryTimeCreationErrorZ {
7953 contents: CResult_ExpiryTimeCreationErrorZPtr {
7954 err: Box::into_raw(Box::new(e)),
7959 /// Checks if the given object is currently in the success state
7961 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_is_ok(o: &CResult_ExpiryTimeCreationErrorZ) -> bool {
7965 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
7966 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
7967 impl Drop for CResult_ExpiryTimeCreationErrorZ {
7968 fn drop(&mut self) {
7970 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7971 let _ = unsafe { Box::from_raw(self.contents.result) };
7974 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7975 let _ = unsafe { Box::from_raw(self.contents.err) };
7980 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
7981 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
7982 let contents = if o.result_ok {
7983 let result = unsafe { o.contents.result };
7984 unsafe { o.contents.result = std::ptr::null_mut() };
7985 CResult_ExpiryTimeCreationErrorZPtr { result }
7987 let err = unsafe { o.contents.err };
7988 unsafe { o.contents.err = std::ptr::null_mut(); }
7989 CResult_ExpiryTimeCreationErrorZPtr { err }
7993 result_ok: o.result_ok,
7997 impl Clone for CResult_ExpiryTimeCreationErrorZ {
7998 fn clone(&self) -> Self {
8000 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
8001 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
8004 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
8005 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8011 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
8012 /// but with all dynamically-allocated buffers duplicated in new buffers.
8013 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
8015 /// The contents of CResult_PrivateRouteCreationErrorZ
8016 pub union CResult_PrivateRouteCreationErrorZPtr {
8017 /// A pointer to the contents in the success state.
8018 /// Reading from this pointer when `result_ok` is not set is undefined.
8019 pub result: *mut crate::lightning_invoice::PrivateRoute,
8020 /// A pointer to the contents in the error state.
8021 /// Reading from this pointer when `result_ok` is set is undefined.
8022 pub err: *mut crate::lightning_invoice::CreationError,
8025 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8026 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8027 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8028 pub struct CResult_PrivateRouteCreationErrorZ {
8029 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8030 /// `err` or `result` depending on the state of `result_ok`.
8031 pub contents: CResult_PrivateRouteCreationErrorZPtr,
8032 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8033 pub result_ok: bool,
8036 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8037 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8038 CResult_PrivateRouteCreationErrorZ {
8039 contents: CResult_PrivateRouteCreationErrorZPtr {
8040 result: Box::into_raw(Box::new(o)),
8046 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8047 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8048 CResult_PrivateRouteCreationErrorZ {
8049 contents: CResult_PrivateRouteCreationErrorZPtr {
8050 err: Box::into_raw(Box::new(e)),
8055 /// Checks if the given object is currently in the success state
8057 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8061 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8062 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8063 impl Drop for CResult_PrivateRouteCreationErrorZ {
8064 fn drop(&mut self) {
8066 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8067 let _ = unsafe { Box::from_raw(self.contents.result) };
8070 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8071 let _ = unsafe { Box::from_raw(self.contents.err) };
8076 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
8077 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
8078 let contents = if o.result_ok {
8079 let result = unsafe { o.contents.result };
8080 unsafe { o.contents.result = std::ptr::null_mut() };
8081 CResult_PrivateRouteCreationErrorZPtr { result }
8083 let err = unsafe { o.contents.err };
8084 unsafe { o.contents.err = std::ptr::null_mut(); }
8085 CResult_PrivateRouteCreationErrorZPtr { err }
8089 result_ok: o.result_ok,
8093 impl Clone for CResult_PrivateRouteCreationErrorZ {
8094 fn clone(&self) -> Self {
8096 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
8097 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
8100 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
8101 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8107 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
8108 /// but with all dynamically-allocated buffers duplicated in new buffers.
8109 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
8111 /// The contents of CResult_StringErrorZ
8112 pub union CResult_StringErrorZPtr {
8113 /// A pointer to the contents in the success state.
8114 /// Reading from this pointer when `result_ok` is not set is undefined.
8115 pub result: *mut crate::c_types::Str,
8116 /// A pointer to the contents in the error state.
8117 /// Reading from this pointer when `result_ok` is set is undefined.
8118 pub err: *mut crate::c_types::Secp256k1Error,
8121 /// A CResult_StringErrorZ represents the result of a fallible operation,
8122 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8123 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8124 pub struct CResult_StringErrorZ {
8125 /// The contents of this CResult_StringErrorZ, accessible via either
8126 /// `err` or `result` depending on the state of `result_ok`.
8127 pub contents: CResult_StringErrorZPtr,
8128 /// Whether this CResult_StringErrorZ represents a success state.
8129 pub result_ok: bool,
8132 /// Creates a new CResult_StringErrorZ in the success state.
8133 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
8134 CResult_StringErrorZ {
8135 contents: CResult_StringErrorZPtr {
8136 result: Box::into_raw(Box::new(o)),
8142 /// Creates a new CResult_StringErrorZ in the error state.
8143 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
8144 CResult_StringErrorZ {
8145 contents: CResult_StringErrorZPtr {
8146 err: Box::into_raw(Box::new(e)),
8151 /// Checks if the given object is currently in the success state
8153 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
8157 /// Frees any resources used by the CResult_StringErrorZ.
8158 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
8159 impl Drop for CResult_StringErrorZ {
8160 fn drop(&mut self) {
8162 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8163 let _ = unsafe { Box::from_raw(self.contents.result) };
8166 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8167 let _ = unsafe { Box::from_raw(self.contents.err) };
8172 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
8173 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
8174 let contents = if o.result_ok {
8175 let result = unsafe { o.contents.result };
8176 unsafe { o.contents.result = std::ptr::null_mut() };
8177 CResult_StringErrorZPtr { result }
8179 let err = unsafe { o.contents.err };
8180 unsafe { o.contents.err = std::ptr::null_mut(); }
8181 CResult_StringErrorZPtr { err }
8185 result_ok: o.result_ok,
8190 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
8191 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8192 /// A pointer to the contents in the success state.
8193 /// Reading from this pointer when `result_ok` is not set is undefined.
8194 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
8195 /// A pointer to the contents in the error state.
8196 /// Reading from this pointer when `result_ok` is set is undefined.
8197 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8200 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
8201 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8203 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
8204 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
8205 /// `err` or `result` depending on the state of `result_ok`.
8206 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
8207 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
8208 pub result_ok: bool,
8211 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
8212 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
8213 CResult_ChannelMonitorUpdateDecodeErrorZ {
8214 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8215 result: Box::into_raw(Box::new(o)),
8221 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
8222 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
8223 CResult_ChannelMonitorUpdateDecodeErrorZ {
8224 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8225 err: Box::into_raw(Box::new(e)),
8230 /// Checks if the given object is currently in the success state
8232 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
8236 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
8237 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
8238 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
8239 fn drop(&mut self) {
8241 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8242 let _ = unsafe { Box::from_raw(self.contents.result) };
8245 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8246 let _ = unsafe { Box::from_raw(self.contents.err) };
8251 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
8252 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8253 let contents = if o.result_ok {
8254 let result = unsafe { o.contents.result };
8255 unsafe { o.contents.result = std::ptr::null_mut() };
8256 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
8258 let err = unsafe { o.contents.err };
8259 unsafe { o.contents.err = std::ptr::null_mut(); }
8260 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
8264 result_ok: o.result_ok,
8268 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
8269 fn clone(&self) -> Self {
8271 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8272 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
8275 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8276 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8282 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
8283 /// but with all dynamically-allocated buffers duplicated in new buffers.
8284 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
8287 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
8288 pub enum COption_MonitorEventZ {
8289 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
8290 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
8291 /// When we're in this state, this COption_MonitorEventZ contains nothing
8294 impl COption_MonitorEventZ {
8295 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8296 if let Self::None = self { false } else { true }
8298 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8301 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
8302 if let Self::Some(v) = self { v } else { unreachable!() }
8306 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
8307 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
8308 COption_MonitorEventZ::Some(o)
8311 /// Constructs a new COption_MonitorEventZ containing nothing
8312 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
8313 COption_MonitorEventZ::None
8316 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
8317 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
8319 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
8320 /// but with all dynamically-allocated buffers duplicated in new buffers.
8321 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
8323 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
8324 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
8325 /// A pointer to the contents in the success state.
8326 /// Reading from this pointer when `result_ok` is not set is undefined.
8327 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
8328 /// A pointer to the contents in the error state.
8329 /// Reading from this pointer when `result_ok` is set is undefined.
8330 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8333 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
8334 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8336 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
8337 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
8338 /// `err` or `result` depending on the state of `result_ok`.
8339 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
8340 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
8341 pub result_ok: bool,
8344 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
8345 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
8346 CResult_COption_MonitorEventZDecodeErrorZ {
8347 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8348 result: Box::into_raw(Box::new(o)),
8354 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
8355 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
8356 CResult_COption_MonitorEventZDecodeErrorZ {
8357 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8358 err: Box::into_raw(Box::new(e)),
8363 /// Checks if the given object is currently in the success state
8365 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
8369 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
8370 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
8371 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
8372 fn drop(&mut self) {
8374 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8375 let _ = unsafe { Box::from_raw(self.contents.result) };
8378 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8379 let _ = unsafe { Box::from_raw(self.contents.err) };
8384 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
8385 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8386 let contents = if o.result_ok {
8387 let result = unsafe { o.contents.result };
8388 unsafe { o.contents.result = std::ptr::null_mut() };
8389 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
8391 let err = unsafe { o.contents.err };
8392 unsafe { o.contents.err = std::ptr::null_mut(); }
8393 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
8397 result_ok: o.result_ok,
8401 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
8402 fn clone(&self) -> Self {
8404 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8405 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
8408 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8409 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8415 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
8416 /// but with all dynamically-allocated buffers duplicated in new buffers.
8417 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
8419 /// The contents of CResult_HTLCUpdateDecodeErrorZ
8420 pub union CResult_HTLCUpdateDecodeErrorZPtr {
8421 /// A pointer to the contents in the success state.
8422 /// Reading from this pointer when `result_ok` is not set is undefined.
8423 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
8424 /// A pointer to the contents in the error state.
8425 /// Reading from this pointer when `result_ok` is set is undefined.
8426 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8429 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
8430 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8432 pub struct CResult_HTLCUpdateDecodeErrorZ {
8433 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
8434 /// `err` or `result` depending on the state of `result_ok`.
8435 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
8436 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
8437 pub result_ok: bool,
8440 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
8441 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
8442 CResult_HTLCUpdateDecodeErrorZ {
8443 contents: CResult_HTLCUpdateDecodeErrorZPtr {
8444 result: Box::into_raw(Box::new(o)),
8450 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
8451 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
8452 CResult_HTLCUpdateDecodeErrorZ {
8453 contents: CResult_HTLCUpdateDecodeErrorZPtr {
8454 err: Box::into_raw(Box::new(e)),
8459 /// Checks if the given object is currently in the success state
8461 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
8465 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
8466 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
8467 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
8468 fn drop(&mut self) {
8470 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8471 let _ = unsafe { Box::from_raw(self.contents.result) };
8474 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8475 let _ = unsafe { Box::from_raw(self.contents.err) };
8480 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
8481 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8482 let contents = if o.result_ok {
8483 let result = unsafe { o.contents.result };
8484 unsafe { o.contents.result = std::ptr::null_mut() };
8485 CResult_HTLCUpdateDecodeErrorZPtr { result }
8487 let err = unsafe { o.contents.err };
8488 unsafe { o.contents.err = std::ptr::null_mut(); }
8489 CResult_HTLCUpdateDecodeErrorZPtr { err }
8493 result_ok: o.result_ok,
8497 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
8498 fn clone(&self) -> Self {
8500 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8501 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
8504 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8505 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8511 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8512 /// but with all dynamically-allocated buffers duplicated in new buffers.
8513 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
8515 /// A tuple of 2 elements. See the individual fields for the types contained.
8516 pub struct C2Tuple_OutPointScriptZ {
8517 /// The element at position 0
8518 pub a: crate::lightning::chain::transaction::OutPoint,
8519 /// The element at position 1
8520 pub b: crate::c_types::derived::CVec_u8Z,
8522 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
8523 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
8530 impl C2Tuple_OutPointScriptZ {
8531 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
8535 impl Clone for C2Tuple_OutPointScriptZ {
8536 fn clone(&self) -> Self {
8538 a: Clone::clone(&self.a),
8539 b: Clone::clone(&self.b),
8544 /// Creates a new tuple which has the same data as `orig`
8545 /// but with all dynamically-allocated buffers duplicated in new buffers.
8546 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
8547 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8549 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
8550 C2Tuple_OutPointScriptZ { a, b, }
8554 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
8555 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
8557 /// A tuple of 2 elements. See the individual fields for the types contained.
8558 pub struct C2Tuple_u32ScriptZ {
8559 /// The element at position 0
8561 /// The element at position 1
8562 pub b: crate::c_types::derived::CVec_u8Z,
8564 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
8565 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
8572 impl C2Tuple_u32ScriptZ {
8573 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
8577 impl Clone for C2Tuple_u32ScriptZ {
8578 fn clone(&self) -> Self {
8580 a: Clone::clone(&self.a),
8581 b: Clone::clone(&self.b),
8586 /// Creates a new tuple which has the same data as `orig`
8587 /// but with all dynamically-allocated buffers duplicated in new buffers.
8588 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
8589 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
8591 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
8592 C2Tuple_u32ScriptZ { a, b, }
8596 /// Frees any resources used by the C2Tuple_u32ScriptZ.
8597 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
8599 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8600 /// This corresponds to std::vector in C++
8601 pub struct CVec_C2Tuple_u32ScriptZZ {
8602 /// The elements in the array.
8603 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8604 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
8605 /// The number of elements pointed to by `data`.
8608 impl CVec_C2Tuple_u32ScriptZZ {
8609 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
8610 if self.datalen == 0 { return Vec::new(); }
8611 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8612 self.data = std::ptr::null_mut();
8616 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
8617 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8620 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
8621 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
8622 let datalen = v.len();
8623 let data = Box::into_raw(v.into_boxed_slice());
8624 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8628 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8629 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
8630 impl Drop for CVec_C2Tuple_u32ScriptZZ {
8631 fn drop(&mut self) {
8632 if self.datalen == 0 { return; }
8633 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8636 impl Clone for CVec_C2Tuple_u32ScriptZZ {
8637 fn clone(&self) -> Self {
8638 let mut res = Vec::new();
8639 if self.datalen == 0 { return Self::from(res); }
8640 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8645 /// A tuple of 2 elements. See the individual fields for the types contained.
8646 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8647 /// The element at position 0
8648 pub a: crate::c_types::ThirtyTwoBytes,
8649 /// The element at position 1
8650 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
8652 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8653 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
8660 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8661 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
8665 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8666 fn clone(&self) -> Self {
8668 a: Clone::clone(&self.a),
8669 b: Clone::clone(&self.b),
8674 /// Creates a new tuple which has the same data as `orig`
8675 /// but with all dynamically-allocated buffers duplicated in new buffers.
8676 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
8677 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8679 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 {
8680 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
8684 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8685 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
8687 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8688 /// This corresponds to std::vector in C++
8689 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8690 /// The elements in the array.
8691 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8692 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
8693 /// The number of elements pointed to by `data`.
8696 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8697 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
8698 if self.datalen == 0 { return Vec::new(); }
8699 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8700 self.data = std::ptr::null_mut();
8704 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
8705 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8708 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8709 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
8710 let datalen = v.len();
8711 let data = Box::into_raw(v.into_boxed_slice());
8712 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8716 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8717 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
8718 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8719 fn drop(&mut self) {
8720 if self.datalen == 0 { return; }
8721 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8724 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8725 fn clone(&self) -> Self {
8726 let mut res = Vec::new();
8727 if self.datalen == 0 { return Self::from(res); }
8728 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8733 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8734 /// This corresponds to std::vector in C++
8735 pub struct CVec_EventZ {
8736 /// The elements in the array.
8737 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8738 pub data: *mut crate::lightning::util::events::Event,
8739 /// The number of elements pointed to by `data`.
8743 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
8744 if self.datalen == 0 { return Vec::new(); }
8745 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8746 self.data = std::ptr::null_mut();
8750 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
8751 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8754 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
8755 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
8756 let datalen = v.len();
8757 let data = Box::into_raw(v.into_boxed_slice());
8758 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8762 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8763 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
8764 impl Drop for CVec_EventZ {
8765 fn drop(&mut self) {
8766 if self.datalen == 0 { return; }
8767 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8770 impl Clone for CVec_EventZ {
8771 fn clone(&self) -> Self {
8772 let mut res = Vec::new();
8773 if self.datalen == 0 { return Self::from(res); }
8774 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8779 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8780 /// This corresponds to std::vector in C++
8781 pub struct CVec_TransactionZ {
8782 /// The elements in the array.
8783 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8784 pub data: *mut crate::c_types::Transaction,
8785 /// The number of elements pointed to by `data`.
8788 impl CVec_TransactionZ {
8789 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
8790 if self.datalen == 0 { return Vec::new(); }
8791 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8792 self.data = std::ptr::null_mut();
8796 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
8797 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8800 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
8801 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
8802 let datalen = v.len();
8803 let data = Box::into_raw(v.into_boxed_slice());
8804 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8808 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8809 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
8810 impl Drop for CVec_TransactionZ {
8811 fn drop(&mut self) {
8812 if self.datalen == 0 { return; }
8813 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8816 impl Clone for CVec_TransactionZ {
8817 fn clone(&self) -> Self {
8818 let mut res = Vec::new();
8819 if self.datalen == 0 { return Self::from(res); }
8820 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8825 /// A tuple of 2 elements. See the individual fields for the types contained.
8826 pub struct C2Tuple_u32TxOutZ {
8827 /// The element at position 0
8829 /// The element at position 1
8830 pub b: crate::c_types::TxOut,
8832 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
8833 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
8840 impl C2Tuple_u32TxOutZ {
8841 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
8845 impl Clone for C2Tuple_u32TxOutZ {
8846 fn clone(&self) -> Self {
8848 a: Clone::clone(&self.a),
8849 b: Clone::clone(&self.b),
8854 /// Creates a new tuple which has the same data as `orig`
8855 /// but with all dynamically-allocated buffers duplicated in new buffers.
8856 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
8857 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
8859 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
8860 C2Tuple_u32TxOutZ { a, b, }
8864 /// Frees any resources used by the C2Tuple_u32TxOutZ.
8865 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
8867 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8868 /// This corresponds to std::vector in C++
8869 pub struct CVec_C2Tuple_u32TxOutZZ {
8870 /// The elements in the array.
8871 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8872 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
8873 /// The number of elements pointed to by `data`.
8876 impl CVec_C2Tuple_u32TxOutZZ {
8877 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
8878 if self.datalen == 0 { return Vec::new(); }
8879 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8880 self.data = std::ptr::null_mut();
8884 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
8885 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8888 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
8889 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
8890 let datalen = v.len();
8891 let data = Box::into_raw(v.into_boxed_slice());
8892 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8896 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8897 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
8898 impl Drop for CVec_C2Tuple_u32TxOutZZ {
8899 fn drop(&mut self) {
8900 if self.datalen == 0 { return; }
8901 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8904 impl Clone for CVec_C2Tuple_u32TxOutZZ {
8905 fn clone(&self) -> Self {
8906 let mut res = Vec::new();
8907 if self.datalen == 0 { return Self::from(res); }
8908 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8913 /// A tuple of 2 elements. See the individual fields for the types contained.
8914 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8915 /// The element at position 0
8916 pub a: crate::c_types::ThirtyTwoBytes,
8917 /// The element at position 1
8918 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
8920 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8921 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
8928 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8929 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
8933 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8934 fn clone(&self) -> Self {
8936 a: Clone::clone(&self.a),
8937 b: Clone::clone(&self.b),
8942 /// Creates a new tuple which has the same data as `orig`
8943 /// but with all dynamically-allocated buffers duplicated in new buffers.
8944 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
8945 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8947 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 {
8948 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
8952 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8953 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
8955 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8956 /// This corresponds to std::vector in C++
8957 pub struct CVec_TransactionOutputsZ {
8958 /// The elements in the array.
8959 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8960 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
8961 /// The number of elements pointed to by `data`.
8964 impl CVec_TransactionOutputsZ {
8965 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
8966 if self.datalen == 0 { return Vec::new(); }
8967 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8968 self.data = std::ptr::null_mut();
8972 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
8973 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8976 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
8977 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
8978 let datalen = v.len();
8979 let data = Box::into_raw(v.into_boxed_slice());
8980 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8984 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8985 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
8986 impl Drop for CVec_TransactionOutputsZ {
8987 fn drop(&mut self) {
8988 if self.datalen == 0 { return; }
8989 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8992 impl Clone for CVec_TransactionOutputsZ {
8993 fn clone(&self) -> Self {
8994 let mut res = Vec::new();
8995 if self.datalen == 0 { return Self::from(res); }
8996 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9001 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9002 /// This corresponds to std::vector in C++
9003 pub struct CVec_BalanceZ {
9004 /// The elements in the array.
9005 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9006 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9007 /// The number of elements pointed to by `data`.
9010 impl CVec_BalanceZ {
9011 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9012 if self.datalen == 0 { return Vec::new(); }
9013 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9014 self.data = std::ptr::null_mut();
9018 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9019 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9022 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9023 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9024 let datalen = v.len();
9025 let data = Box::into_raw(v.into_boxed_slice());
9026 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9030 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9031 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9032 impl Drop for CVec_BalanceZ {
9033 fn drop(&mut self) {
9034 if self.datalen == 0 { return; }
9035 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9038 impl Clone for CVec_BalanceZ {
9039 fn clone(&self) -> Self {
9040 let mut res = Vec::new();
9041 if self.datalen == 0 { return Self::from(res); }
9042 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9047 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9048 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9049 /// A pointer to the contents in the success state.
9050 /// Reading from this pointer when `result_ok` is not set is undefined.
9051 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9052 /// A pointer to the contents in the error state.
9053 /// Reading from this pointer when `result_ok` is set is undefined.
9054 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9057 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9058 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9059 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9060 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9061 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9062 /// `err` or `result` depending on the state of `result_ok`.
9063 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9064 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9065 pub result_ok: bool,
9068 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9069 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9070 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9071 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9072 result: Box::into_raw(Box::new(o)),
9078 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9079 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9080 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9081 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9082 err: Box::into_raw(Box::new(e)),
9087 /// Checks if the given object is currently in the success state
9089 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
9093 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9094 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
9095 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9096 fn drop(&mut self) {
9098 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9099 let _ = unsafe { Box::from_raw(self.contents.result) };
9102 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9103 let _ = unsafe { Box::from_raw(self.contents.err) };
9108 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9109 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9110 let contents = if o.result_ok {
9111 let result = unsafe { o.contents.result };
9112 unsafe { o.contents.result = std::ptr::null_mut() };
9113 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
9115 let err = unsafe { o.contents.err };
9116 unsafe { o.contents.err = std::ptr::null_mut(); }
9117 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
9121 result_ok: o.result_ok,
9126 /// The contents of CResult_NoneLightningErrorZ
9127 pub union CResult_NoneLightningErrorZPtr {
9128 /// Note that this value is always NULL, as there are no contents in the OK variant
9129 pub result: *mut std::ffi::c_void,
9130 /// A pointer to the contents in the error state.
9131 /// Reading from this pointer when `result_ok` is set is undefined.
9132 pub err: *mut crate::lightning::ln::msgs::LightningError,
9135 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
9136 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
9137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9138 pub struct CResult_NoneLightningErrorZ {
9139 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
9140 /// `err` or `result` depending on the state of `result_ok`.
9141 pub contents: CResult_NoneLightningErrorZPtr,
9142 /// Whether this CResult_NoneLightningErrorZ represents a success state.
9143 pub result_ok: bool,
9146 /// Creates a new CResult_NoneLightningErrorZ in the success state.
9147 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
9148 CResult_NoneLightningErrorZ {
9149 contents: CResult_NoneLightningErrorZPtr {
9150 result: std::ptr::null_mut(),
9156 /// Creates a new CResult_NoneLightningErrorZ in the error state.
9157 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
9158 CResult_NoneLightningErrorZ {
9159 contents: CResult_NoneLightningErrorZPtr {
9160 err: Box::into_raw(Box::new(e)),
9165 /// Checks if the given object is currently in the success state
9167 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
9171 /// Frees any resources used by the CResult_NoneLightningErrorZ.
9172 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
9173 impl Drop for CResult_NoneLightningErrorZ {
9174 fn drop(&mut self) {
9177 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9178 let _ = unsafe { Box::from_raw(self.contents.err) };
9183 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
9184 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
9185 let contents = if o.result_ok {
9186 let _ = unsafe { Box::from_raw(o.contents.result) };
9187 o.contents.result = std::ptr::null_mut();
9188 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
9190 let err = unsafe { o.contents.err };
9191 unsafe { o.contents.err = std::ptr::null_mut(); }
9192 CResult_NoneLightningErrorZPtr { err }
9196 result_ok: o.result_ok,
9200 impl Clone for CResult_NoneLightningErrorZ {
9201 fn clone(&self) -> Self {
9203 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
9204 result: std::ptr::null_mut()
9207 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
9208 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
9214 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9215 /// but with all dynamically-allocated buffers duplicated in new buffers.
9216 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
9218 /// A tuple of 2 elements. See the individual fields for the types contained.
9219 pub struct C2Tuple_PublicKeyTypeZ {
9220 /// The element at position 0
9221 pub a: crate::c_types::PublicKey,
9222 /// The element at position 1
9223 pub b: crate::lightning::ln::wire::Type,
9225 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
9226 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
9233 impl C2Tuple_PublicKeyTypeZ {
9234 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
9238 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
9240 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
9241 C2Tuple_PublicKeyTypeZ { a, b, }
9245 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
9246 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
9248 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9249 /// This corresponds to std::vector in C++
9250 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
9251 /// The elements in the array.
9252 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9253 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
9254 /// The number of elements pointed to by `data`.
9257 impl CVec_C2Tuple_PublicKeyTypeZZ {
9258 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
9259 if self.datalen == 0 { return Vec::new(); }
9260 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9261 self.data = std::ptr::null_mut();
9265 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
9266 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9269 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
9270 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
9271 let datalen = v.len();
9272 let data = Box::into_raw(v.into_boxed_slice());
9273 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9277 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9278 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
9279 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
9280 fn drop(&mut self) {
9281 if self.datalen == 0 { return; }
9282 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9286 /// The contents of CResult_boolLightningErrorZ
9287 pub union CResult_boolLightningErrorZPtr {
9288 /// A pointer to the contents in the success state.
9289 /// Reading from this pointer when `result_ok` is not set is undefined.
9290 pub result: *mut bool,
9291 /// A pointer to the contents in the error state.
9292 /// Reading from this pointer when `result_ok` is set is undefined.
9293 pub err: *mut crate::lightning::ln::msgs::LightningError,
9296 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
9297 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
9298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9299 pub struct CResult_boolLightningErrorZ {
9300 /// The contents of this CResult_boolLightningErrorZ, accessible via either
9301 /// `err` or `result` depending on the state of `result_ok`.
9302 pub contents: CResult_boolLightningErrorZPtr,
9303 /// Whether this CResult_boolLightningErrorZ represents a success state.
9304 pub result_ok: bool,
9307 /// Creates a new CResult_boolLightningErrorZ in the success state.
9308 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
9309 CResult_boolLightningErrorZ {
9310 contents: CResult_boolLightningErrorZPtr {
9311 result: Box::into_raw(Box::new(o)),
9317 /// Creates a new CResult_boolLightningErrorZ in the error state.
9318 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
9319 CResult_boolLightningErrorZ {
9320 contents: CResult_boolLightningErrorZPtr {
9321 err: Box::into_raw(Box::new(e)),
9326 /// Checks if the given object is currently in the success state
9328 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
9332 /// Frees any resources used by the CResult_boolLightningErrorZ.
9333 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
9334 impl Drop for CResult_boolLightningErrorZ {
9335 fn drop(&mut self) {
9337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9338 let _ = unsafe { Box::from_raw(self.contents.result) };
9341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9342 let _ = unsafe { Box::from_raw(self.contents.err) };
9347 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
9348 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
9349 let contents = if o.result_ok {
9350 let result = unsafe { o.contents.result };
9351 unsafe { o.contents.result = std::ptr::null_mut() };
9352 CResult_boolLightningErrorZPtr { result }
9354 let err = unsafe { o.contents.err };
9355 unsafe { o.contents.err = std::ptr::null_mut(); }
9356 CResult_boolLightningErrorZPtr { err }
9360 result_ok: o.result_ok,
9364 impl Clone for CResult_boolLightningErrorZ {
9365 fn clone(&self) -> Self {
9367 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
9368 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9371 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
9372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
9378 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9379 /// but with all dynamically-allocated buffers duplicated in new buffers.
9380 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
9382 /// A tuple of 3 elements. See the individual fields for the types contained.
9383 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9384 /// The element at position 0
9385 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
9386 /// The element at position 1
9387 pub b: crate::lightning::ln::msgs::ChannelUpdate,
9388 /// The element at position 2
9389 pub c: crate::lightning::ln::msgs::ChannelUpdate,
9391 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9392 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
9400 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9401 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
9402 (self.a, self.b, self.c)
9405 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9406 fn clone(&self) -> Self {
9408 a: Clone::clone(&self.a),
9409 b: Clone::clone(&self.b),
9410 c: Clone::clone(&self.c),
9415 /// Creates a new tuple which has the same data as `orig`
9416 /// but with all dynamically-allocated buffers duplicated in new buffers.
9417 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
9418 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9420 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 {
9421 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
9425 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9426 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
9428 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
9429 /// This corresponds to std::vector in C++
9430 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9431 /// The elements in the array.
9432 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9433 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
9434 /// The number of elements pointed to by `data`.
9437 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9438 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
9439 if self.datalen == 0 { return Vec::new(); }
9440 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9441 self.data = std::ptr::null_mut();
9445 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
9446 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9449 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9450 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
9451 let datalen = v.len();
9452 let data = Box::into_raw(v.into_boxed_slice());
9453 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9457 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9458 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
9459 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9460 fn drop(&mut self) {
9461 if self.datalen == 0 { return; }
9462 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9465 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9466 fn clone(&self) -> Self {
9467 let mut res = Vec::new();
9468 if self.datalen == 0 { return Self::from(res); }
9469 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9474 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
9475 /// This corresponds to std::vector in C++
9476 pub struct CVec_NodeAnnouncementZ {
9477 /// The elements in the array.
9478 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9479 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
9480 /// The number of elements pointed to by `data`.
9483 impl CVec_NodeAnnouncementZ {
9484 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
9485 if self.datalen == 0 { return Vec::new(); }
9486 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9487 self.data = std::ptr::null_mut();
9491 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
9492 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9495 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
9496 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
9497 let datalen = v.len();
9498 let data = Box::into_raw(v.into_boxed_slice());
9499 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9503 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9504 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
9505 impl Drop for CVec_NodeAnnouncementZ {
9506 fn drop(&mut self) {
9507 if self.datalen == 0 { return; }
9508 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9511 impl Clone for CVec_NodeAnnouncementZ {
9512 fn clone(&self) -> Self {
9513 let mut res = Vec::new();
9514 if self.datalen == 0 { return Self::from(res); }
9515 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9520 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
9521 /// This corresponds to std::vector in C++
9522 pub struct CVec_PublicKeyZ {
9523 /// The elements in the array.
9524 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9525 pub data: *mut crate::c_types::PublicKey,
9526 /// The number of elements pointed to by `data`.
9529 impl CVec_PublicKeyZ {
9530 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
9531 if self.datalen == 0 { return Vec::new(); }
9532 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9533 self.data = std::ptr::null_mut();
9537 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
9538 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9541 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
9542 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
9543 let datalen = v.len();
9544 let data = Box::into_raw(v.into_boxed_slice());
9545 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9549 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9550 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
9551 impl Drop for CVec_PublicKeyZ {
9552 fn drop(&mut self) {
9553 if self.datalen == 0 { return; }
9554 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9557 impl Clone for CVec_PublicKeyZ {
9558 fn clone(&self) -> Self {
9559 let mut res = Vec::new();
9560 if self.datalen == 0 { return Self::from(res); }
9561 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9566 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
9567 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
9568 /// A pointer to the contents in the success state.
9569 /// Reading from this pointer when `result_ok` is not set is undefined.
9570 pub result: *mut crate::c_types::derived::CVec_u8Z,
9571 /// A pointer to the contents in the error state.
9572 /// Reading from this pointer when `result_ok` is set is undefined.
9573 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9576 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9577 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9579 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
9580 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9581 /// `err` or `result` depending on the state of `result_ok`.
9582 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
9583 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9584 pub result_ok: bool,
9587 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9588 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
9589 CResult_CVec_u8ZPeerHandleErrorZ {
9590 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9591 result: Box::into_raw(Box::new(o)),
9597 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9598 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
9599 CResult_CVec_u8ZPeerHandleErrorZ {
9600 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9601 err: Box::into_raw(Box::new(e)),
9606 /// Checks if the given object is currently in the success state
9608 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
9612 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9613 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
9614 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
9615 fn drop(&mut self) {
9617 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9618 let _ = unsafe { Box::from_raw(self.contents.result) };
9621 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9622 let _ = unsafe { Box::from_raw(self.contents.err) };
9627 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
9628 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9629 let contents = if o.result_ok {
9630 let result = unsafe { o.contents.result };
9631 unsafe { o.contents.result = std::ptr::null_mut() };
9632 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
9634 let err = unsafe { o.contents.err };
9635 unsafe { o.contents.err = std::ptr::null_mut(); }
9636 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
9640 result_ok: o.result_ok,
9644 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
9645 fn clone(&self) -> Self {
9647 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9648 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
9651 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9652 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9658 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9659 /// but with all dynamically-allocated buffers duplicated in new buffers.
9660 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
9662 /// The contents of CResult_NonePeerHandleErrorZ
9663 pub union CResult_NonePeerHandleErrorZPtr {
9664 /// Note that this value is always NULL, as there are no contents in the OK variant
9665 pub result: *mut std::ffi::c_void,
9666 /// A pointer to the contents in the error state.
9667 /// Reading from this pointer when `result_ok` is set is undefined.
9668 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9671 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9672 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9673 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9674 pub struct CResult_NonePeerHandleErrorZ {
9675 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9676 /// `err` or `result` depending on the state of `result_ok`.
9677 pub contents: CResult_NonePeerHandleErrorZPtr,
9678 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
9679 pub result_ok: bool,
9682 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
9683 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
9684 CResult_NonePeerHandleErrorZ {
9685 contents: CResult_NonePeerHandleErrorZPtr {
9686 result: std::ptr::null_mut(),
9692 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
9693 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
9694 CResult_NonePeerHandleErrorZ {
9695 contents: CResult_NonePeerHandleErrorZPtr {
9696 err: Box::into_raw(Box::new(e)),
9701 /// Checks if the given object is currently in the success state
9703 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
9707 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
9708 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
9709 impl Drop for CResult_NonePeerHandleErrorZ {
9710 fn drop(&mut self) {
9713 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9714 let _ = unsafe { Box::from_raw(self.contents.err) };
9719 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
9720 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9721 let contents = if o.result_ok {
9722 let _ = unsafe { Box::from_raw(o.contents.result) };
9723 o.contents.result = std::ptr::null_mut();
9724 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
9726 let err = unsafe { o.contents.err };
9727 unsafe { o.contents.err = std::ptr::null_mut(); }
9728 CResult_NonePeerHandleErrorZPtr { err }
9732 result_ok: o.result_ok,
9736 impl Clone for CResult_NonePeerHandleErrorZ {
9737 fn clone(&self) -> Self {
9739 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
9740 result: std::ptr::null_mut()
9743 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
9744 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9750 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9751 /// but with all dynamically-allocated buffers duplicated in new buffers.
9752 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
9754 /// The contents of CResult_boolPeerHandleErrorZ
9755 pub union CResult_boolPeerHandleErrorZPtr {
9756 /// A pointer to the contents in the success state.
9757 /// Reading from this pointer when `result_ok` is not set is undefined.
9758 pub result: *mut bool,
9759 /// A pointer to the contents in the error state.
9760 /// Reading from this pointer when `result_ok` is set is undefined.
9761 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9764 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9765 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9766 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9767 pub struct CResult_boolPeerHandleErrorZ {
9768 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9769 /// `err` or `result` depending on the state of `result_ok`.
9770 pub contents: CResult_boolPeerHandleErrorZPtr,
9771 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
9772 pub result_ok: bool,
9775 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
9776 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
9777 CResult_boolPeerHandleErrorZ {
9778 contents: CResult_boolPeerHandleErrorZPtr {
9779 result: Box::into_raw(Box::new(o)),
9785 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
9786 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
9787 CResult_boolPeerHandleErrorZ {
9788 contents: CResult_boolPeerHandleErrorZPtr {
9789 err: Box::into_raw(Box::new(e)),
9794 /// Checks if the given object is currently in the success state
9796 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
9800 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
9801 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
9802 impl Drop for CResult_boolPeerHandleErrorZ {
9803 fn drop(&mut self) {
9805 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9806 let _ = unsafe { Box::from_raw(self.contents.result) };
9809 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9810 let _ = unsafe { Box::from_raw(self.contents.err) };
9815 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
9816 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9817 let contents = if o.result_ok {
9818 let result = unsafe { o.contents.result };
9819 unsafe { o.contents.result = std::ptr::null_mut() };
9820 CResult_boolPeerHandleErrorZPtr { result }
9822 let err = unsafe { o.contents.err };
9823 unsafe { o.contents.err = std::ptr::null_mut(); }
9824 CResult_boolPeerHandleErrorZPtr { err }
9828 result_ok: o.result_ok,
9832 impl Clone for CResult_boolPeerHandleErrorZ {
9833 fn clone(&self) -> Self {
9835 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
9836 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9839 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
9840 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9846 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9847 /// but with all dynamically-allocated buffers duplicated in new buffers.
9848 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
9850 /// The contents of CResult_NodeIdDecodeErrorZ
9851 pub union CResult_NodeIdDecodeErrorZPtr {
9852 /// A pointer to the contents in the success state.
9853 /// Reading from this pointer when `result_ok` is not set is undefined.
9854 pub result: *mut crate::lightning::routing::network_graph::NodeId,
9855 /// A pointer to the contents in the error state.
9856 /// Reading from this pointer when `result_ok` is set is undefined.
9857 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9860 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
9861 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
9862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9863 pub struct CResult_NodeIdDecodeErrorZ {
9864 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
9865 /// `err` or `result` depending on the state of `result_ok`.
9866 pub contents: CResult_NodeIdDecodeErrorZPtr,
9867 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
9868 pub result_ok: bool,
9871 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
9872 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
9873 CResult_NodeIdDecodeErrorZ {
9874 contents: CResult_NodeIdDecodeErrorZPtr {
9875 result: Box::into_raw(Box::new(o)),
9881 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
9882 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
9883 CResult_NodeIdDecodeErrorZ {
9884 contents: CResult_NodeIdDecodeErrorZPtr {
9885 err: Box::into_raw(Box::new(e)),
9890 /// Checks if the given object is currently in the success state
9892 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
9896 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
9897 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
9898 impl Drop for CResult_NodeIdDecodeErrorZ {
9899 fn drop(&mut self) {
9901 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9902 let _ = unsafe { Box::from_raw(self.contents.result) };
9905 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9906 let _ = unsafe { Box::from_raw(self.contents.err) };
9911 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
9912 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
9913 let contents = if o.result_ok {
9914 let result = unsafe { o.contents.result };
9915 unsafe { o.contents.result = std::ptr::null_mut() };
9916 CResult_NodeIdDecodeErrorZPtr { result }
9918 let err = unsafe { o.contents.err };
9919 unsafe { o.contents.err = std::ptr::null_mut(); }
9920 CResult_NodeIdDecodeErrorZPtr { err }
9924 result_ok: o.result_ok,
9928 impl Clone for CResult_NodeIdDecodeErrorZ {
9929 fn clone(&self) -> Self {
9931 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
9932 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
9935 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
9936 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9942 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
9943 /// but with all dynamically-allocated buffers duplicated in new buffers.
9944 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
9946 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
9947 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9948 /// A pointer to the contents in the success state.
9949 /// Reading from this pointer when `result_ok` is not set is undefined.
9950 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
9951 /// A pointer to the contents in the error state.
9952 /// Reading from this pointer when `result_ok` is set is undefined.
9953 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9956 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
9957 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9959 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
9960 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
9961 /// `err` or `result` depending on the state of `result_ok`.
9962 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
9963 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
9964 pub result_ok: bool,
9967 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
9968 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9969 CResult_COption_NetworkUpdateZDecodeErrorZ {
9970 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9971 result: Box::into_raw(Box::new(o)),
9977 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
9978 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9979 CResult_COption_NetworkUpdateZDecodeErrorZ {
9980 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9981 err: Box::into_raw(Box::new(e)),
9986 /// Checks if the given object is currently in the success state
9988 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
9992 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
9993 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
9994 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
9995 fn drop(&mut self) {
9997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9998 let _ = unsafe { Box::from_raw(self.contents.result) };
10001 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10002 let _ = unsafe { Box::from_raw(self.contents.err) };
10007 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10008 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10009 let contents = if o.result_ok {
10010 let result = unsafe { o.contents.result };
10011 unsafe { o.contents.result = std::ptr::null_mut() };
10012 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10014 let err = unsafe { o.contents.err };
10015 unsafe { o.contents.err = std::ptr::null_mut(); }
10016 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10020 result_ok: o.result_ok,
10024 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10025 fn clone(&self) -> Self {
10026 if self.result_ok {
10027 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10028 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10031 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10032 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10038 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
10039 /// but with all dynamically-allocated buffers duplicated in new buffers.
10040 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
10042 /// An enum which can either contain a crate::lightning::chain::Access or not
10043 pub enum COption_AccessZ {
10044 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
10045 Some(crate::lightning::chain::Access),
10046 /// When we're in this state, this COption_AccessZ contains nothing
10049 impl COption_AccessZ {
10050 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10051 if let Self::None = self { false } else { true }
10053 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10056 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
10057 if let Self::Some(v) = self { v } else { unreachable!() }
10061 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
10062 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
10063 COption_AccessZ::Some(o)
10066 /// Constructs a new COption_AccessZ containing nothing
10067 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
10068 COption_AccessZ::None
10071 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
10072 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
10074 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
10075 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
10076 /// A pointer to the contents in the success state.
10077 /// Reading from this pointer when `result_ok` is not set is undefined.
10078 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
10079 /// A pointer to the contents in the error state.
10080 /// Reading from this pointer when `result_ok` is set is undefined.
10081 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10084 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
10085 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10087 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
10088 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
10089 /// `err` or `result` depending on the state of `result_ok`.
10090 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
10091 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
10092 pub result_ok: bool,
10095 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10096 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
10097 CResult_DirectionalChannelInfoDecodeErrorZ {
10098 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10099 result: Box::into_raw(Box::new(o)),
10105 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10106 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
10107 CResult_DirectionalChannelInfoDecodeErrorZ {
10108 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10109 err: Box::into_raw(Box::new(e)),
10114 /// Checks if the given object is currently in the success state
10116 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o: &CResult_DirectionalChannelInfoDecodeErrorZ) -> bool {
10120 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10121 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
10122 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
10123 fn drop(&mut self) {
10124 if self.result_ok {
10125 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10126 let _ = unsafe { Box::from_raw(self.contents.result) };
10129 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10130 let _ = unsafe { Box::from_raw(self.contents.err) };
10135 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
10136 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10137 let contents = if o.result_ok {
10138 let result = unsafe { o.contents.result };
10139 unsafe { o.contents.result = std::ptr::null_mut() };
10140 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
10142 let err = unsafe { o.contents.err };
10143 unsafe { o.contents.err = std::ptr::null_mut(); }
10144 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
10148 result_ok: o.result_ok,
10152 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
10153 fn clone(&self) -> Self {
10154 if self.result_ok {
10155 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10156 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
10159 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10160 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10166 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10167 /// but with all dynamically-allocated buffers duplicated in new buffers.
10168 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
10170 /// The contents of CResult_ChannelInfoDecodeErrorZ
10171 pub union CResult_ChannelInfoDecodeErrorZPtr {
10172 /// A pointer to the contents in the success state.
10173 /// Reading from this pointer when `result_ok` is not set is undefined.
10174 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
10175 /// A pointer to the contents in the error state.
10176 /// Reading from this pointer when `result_ok` is set is undefined.
10177 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10180 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
10181 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10183 pub struct CResult_ChannelInfoDecodeErrorZ {
10184 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
10185 /// `err` or `result` depending on the state of `result_ok`.
10186 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
10187 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
10188 pub result_ok: bool,
10191 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10192 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
10193 CResult_ChannelInfoDecodeErrorZ {
10194 contents: CResult_ChannelInfoDecodeErrorZPtr {
10195 result: Box::into_raw(Box::new(o)),
10201 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10202 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
10203 CResult_ChannelInfoDecodeErrorZ {
10204 contents: CResult_ChannelInfoDecodeErrorZPtr {
10205 err: Box::into_raw(Box::new(e)),
10210 /// Checks if the given object is currently in the success state
10212 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
10216 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10217 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
10218 impl Drop for CResult_ChannelInfoDecodeErrorZ {
10219 fn drop(&mut self) {
10220 if self.result_ok {
10221 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10222 let _ = unsafe { Box::from_raw(self.contents.result) };
10225 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10226 let _ = unsafe { Box::from_raw(self.contents.err) };
10231 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
10232 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10233 let contents = if o.result_ok {
10234 let result = unsafe { o.contents.result };
10235 unsafe { o.contents.result = std::ptr::null_mut() };
10236 CResult_ChannelInfoDecodeErrorZPtr { result }
10238 let err = unsafe { o.contents.err };
10239 unsafe { o.contents.err = std::ptr::null_mut(); }
10240 CResult_ChannelInfoDecodeErrorZPtr { err }
10244 result_ok: o.result_ok,
10248 impl Clone for CResult_ChannelInfoDecodeErrorZ {
10249 fn clone(&self) -> Self {
10250 if self.result_ok {
10251 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
10252 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
10255 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
10256 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10262 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10263 /// but with all dynamically-allocated buffers duplicated in new buffers.
10264 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
10266 /// The contents of CResult_RoutingFeesDecodeErrorZ
10267 pub union CResult_RoutingFeesDecodeErrorZPtr {
10268 /// A pointer to the contents in the success state.
10269 /// Reading from this pointer when `result_ok` is not set is undefined.
10270 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
10271 /// A pointer to the contents in the error state.
10272 /// Reading from this pointer when `result_ok` is set is undefined.
10273 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10276 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
10277 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
10278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10279 pub struct CResult_RoutingFeesDecodeErrorZ {
10280 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
10281 /// `err` or `result` depending on the state of `result_ok`.
10282 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
10283 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
10284 pub result_ok: bool,
10287 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10288 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
10289 CResult_RoutingFeesDecodeErrorZ {
10290 contents: CResult_RoutingFeesDecodeErrorZPtr {
10291 result: Box::into_raw(Box::new(o)),
10297 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10298 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
10299 CResult_RoutingFeesDecodeErrorZ {
10300 contents: CResult_RoutingFeesDecodeErrorZPtr {
10301 err: Box::into_raw(Box::new(e)),
10306 /// Checks if the given object is currently in the success state
10308 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
10312 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10313 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
10314 impl Drop for CResult_RoutingFeesDecodeErrorZ {
10315 fn drop(&mut self) {
10316 if self.result_ok {
10317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10318 let _ = unsafe { Box::from_raw(self.contents.result) };
10321 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10322 let _ = unsafe { Box::from_raw(self.contents.err) };
10327 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
10328 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
10329 let contents = if o.result_ok {
10330 let result = unsafe { o.contents.result };
10331 unsafe { o.contents.result = std::ptr::null_mut() };
10332 CResult_RoutingFeesDecodeErrorZPtr { result }
10334 let err = unsafe { o.contents.err };
10335 unsafe { o.contents.err = std::ptr::null_mut(); }
10336 CResult_RoutingFeesDecodeErrorZPtr { err }
10340 result_ok: o.result_ok,
10344 impl Clone for CResult_RoutingFeesDecodeErrorZ {
10345 fn clone(&self) -> Self {
10346 if self.result_ok {
10347 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
10348 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
10351 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
10352 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10358 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10359 /// but with all dynamically-allocated buffers duplicated in new buffers.
10360 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
10362 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
10363 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10364 /// A pointer to the contents in the success state.
10365 /// Reading from this pointer when `result_ok` is not set is undefined.
10366 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
10367 /// A pointer to the contents in the error state.
10368 /// Reading from this pointer when `result_ok` is set is undefined.
10369 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10372 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
10373 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10375 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
10376 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
10377 /// `err` or `result` depending on the state of `result_ok`.
10378 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
10379 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
10380 pub result_ok: bool,
10383 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10384 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
10385 CResult_NodeAnnouncementInfoDecodeErrorZ {
10386 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10387 result: Box::into_raw(Box::new(o)),
10393 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10394 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
10395 CResult_NodeAnnouncementInfoDecodeErrorZ {
10396 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10397 err: Box::into_raw(Box::new(e)),
10402 /// Checks if the given object is currently in the success state
10404 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
10408 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10409 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
10410 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
10411 fn drop(&mut self) {
10412 if self.result_ok {
10413 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10414 let _ = unsafe { Box::from_raw(self.contents.result) };
10417 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10418 let _ = unsafe { Box::from_raw(self.contents.err) };
10423 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
10424 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10425 let contents = if o.result_ok {
10426 let result = unsafe { o.contents.result };
10427 unsafe { o.contents.result = std::ptr::null_mut() };
10428 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
10430 let err = unsafe { o.contents.err };
10431 unsafe { o.contents.err = std::ptr::null_mut(); }
10432 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
10436 result_ok: o.result_ok,
10440 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
10441 fn clone(&self) -> Self {
10442 if self.result_ok {
10443 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10444 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
10447 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10448 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10454 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10455 /// but with all dynamically-allocated buffers duplicated in new buffers.
10456 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
10458 /// A dynamically-allocated array of u64s of arbitrary size.
10459 /// This corresponds to std::vector in C++
10460 pub struct CVec_u64Z {
10461 /// The elements in the array.
10462 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10463 pub data: *mut u64,
10464 /// The number of elements pointed to by `data`.
10468 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
10469 if self.datalen == 0 { return Vec::new(); }
10470 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10471 self.data = std::ptr::null_mut();
10475 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
10476 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10479 impl From<Vec<u64>> for CVec_u64Z {
10480 fn from(v: Vec<u64>) -> Self {
10481 let datalen = v.len();
10482 let data = Box::into_raw(v.into_boxed_slice());
10483 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10487 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10488 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
10489 impl Drop for CVec_u64Z {
10490 fn drop(&mut self) {
10491 if self.datalen == 0 { return; }
10492 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10495 impl Clone for CVec_u64Z {
10496 fn clone(&self) -> Self {
10497 let mut res = Vec::new();
10498 if self.datalen == 0 { return Self::from(res); }
10499 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10504 /// The contents of CResult_NodeInfoDecodeErrorZ
10505 pub union CResult_NodeInfoDecodeErrorZPtr {
10506 /// A pointer to the contents in the success state.
10507 /// Reading from this pointer when `result_ok` is not set is undefined.
10508 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
10509 /// A pointer to the contents in the error state.
10510 /// Reading from this pointer when `result_ok` is set is undefined.
10511 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10514 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
10515 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10517 pub struct CResult_NodeInfoDecodeErrorZ {
10518 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
10519 /// `err` or `result` depending on the state of `result_ok`.
10520 pub contents: CResult_NodeInfoDecodeErrorZPtr,
10521 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
10522 pub result_ok: bool,
10525 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10526 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
10527 CResult_NodeInfoDecodeErrorZ {
10528 contents: CResult_NodeInfoDecodeErrorZPtr {
10529 result: Box::into_raw(Box::new(o)),
10535 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10536 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
10537 CResult_NodeInfoDecodeErrorZ {
10538 contents: CResult_NodeInfoDecodeErrorZPtr {
10539 err: Box::into_raw(Box::new(e)),
10544 /// Checks if the given object is currently in the success state
10546 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
10550 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10551 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
10552 impl Drop for CResult_NodeInfoDecodeErrorZ {
10553 fn drop(&mut self) {
10554 if self.result_ok {
10555 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10556 let _ = unsafe { Box::from_raw(self.contents.result) };
10559 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10560 let _ = unsafe { Box::from_raw(self.contents.err) };
10565 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
10566 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10567 let contents = if o.result_ok {
10568 let result = unsafe { o.contents.result };
10569 unsafe { o.contents.result = std::ptr::null_mut() };
10570 CResult_NodeInfoDecodeErrorZPtr { result }
10572 let err = unsafe { o.contents.err };
10573 unsafe { o.contents.err = std::ptr::null_mut(); }
10574 CResult_NodeInfoDecodeErrorZPtr { err }
10578 result_ok: o.result_ok,
10582 impl Clone for CResult_NodeInfoDecodeErrorZ {
10583 fn clone(&self) -> Self {
10584 if self.result_ok {
10585 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
10586 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
10589 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
10590 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10596 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10597 /// but with all dynamically-allocated buffers duplicated in new buffers.
10598 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
10600 /// The contents of CResult_NetworkGraphDecodeErrorZ
10601 pub union CResult_NetworkGraphDecodeErrorZPtr {
10602 /// A pointer to the contents in the success state.
10603 /// Reading from this pointer when `result_ok` is not set is undefined.
10604 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
10605 /// A pointer to the contents in the error state.
10606 /// Reading from this pointer when `result_ok` is set is undefined.
10607 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10610 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
10611 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
10612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10613 pub struct CResult_NetworkGraphDecodeErrorZ {
10614 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
10615 /// `err` or `result` depending on the state of `result_ok`.
10616 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
10617 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
10618 pub result_ok: bool,
10621 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10622 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
10623 CResult_NetworkGraphDecodeErrorZ {
10624 contents: CResult_NetworkGraphDecodeErrorZPtr {
10625 result: Box::into_raw(Box::new(o)),
10631 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10632 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
10633 CResult_NetworkGraphDecodeErrorZ {
10634 contents: CResult_NetworkGraphDecodeErrorZPtr {
10635 err: Box::into_raw(Box::new(e)),
10640 /// Checks if the given object is currently in the success state
10642 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
10646 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10647 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
10648 impl Drop for CResult_NetworkGraphDecodeErrorZ {
10649 fn drop(&mut self) {
10650 if self.result_ok {
10651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10652 let _ = unsafe { Box::from_raw(self.contents.result) };
10655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10656 let _ = unsafe { Box::from_raw(self.contents.err) };
10661 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
10662 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
10663 let contents = if o.result_ok {
10664 let result = unsafe { o.contents.result };
10665 unsafe { o.contents.result = std::ptr::null_mut() };
10666 CResult_NetworkGraphDecodeErrorZPtr { result }
10668 let err = unsafe { o.contents.err };
10669 unsafe { o.contents.err = std::ptr::null_mut(); }
10670 CResult_NetworkGraphDecodeErrorZPtr { err }
10674 result_ok: o.result_ok,
10678 impl Clone for CResult_NetworkGraphDecodeErrorZ {
10679 fn clone(&self) -> Self {
10680 if self.result_ok {
10681 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
10682 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
10685 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
10686 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10692 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10693 /// but with all dynamically-allocated buffers duplicated in new buffers.
10694 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
10697 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
10698 pub enum COption_CVec_NetAddressZZ {
10699 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
10700 Some(crate::c_types::derived::CVec_NetAddressZ),
10701 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
10704 impl COption_CVec_NetAddressZZ {
10705 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10706 if let Self::None = self { false } else { true }
10708 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10711 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
10712 if let Self::Some(v) = self { v } else { unreachable!() }
10716 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
10717 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
10718 COption_CVec_NetAddressZZ::Some(o)
10721 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
10722 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
10723 COption_CVec_NetAddressZZ::None
10726 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
10727 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
10729 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
10730 /// but with all dynamically-allocated buffers duplicated in new buffers.
10731 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
10733 /// The contents of CResult_NetAddressDecodeErrorZ
10734 pub union CResult_NetAddressDecodeErrorZPtr {
10735 /// A pointer to the contents in the success state.
10736 /// Reading from this pointer when `result_ok` is not set is undefined.
10737 pub result: *mut crate::lightning::ln::msgs::NetAddress,
10738 /// A pointer to the contents in the error state.
10739 /// Reading from this pointer when `result_ok` is set is undefined.
10740 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10743 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10744 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10745 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10746 pub struct CResult_NetAddressDecodeErrorZ {
10747 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10748 /// `err` or `result` depending on the state of `result_ok`.
10749 pub contents: CResult_NetAddressDecodeErrorZPtr,
10750 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10751 pub result_ok: bool,
10754 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10755 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
10756 CResult_NetAddressDecodeErrorZ {
10757 contents: CResult_NetAddressDecodeErrorZPtr {
10758 result: Box::into_raw(Box::new(o)),
10764 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10765 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
10766 CResult_NetAddressDecodeErrorZ {
10767 contents: CResult_NetAddressDecodeErrorZPtr {
10768 err: Box::into_raw(Box::new(e)),
10773 /// Checks if the given object is currently in the success state
10775 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
10779 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10780 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
10781 impl Drop for CResult_NetAddressDecodeErrorZ {
10782 fn drop(&mut self) {
10783 if self.result_ok {
10784 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10785 let _ = unsafe { Box::from_raw(self.contents.result) };
10788 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10789 let _ = unsafe { Box::from_raw(self.contents.err) };
10794 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
10795 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
10796 let contents = if o.result_ok {
10797 let result = unsafe { o.contents.result };
10798 unsafe { o.contents.result = std::ptr::null_mut() };
10799 CResult_NetAddressDecodeErrorZPtr { result }
10801 let err = unsafe { o.contents.err };
10802 unsafe { o.contents.err = std::ptr::null_mut(); }
10803 CResult_NetAddressDecodeErrorZPtr { err }
10807 result_ok: o.result_ok,
10811 impl Clone for CResult_NetAddressDecodeErrorZ {
10812 fn clone(&self) -> Self {
10813 if self.result_ok {
10814 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
10815 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
10818 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
10819 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10825 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10826 /// but with all dynamically-allocated buffers duplicated in new buffers.
10827 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
10829 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10830 /// This corresponds to std::vector in C++
10831 pub struct CVec_UpdateAddHTLCZ {
10832 /// The elements in the array.
10833 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10834 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10835 /// The number of elements pointed to by `data`.
10838 impl CVec_UpdateAddHTLCZ {
10839 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
10840 if self.datalen == 0 { return Vec::new(); }
10841 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10842 self.data = std::ptr::null_mut();
10846 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
10847 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10850 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
10851 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
10852 let datalen = v.len();
10853 let data = Box::into_raw(v.into_boxed_slice());
10854 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10859 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
10860 impl Drop for CVec_UpdateAddHTLCZ {
10861 fn drop(&mut self) {
10862 if self.datalen == 0 { return; }
10863 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10866 impl Clone for CVec_UpdateAddHTLCZ {
10867 fn clone(&self) -> Self {
10868 let mut res = Vec::new();
10869 if self.datalen == 0 { return Self::from(res); }
10870 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10875 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10876 /// This corresponds to std::vector in C++
10877 pub struct CVec_UpdateFulfillHTLCZ {
10878 /// The elements in the array.
10879 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10880 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10881 /// The number of elements pointed to by `data`.
10884 impl CVec_UpdateFulfillHTLCZ {
10885 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
10886 if self.datalen == 0 { return Vec::new(); }
10887 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10888 self.data = std::ptr::null_mut();
10892 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
10893 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10896 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
10897 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
10898 let datalen = v.len();
10899 let data = Box::into_raw(v.into_boxed_slice());
10900 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10904 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10905 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
10906 impl Drop for CVec_UpdateFulfillHTLCZ {
10907 fn drop(&mut self) {
10908 if self.datalen == 0 { return; }
10909 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10912 impl Clone for CVec_UpdateFulfillHTLCZ {
10913 fn clone(&self) -> Self {
10914 let mut res = Vec::new();
10915 if self.datalen == 0 { return Self::from(res); }
10916 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10921 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10922 /// This corresponds to std::vector in C++
10923 pub struct CVec_UpdateFailHTLCZ {
10924 /// The elements in the array.
10925 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10926 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10927 /// The number of elements pointed to by `data`.
10930 impl CVec_UpdateFailHTLCZ {
10931 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
10932 if self.datalen == 0 { return Vec::new(); }
10933 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10934 self.data = std::ptr::null_mut();
10938 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
10939 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10942 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
10943 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
10944 let datalen = v.len();
10945 let data = Box::into_raw(v.into_boxed_slice());
10946 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10950 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10951 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
10952 impl Drop for CVec_UpdateFailHTLCZ {
10953 fn drop(&mut self) {
10954 if self.datalen == 0 { return; }
10955 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10958 impl Clone for CVec_UpdateFailHTLCZ {
10959 fn clone(&self) -> Self {
10960 let mut res = Vec::new();
10961 if self.datalen == 0 { return Self::from(res); }
10962 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10967 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10968 /// This corresponds to std::vector in C++
10969 pub struct CVec_UpdateFailMalformedHTLCZ {
10970 /// The elements in the array.
10971 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10972 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10973 /// The number of elements pointed to by `data`.
10976 impl CVec_UpdateFailMalformedHTLCZ {
10977 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
10978 if self.datalen == 0 { return Vec::new(); }
10979 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10980 self.data = std::ptr::null_mut();
10984 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
10985 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10988 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
10989 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
10990 let datalen = v.len();
10991 let data = Box::into_raw(v.into_boxed_slice());
10992 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10996 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10997 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
10998 impl Drop for CVec_UpdateFailMalformedHTLCZ {
10999 fn drop(&mut self) {
11000 if self.datalen == 0 { return; }
11001 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
11004 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11005 fn clone(&self) -> Self {
11006 let mut res = Vec::new();
11007 if self.datalen == 0 { return Self::from(res); }
11008 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
11013 /// The contents of CResult_AcceptChannelDecodeErrorZ
11014 pub union CResult_AcceptChannelDecodeErrorZPtr {
11015 /// A pointer to the contents in the success state.
11016 /// Reading from this pointer when `result_ok` is not set is undefined.
11017 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11018 /// A pointer to the contents in the error state.
11019 /// Reading from this pointer when `result_ok` is set is undefined.
11020 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11023 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11024 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11025 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11026 pub struct CResult_AcceptChannelDecodeErrorZ {
11027 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11028 /// `err` or `result` depending on the state of `result_ok`.
11029 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11030 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11031 pub result_ok: bool,
11034 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11035 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
11036 CResult_AcceptChannelDecodeErrorZ {
11037 contents: CResult_AcceptChannelDecodeErrorZPtr {
11038 result: Box::into_raw(Box::new(o)),
11044 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
11045 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
11046 CResult_AcceptChannelDecodeErrorZ {
11047 contents: CResult_AcceptChannelDecodeErrorZPtr {
11048 err: Box::into_raw(Box::new(e)),
11053 /// Checks if the given object is currently in the success state
11055 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
11059 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
11060 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
11061 impl Drop for CResult_AcceptChannelDecodeErrorZ {
11062 fn drop(&mut self) {
11063 if self.result_ok {
11064 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11065 let _ = unsafe { Box::from_raw(self.contents.result) };
11068 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11069 let _ = unsafe { Box::from_raw(self.contents.err) };
11074 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
11075 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
11076 let contents = if o.result_ok {
11077 let result = unsafe { o.contents.result };
11078 unsafe { o.contents.result = std::ptr::null_mut() };
11079 CResult_AcceptChannelDecodeErrorZPtr { result }
11081 let err = unsafe { o.contents.err };
11082 unsafe { o.contents.err = std::ptr::null_mut(); }
11083 CResult_AcceptChannelDecodeErrorZPtr { err }
11087 result_ok: o.result_ok,
11091 impl Clone for CResult_AcceptChannelDecodeErrorZ {
11092 fn clone(&self) -> Self {
11093 if self.result_ok {
11094 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
11095 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
11098 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
11099 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11105 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
11106 /// but with all dynamically-allocated buffers duplicated in new buffers.
11107 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
11109 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11110 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
11111 /// A pointer to the contents in the success state.
11112 /// Reading from this pointer when `result_ok` is not set is undefined.
11113 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
11114 /// A pointer to the contents in the error state.
11115 /// Reading from this pointer when `result_ok` is set is undefined.
11116 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11119 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11120 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11122 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
11123 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11124 /// `err` or `result` depending on the state of `result_ok`.
11125 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
11126 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11127 pub result_ok: bool,
11130 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
11131 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11132 CResult_AnnouncementSignaturesDecodeErrorZ {
11133 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11134 result: Box::into_raw(Box::new(o)),
11140 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
11141 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11142 CResult_AnnouncementSignaturesDecodeErrorZ {
11143 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11144 err: Box::into_raw(Box::new(e)),
11149 /// Checks if the given object is currently in the success state
11151 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
11155 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
11156 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
11157 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
11158 fn drop(&mut self) {
11159 if self.result_ok {
11160 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11161 let _ = unsafe { Box::from_raw(self.contents.result) };
11164 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11165 let _ = unsafe { Box::from_raw(self.contents.err) };
11170 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
11171 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
11172 let contents = if o.result_ok {
11173 let result = unsafe { o.contents.result };
11174 unsafe { o.contents.result = std::ptr::null_mut() };
11175 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
11177 let err = unsafe { o.contents.err };
11178 unsafe { o.contents.err = std::ptr::null_mut(); }
11179 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
11183 result_ok: o.result_ok,
11187 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
11188 fn clone(&self) -> Self {
11189 if self.result_ok {
11190 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11191 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
11194 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11195 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11201 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
11202 /// but with all dynamically-allocated buffers duplicated in new buffers.
11203 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
11205 /// The contents of CResult_ChannelReestablishDecodeErrorZ
11206 pub union CResult_ChannelReestablishDecodeErrorZPtr {
11207 /// A pointer to the contents in the success state.
11208 /// Reading from this pointer when `result_ok` is not set is undefined.
11209 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
11210 /// A pointer to the contents in the error state.
11211 /// Reading from this pointer when `result_ok` is set is undefined.
11212 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11215 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
11216 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
11217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11218 pub struct CResult_ChannelReestablishDecodeErrorZ {
11219 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
11220 /// `err` or `result` depending on the state of `result_ok`.
11221 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
11222 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
11223 pub result_ok: bool,
11226 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
11227 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
11228 CResult_ChannelReestablishDecodeErrorZ {
11229 contents: CResult_ChannelReestablishDecodeErrorZPtr {
11230 result: Box::into_raw(Box::new(o)),
11236 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
11237 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
11238 CResult_ChannelReestablishDecodeErrorZ {
11239 contents: CResult_ChannelReestablishDecodeErrorZPtr {
11240 err: Box::into_raw(Box::new(e)),
11245 /// Checks if the given object is currently in the success state
11247 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
11251 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
11252 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
11253 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
11254 fn drop(&mut self) {
11255 if self.result_ok {
11256 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11257 let _ = unsafe { Box::from_raw(self.contents.result) };
11260 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11261 let _ = unsafe { Box::from_raw(self.contents.err) };
11266 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
11267 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
11268 let contents = if o.result_ok {
11269 let result = unsafe { o.contents.result };
11270 unsafe { o.contents.result = std::ptr::null_mut() };
11271 CResult_ChannelReestablishDecodeErrorZPtr { result }
11273 let err = unsafe { o.contents.err };
11274 unsafe { o.contents.err = std::ptr::null_mut(); }
11275 CResult_ChannelReestablishDecodeErrorZPtr { err }
11279 result_ok: o.result_ok,
11283 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
11284 fn clone(&self) -> Self {
11285 if self.result_ok {
11286 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
11287 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
11290 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
11291 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11297 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
11298 /// but with all dynamically-allocated buffers duplicated in new buffers.
11299 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
11301 /// The contents of CResult_ClosingSignedDecodeErrorZ
11302 pub union CResult_ClosingSignedDecodeErrorZPtr {
11303 /// A pointer to the contents in the success state.
11304 /// Reading from this pointer when `result_ok` is not set is undefined.
11305 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
11306 /// A pointer to the contents in the error state.
11307 /// Reading from this pointer when `result_ok` is set is undefined.
11308 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11311 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
11312 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11314 pub struct CResult_ClosingSignedDecodeErrorZ {
11315 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
11316 /// `err` or `result` depending on the state of `result_ok`.
11317 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
11318 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
11319 pub result_ok: bool,
11322 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
11323 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
11324 CResult_ClosingSignedDecodeErrorZ {
11325 contents: CResult_ClosingSignedDecodeErrorZPtr {
11326 result: Box::into_raw(Box::new(o)),
11332 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
11333 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
11334 CResult_ClosingSignedDecodeErrorZ {
11335 contents: CResult_ClosingSignedDecodeErrorZPtr {
11336 err: Box::into_raw(Box::new(e)),
11341 /// Checks if the given object is currently in the success state
11343 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
11347 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
11348 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
11349 impl Drop for CResult_ClosingSignedDecodeErrorZ {
11350 fn drop(&mut self) {
11351 if self.result_ok {
11352 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11353 let _ = unsafe { Box::from_raw(self.contents.result) };
11356 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11357 let _ = unsafe { Box::from_raw(self.contents.err) };
11362 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
11363 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11364 let contents = if o.result_ok {
11365 let result = unsafe { o.contents.result };
11366 unsafe { o.contents.result = std::ptr::null_mut() };
11367 CResult_ClosingSignedDecodeErrorZPtr { result }
11369 let err = unsafe { o.contents.err };
11370 unsafe { o.contents.err = std::ptr::null_mut(); }
11371 CResult_ClosingSignedDecodeErrorZPtr { err }
11375 result_ok: o.result_ok,
11379 impl Clone for CResult_ClosingSignedDecodeErrorZ {
11380 fn clone(&self) -> Self {
11381 if self.result_ok {
11382 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
11383 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
11386 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
11387 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11393 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
11394 /// but with all dynamically-allocated buffers duplicated in new buffers.
11395 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
11397 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
11398 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11399 /// A pointer to the contents in the success state.
11400 /// Reading from this pointer when `result_ok` is not set is undefined.
11401 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
11402 /// A pointer to the contents in the error state.
11403 /// Reading from this pointer when `result_ok` is set is undefined.
11404 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11407 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
11408 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11410 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
11411 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
11412 /// `err` or `result` depending on the state of `result_ok`.
11413 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
11414 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
11415 pub result_ok: bool,
11418 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
11419 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11420 CResult_ClosingSignedFeeRangeDecodeErrorZ {
11421 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11422 result: Box::into_raw(Box::new(o)),
11428 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
11429 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11430 CResult_ClosingSignedFeeRangeDecodeErrorZ {
11431 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11432 err: Box::into_raw(Box::new(e)),
11437 /// Checks if the given object is currently in the success state
11439 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
11443 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
11444 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
11445 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11446 fn drop(&mut self) {
11447 if self.result_ok {
11448 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11449 let _ = unsafe { Box::from_raw(self.contents.result) };
11452 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11453 let _ = unsafe { Box::from_raw(self.contents.err) };
11458 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11459 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11460 let contents = if o.result_ok {
11461 let result = unsafe { o.contents.result };
11462 unsafe { o.contents.result = std::ptr::null_mut() };
11463 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
11465 let err = unsafe { o.contents.err };
11466 unsafe { o.contents.err = std::ptr::null_mut(); }
11467 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
11471 result_ok: o.result_ok,
11475 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11476 fn clone(&self) -> Self {
11477 if self.result_ok {
11478 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11479 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
11482 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11483 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11489 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
11490 /// but with all dynamically-allocated buffers duplicated in new buffers.
11491 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
11493 /// The contents of CResult_CommitmentSignedDecodeErrorZ
11494 pub union CResult_CommitmentSignedDecodeErrorZPtr {
11495 /// A pointer to the contents in the success state.
11496 /// Reading from this pointer when `result_ok` is not set is undefined.
11497 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
11498 /// A pointer to the contents in the error state.
11499 /// Reading from this pointer when `result_ok` is set is undefined.
11500 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11503 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11504 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11506 pub struct CResult_CommitmentSignedDecodeErrorZ {
11507 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11508 /// `err` or `result` depending on the state of `result_ok`.
11509 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
11510 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11511 pub result_ok: bool,
11514 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
11515 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
11516 CResult_CommitmentSignedDecodeErrorZ {
11517 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11518 result: Box::into_raw(Box::new(o)),
11524 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
11525 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
11526 CResult_CommitmentSignedDecodeErrorZ {
11527 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11528 err: Box::into_raw(Box::new(e)),
11533 /// Checks if the given object is currently in the success state
11535 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
11539 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
11540 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
11541 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
11542 fn drop(&mut self) {
11543 if self.result_ok {
11544 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11545 let _ = unsafe { Box::from_raw(self.contents.result) };
11548 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11549 let _ = unsafe { Box::from_raw(self.contents.err) };
11554 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
11555 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11556 let contents = if o.result_ok {
11557 let result = unsafe { o.contents.result };
11558 unsafe { o.contents.result = std::ptr::null_mut() };
11559 CResult_CommitmentSignedDecodeErrorZPtr { result }
11561 let err = unsafe { o.contents.err };
11562 unsafe { o.contents.err = std::ptr::null_mut(); }
11563 CResult_CommitmentSignedDecodeErrorZPtr { err }
11567 result_ok: o.result_ok,
11571 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
11572 fn clone(&self) -> Self {
11573 if self.result_ok {
11574 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11575 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
11578 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11579 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11585 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
11586 /// but with all dynamically-allocated buffers duplicated in new buffers.
11587 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
11589 /// The contents of CResult_FundingCreatedDecodeErrorZ
11590 pub union CResult_FundingCreatedDecodeErrorZPtr {
11591 /// A pointer to the contents in the success state.
11592 /// Reading from this pointer when `result_ok` is not set is undefined.
11593 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
11594 /// A pointer to the contents in the error state.
11595 /// Reading from this pointer when `result_ok` is set is undefined.
11596 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11599 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11600 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11602 pub struct CResult_FundingCreatedDecodeErrorZ {
11603 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11604 /// `err` or `result` depending on the state of `result_ok`.
11605 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
11606 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11607 pub result_ok: bool,
11610 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
11611 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
11612 CResult_FundingCreatedDecodeErrorZ {
11613 contents: CResult_FundingCreatedDecodeErrorZPtr {
11614 result: Box::into_raw(Box::new(o)),
11620 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
11621 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
11622 CResult_FundingCreatedDecodeErrorZ {
11623 contents: CResult_FundingCreatedDecodeErrorZPtr {
11624 err: Box::into_raw(Box::new(e)),
11629 /// Checks if the given object is currently in the success state
11631 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
11635 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
11636 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
11637 impl Drop for CResult_FundingCreatedDecodeErrorZ {
11638 fn drop(&mut self) {
11639 if self.result_ok {
11640 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11641 let _ = unsafe { Box::from_raw(self.contents.result) };
11644 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11645 let _ = unsafe { Box::from_raw(self.contents.err) };
11650 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
11651 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
11652 let contents = if o.result_ok {
11653 let result = unsafe { o.contents.result };
11654 unsafe { o.contents.result = std::ptr::null_mut() };
11655 CResult_FundingCreatedDecodeErrorZPtr { result }
11657 let err = unsafe { o.contents.err };
11658 unsafe { o.contents.err = std::ptr::null_mut(); }
11659 CResult_FundingCreatedDecodeErrorZPtr { err }
11663 result_ok: o.result_ok,
11667 impl Clone for CResult_FundingCreatedDecodeErrorZ {
11668 fn clone(&self) -> Self {
11669 if self.result_ok {
11670 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
11671 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
11674 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
11675 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11681 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
11682 /// but with all dynamically-allocated buffers duplicated in new buffers.
11683 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
11685 /// The contents of CResult_FundingSignedDecodeErrorZ
11686 pub union CResult_FundingSignedDecodeErrorZPtr {
11687 /// A pointer to the contents in the success state.
11688 /// Reading from this pointer when `result_ok` is not set is undefined.
11689 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
11690 /// A pointer to the contents in the error state.
11691 /// Reading from this pointer when `result_ok` is set is undefined.
11692 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11695 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11696 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11698 pub struct CResult_FundingSignedDecodeErrorZ {
11699 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11700 /// `err` or `result` depending on the state of `result_ok`.
11701 pub contents: CResult_FundingSignedDecodeErrorZPtr,
11702 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11703 pub result_ok: bool,
11706 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
11707 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
11708 CResult_FundingSignedDecodeErrorZ {
11709 contents: CResult_FundingSignedDecodeErrorZPtr {
11710 result: Box::into_raw(Box::new(o)),
11716 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
11717 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
11718 CResult_FundingSignedDecodeErrorZ {
11719 contents: CResult_FundingSignedDecodeErrorZPtr {
11720 err: Box::into_raw(Box::new(e)),
11725 /// Checks if the given object is currently in the success state
11727 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
11731 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11732 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
11733 impl Drop for CResult_FundingSignedDecodeErrorZ {
11734 fn drop(&mut self) {
11735 if self.result_ok {
11736 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11737 let _ = unsafe { Box::from_raw(self.contents.result) };
11740 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11741 let _ = unsafe { Box::from_raw(self.contents.err) };
11746 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
11747 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11748 let contents = if o.result_ok {
11749 let result = unsafe { o.contents.result };
11750 unsafe { o.contents.result = std::ptr::null_mut() };
11751 CResult_FundingSignedDecodeErrorZPtr { result }
11753 let err = unsafe { o.contents.err };
11754 unsafe { o.contents.err = std::ptr::null_mut(); }
11755 CResult_FundingSignedDecodeErrorZPtr { err }
11759 result_ok: o.result_ok,
11763 impl Clone for CResult_FundingSignedDecodeErrorZ {
11764 fn clone(&self) -> Self {
11765 if self.result_ok {
11766 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
11767 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
11770 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
11771 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11777 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11778 /// but with all dynamically-allocated buffers duplicated in new buffers.
11779 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
11781 /// The contents of CResult_FundingLockedDecodeErrorZ
11782 pub union CResult_FundingLockedDecodeErrorZPtr {
11783 /// A pointer to the contents in the success state.
11784 /// Reading from this pointer when `result_ok` is not set is undefined.
11785 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
11786 /// A pointer to the contents in the error state.
11787 /// Reading from this pointer when `result_ok` is set is undefined.
11788 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11791 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
11792 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
11793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11794 pub struct CResult_FundingLockedDecodeErrorZ {
11795 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
11796 /// `err` or `result` depending on the state of `result_ok`.
11797 pub contents: CResult_FundingLockedDecodeErrorZPtr,
11798 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
11799 pub result_ok: bool,
11802 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11803 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
11804 CResult_FundingLockedDecodeErrorZ {
11805 contents: CResult_FundingLockedDecodeErrorZPtr {
11806 result: Box::into_raw(Box::new(o)),
11812 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11813 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
11814 CResult_FundingLockedDecodeErrorZ {
11815 contents: CResult_FundingLockedDecodeErrorZPtr {
11816 err: Box::into_raw(Box::new(e)),
11821 /// Checks if the given object is currently in the success state
11823 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
11827 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11828 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
11829 impl Drop for CResult_FundingLockedDecodeErrorZ {
11830 fn drop(&mut self) {
11831 if self.result_ok {
11832 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11833 let _ = unsafe { Box::from_raw(self.contents.result) };
11836 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11837 let _ = unsafe { Box::from_raw(self.contents.err) };
11842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
11843 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
11844 let contents = if o.result_ok {
11845 let result = unsafe { o.contents.result };
11846 unsafe { o.contents.result = std::ptr::null_mut() };
11847 CResult_FundingLockedDecodeErrorZPtr { result }
11849 let err = unsafe { o.contents.err };
11850 unsafe { o.contents.err = std::ptr::null_mut(); }
11851 CResult_FundingLockedDecodeErrorZPtr { err }
11855 result_ok: o.result_ok,
11859 impl Clone for CResult_FundingLockedDecodeErrorZ {
11860 fn clone(&self) -> Self {
11861 if self.result_ok {
11862 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
11863 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
11866 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
11867 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11873 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11874 /// but with all dynamically-allocated buffers duplicated in new buffers.
11875 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
11877 /// The contents of CResult_InitDecodeErrorZ
11878 pub union CResult_InitDecodeErrorZPtr {
11879 /// A pointer to the contents in the success state.
11880 /// Reading from this pointer when `result_ok` is not set is undefined.
11881 pub result: *mut crate::lightning::ln::msgs::Init,
11882 /// A pointer to the contents in the error state.
11883 /// Reading from this pointer when `result_ok` is set is undefined.
11884 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11887 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11888 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11890 pub struct CResult_InitDecodeErrorZ {
11891 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
11892 /// `err` or `result` depending on the state of `result_ok`.
11893 pub contents: CResult_InitDecodeErrorZPtr,
11894 /// Whether this CResult_InitDecodeErrorZ represents a success state.
11895 pub result_ok: bool,
11898 /// Creates a new CResult_InitDecodeErrorZ in the success state.
11899 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
11900 CResult_InitDecodeErrorZ {
11901 contents: CResult_InitDecodeErrorZPtr {
11902 result: Box::into_raw(Box::new(o)),
11908 /// Creates a new CResult_InitDecodeErrorZ in the error state.
11909 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
11910 CResult_InitDecodeErrorZ {
11911 contents: CResult_InitDecodeErrorZPtr {
11912 err: Box::into_raw(Box::new(e)),
11917 /// Checks if the given object is currently in the success state
11919 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
11923 /// Frees any resources used by the CResult_InitDecodeErrorZ.
11924 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
11925 impl Drop for CResult_InitDecodeErrorZ {
11926 fn drop(&mut self) {
11927 if self.result_ok {
11928 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11929 let _ = unsafe { Box::from_raw(self.contents.result) };
11932 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11933 let _ = unsafe { Box::from_raw(self.contents.err) };
11938 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
11939 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
11940 let contents = if o.result_ok {
11941 let result = unsafe { o.contents.result };
11942 unsafe { o.contents.result = std::ptr::null_mut() };
11943 CResult_InitDecodeErrorZPtr { result }
11945 let err = unsafe { o.contents.err };
11946 unsafe { o.contents.err = std::ptr::null_mut(); }
11947 CResult_InitDecodeErrorZPtr { err }
11951 result_ok: o.result_ok,
11955 impl Clone for CResult_InitDecodeErrorZ {
11956 fn clone(&self) -> Self {
11957 if self.result_ok {
11958 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
11959 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
11962 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
11963 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11969 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11970 /// but with all dynamically-allocated buffers duplicated in new buffers.
11971 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
11973 /// The contents of CResult_OpenChannelDecodeErrorZ
11974 pub union CResult_OpenChannelDecodeErrorZPtr {
11975 /// A pointer to the contents in the success state.
11976 /// Reading from this pointer when `result_ok` is not set is undefined.
11977 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
11978 /// A pointer to the contents in the error state.
11979 /// Reading from this pointer when `result_ok` is set is undefined.
11980 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11983 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11984 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11986 pub struct CResult_OpenChannelDecodeErrorZ {
11987 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11988 /// `err` or `result` depending on the state of `result_ok`.
11989 pub contents: CResult_OpenChannelDecodeErrorZPtr,
11990 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
11991 pub result_ok: bool,
11994 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11995 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
11996 CResult_OpenChannelDecodeErrorZ {
11997 contents: CResult_OpenChannelDecodeErrorZPtr {
11998 result: Box::into_raw(Box::new(o)),
12004 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12005 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12006 CResult_OpenChannelDecodeErrorZ {
12007 contents: CResult_OpenChannelDecodeErrorZPtr {
12008 err: Box::into_raw(Box::new(e)),
12013 /// Checks if the given object is currently in the success state
12015 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12019 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12020 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12021 impl Drop for CResult_OpenChannelDecodeErrorZ {
12022 fn drop(&mut self) {
12023 if self.result_ok {
12024 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12025 let _ = unsafe { Box::from_raw(self.contents.result) };
12028 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12029 let _ = unsafe { Box::from_raw(self.contents.err) };
12034 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
12035 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12036 let contents = if o.result_ok {
12037 let result = unsafe { o.contents.result };
12038 unsafe { o.contents.result = std::ptr::null_mut() };
12039 CResult_OpenChannelDecodeErrorZPtr { result }
12041 let err = unsafe { o.contents.err };
12042 unsafe { o.contents.err = std::ptr::null_mut(); }
12043 CResult_OpenChannelDecodeErrorZPtr { err }
12047 result_ok: o.result_ok,
12051 impl Clone for CResult_OpenChannelDecodeErrorZ {
12052 fn clone(&self) -> Self {
12053 if self.result_ok {
12054 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
12055 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
12058 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
12059 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12065 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
12066 /// but with all dynamically-allocated buffers duplicated in new buffers.
12067 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
12069 /// The contents of CResult_RevokeAndACKDecodeErrorZ
12070 pub union CResult_RevokeAndACKDecodeErrorZPtr {
12071 /// A pointer to the contents in the success state.
12072 /// Reading from this pointer when `result_ok` is not set is undefined.
12073 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
12074 /// A pointer to the contents in the error state.
12075 /// Reading from this pointer when `result_ok` is set is undefined.
12076 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12079 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
12080 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
12081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12082 pub struct CResult_RevokeAndACKDecodeErrorZ {
12083 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
12084 /// `err` or `result` depending on the state of `result_ok`.
12085 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
12086 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
12087 pub result_ok: bool,
12090 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
12091 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
12092 CResult_RevokeAndACKDecodeErrorZ {
12093 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12094 result: Box::into_raw(Box::new(o)),
12100 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
12101 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
12102 CResult_RevokeAndACKDecodeErrorZ {
12103 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12104 err: Box::into_raw(Box::new(e)),
12109 /// Checks if the given object is currently in the success state
12111 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
12115 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
12116 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
12117 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
12118 fn drop(&mut self) {
12119 if self.result_ok {
12120 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12121 let _ = unsafe { Box::from_raw(self.contents.result) };
12124 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12125 let _ = unsafe { Box::from_raw(self.contents.err) };
12130 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
12131 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
12132 let contents = if o.result_ok {
12133 let result = unsafe { o.contents.result };
12134 unsafe { o.contents.result = std::ptr::null_mut() };
12135 CResult_RevokeAndACKDecodeErrorZPtr { result }
12137 let err = unsafe { o.contents.err };
12138 unsafe { o.contents.err = std::ptr::null_mut(); }
12139 CResult_RevokeAndACKDecodeErrorZPtr { err }
12143 result_ok: o.result_ok,
12147 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
12148 fn clone(&self) -> Self {
12149 if self.result_ok {
12150 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
12151 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
12154 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
12155 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12161 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
12162 /// but with all dynamically-allocated buffers duplicated in new buffers.
12163 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
12165 /// The contents of CResult_ShutdownDecodeErrorZ
12166 pub union CResult_ShutdownDecodeErrorZPtr {
12167 /// A pointer to the contents in the success state.
12168 /// Reading from this pointer when `result_ok` is not set is undefined.
12169 pub result: *mut crate::lightning::ln::msgs::Shutdown,
12170 /// A pointer to the contents in the error state.
12171 /// Reading from this pointer when `result_ok` is set is undefined.
12172 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12175 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
12176 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
12177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12178 pub struct CResult_ShutdownDecodeErrorZ {
12179 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
12180 /// `err` or `result` depending on the state of `result_ok`.
12181 pub contents: CResult_ShutdownDecodeErrorZPtr,
12182 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
12183 pub result_ok: bool,
12186 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
12187 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
12188 CResult_ShutdownDecodeErrorZ {
12189 contents: CResult_ShutdownDecodeErrorZPtr {
12190 result: Box::into_raw(Box::new(o)),
12196 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
12197 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
12198 CResult_ShutdownDecodeErrorZ {
12199 contents: CResult_ShutdownDecodeErrorZPtr {
12200 err: Box::into_raw(Box::new(e)),
12205 /// Checks if the given object is currently in the success state
12207 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
12211 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
12212 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
12213 impl Drop for CResult_ShutdownDecodeErrorZ {
12214 fn drop(&mut self) {
12215 if self.result_ok {
12216 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12217 let _ = unsafe { Box::from_raw(self.contents.result) };
12220 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12221 let _ = unsafe { Box::from_raw(self.contents.err) };
12226 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
12227 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
12228 let contents = if o.result_ok {
12229 let result = unsafe { o.contents.result };
12230 unsafe { o.contents.result = std::ptr::null_mut() };
12231 CResult_ShutdownDecodeErrorZPtr { result }
12233 let err = unsafe { o.contents.err };
12234 unsafe { o.contents.err = std::ptr::null_mut(); }
12235 CResult_ShutdownDecodeErrorZPtr { err }
12239 result_ok: o.result_ok,
12243 impl Clone for CResult_ShutdownDecodeErrorZ {
12244 fn clone(&self) -> Self {
12245 if self.result_ok {
12246 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
12247 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
12250 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
12251 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12257 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
12258 /// but with all dynamically-allocated buffers duplicated in new buffers.
12259 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
12261 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
12262 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
12263 /// A pointer to the contents in the success state.
12264 /// Reading from this pointer when `result_ok` is not set is undefined.
12265 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12266 /// A pointer to the contents in the error state.
12267 /// Reading from this pointer when `result_ok` is set is undefined.
12268 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12271 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
12272 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12274 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
12275 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
12276 /// `err` or `result` depending on the state of `result_ok`.
12277 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
12278 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
12279 pub result_ok: bool,
12282 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
12283 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
12284 CResult_UpdateFailHTLCDecodeErrorZ {
12285 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12286 result: Box::into_raw(Box::new(o)),
12292 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
12293 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
12294 CResult_UpdateFailHTLCDecodeErrorZ {
12295 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12296 err: Box::into_raw(Box::new(e)),
12301 /// Checks if the given object is currently in the success state
12303 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
12307 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
12308 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
12309 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
12310 fn drop(&mut self) {
12311 if self.result_ok {
12312 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12313 let _ = unsafe { Box::from_raw(self.contents.result) };
12316 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12317 let _ = unsafe { Box::from_raw(self.contents.err) };
12322 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
12323 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12324 let contents = if o.result_ok {
12325 let result = unsafe { o.contents.result };
12326 unsafe { o.contents.result = std::ptr::null_mut() };
12327 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
12329 let err = unsafe { o.contents.err };
12330 unsafe { o.contents.err = std::ptr::null_mut(); }
12331 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
12335 result_ok: o.result_ok,
12339 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
12340 fn clone(&self) -> Self {
12341 if self.result_ok {
12342 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12343 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
12346 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12347 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12353 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
12354 /// but with all dynamically-allocated buffers duplicated in new buffers.
12355 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
12357 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
12358 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12359 /// A pointer to the contents in the success state.
12360 /// Reading from this pointer when `result_ok` is not set is undefined.
12361 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12362 /// A pointer to the contents in the error state.
12363 /// Reading from this pointer when `result_ok` is set is undefined.
12364 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12367 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
12368 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12370 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12371 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
12372 /// `err` or `result` depending on the state of `result_ok`.
12373 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
12374 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
12375 pub result_ok: bool,
12378 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
12379 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12380 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12381 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12382 result: Box::into_raw(Box::new(o)),
12388 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
12389 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12390 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12391 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12392 err: Box::into_raw(Box::new(e)),
12397 /// Checks if the given object is currently in the success state
12399 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
12403 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
12404 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
12405 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12406 fn drop(&mut self) {
12407 if self.result_ok {
12408 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12409 let _ = unsafe { Box::from_raw(self.contents.result) };
12412 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12413 let _ = unsafe { Box::from_raw(self.contents.err) };
12418 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12419 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12420 let contents = if o.result_ok {
12421 let result = unsafe { o.contents.result };
12422 unsafe { o.contents.result = std::ptr::null_mut() };
12423 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
12425 let err = unsafe { o.contents.err };
12426 unsafe { o.contents.err = std::ptr::null_mut(); }
12427 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
12431 result_ok: o.result_ok,
12435 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12436 fn clone(&self) -> Self {
12437 if self.result_ok {
12438 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12439 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
12442 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12443 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12449 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
12450 /// but with all dynamically-allocated buffers duplicated in new buffers.
12451 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
12453 /// The contents of CResult_UpdateFeeDecodeErrorZ
12454 pub union CResult_UpdateFeeDecodeErrorZPtr {
12455 /// A pointer to the contents in the success state.
12456 /// Reading from this pointer when `result_ok` is not set is undefined.
12457 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
12458 /// A pointer to the contents in the error state.
12459 /// Reading from this pointer when `result_ok` is set is undefined.
12460 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12463 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
12464 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
12465 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12466 pub struct CResult_UpdateFeeDecodeErrorZ {
12467 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
12468 /// `err` or `result` depending on the state of `result_ok`.
12469 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
12470 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
12471 pub result_ok: bool,
12474 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
12475 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
12476 CResult_UpdateFeeDecodeErrorZ {
12477 contents: CResult_UpdateFeeDecodeErrorZPtr {
12478 result: Box::into_raw(Box::new(o)),
12484 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
12485 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
12486 CResult_UpdateFeeDecodeErrorZ {
12487 contents: CResult_UpdateFeeDecodeErrorZPtr {
12488 err: Box::into_raw(Box::new(e)),
12493 /// Checks if the given object is currently in the success state
12495 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
12499 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
12500 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
12501 impl Drop for CResult_UpdateFeeDecodeErrorZ {
12502 fn drop(&mut self) {
12503 if self.result_ok {
12504 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12505 let _ = unsafe { Box::from_raw(self.contents.result) };
12508 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12509 let _ = unsafe { Box::from_raw(self.contents.err) };
12514 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
12515 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
12516 let contents = if o.result_ok {
12517 let result = unsafe { o.contents.result };
12518 unsafe { o.contents.result = std::ptr::null_mut() };
12519 CResult_UpdateFeeDecodeErrorZPtr { result }
12521 let err = unsafe { o.contents.err };
12522 unsafe { o.contents.err = std::ptr::null_mut(); }
12523 CResult_UpdateFeeDecodeErrorZPtr { err }
12527 result_ok: o.result_ok,
12531 impl Clone for CResult_UpdateFeeDecodeErrorZ {
12532 fn clone(&self) -> Self {
12533 if self.result_ok {
12534 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
12535 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
12538 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
12539 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12545 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
12546 /// but with all dynamically-allocated buffers duplicated in new buffers.
12547 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
12549 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
12550 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12551 /// A pointer to the contents in the success state.
12552 /// Reading from this pointer when `result_ok` is not set is undefined.
12553 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12554 /// A pointer to the contents in the error state.
12555 /// Reading from this pointer when `result_ok` is set is undefined.
12556 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12559 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
12560 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12561 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12562 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
12563 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
12564 /// `err` or `result` depending on the state of `result_ok`.
12565 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
12566 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
12567 pub result_ok: bool,
12570 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
12571 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12572 CResult_UpdateFulfillHTLCDecodeErrorZ {
12573 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12574 result: Box::into_raw(Box::new(o)),
12580 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
12581 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12582 CResult_UpdateFulfillHTLCDecodeErrorZ {
12583 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12584 err: Box::into_raw(Box::new(e)),
12589 /// Checks if the given object is currently in the success state
12591 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
12595 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
12596 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
12597 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
12598 fn drop(&mut self) {
12599 if self.result_ok {
12600 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12601 let _ = unsafe { Box::from_raw(self.contents.result) };
12604 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12605 let _ = unsafe { Box::from_raw(self.contents.err) };
12610 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
12611 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12612 let contents = if o.result_ok {
12613 let result = unsafe { o.contents.result };
12614 unsafe { o.contents.result = std::ptr::null_mut() };
12615 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
12617 let err = unsafe { o.contents.err };
12618 unsafe { o.contents.err = std::ptr::null_mut(); }
12619 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
12623 result_ok: o.result_ok,
12627 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
12628 fn clone(&self) -> Self {
12629 if self.result_ok {
12630 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12631 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
12634 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12635 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12641 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
12642 /// but with all dynamically-allocated buffers duplicated in new buffers.
12643 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
12645 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
12646 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
12647 /// A pointer to the contents in the success state.
12648 /// Reading from this pointer when `result_ok` is not set is undefined.
12649 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12650 /// A pointer to the contents in the error state.
12651 /// Reading from this pointer when `result_ok` is set is undefined.
12652 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12655 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
12656 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12658 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
12659 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
12660 /// `err` or `result` depending on the state of `result_ok`.
12661 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
12662 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
12663 pub result_ok: bool,
12666 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
12667 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
12668 CResult_UpdateAddHTLCDecodeErrorZ {
12669 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12670 result: Box::into_raw(Box::new(o)),
12676 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
12677 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
12678 CResult_UpdateAddHTLCDecodeErrorZ {
12679 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12680 err: Box::into_raw(Box::new(e)),
12685 /// Checks if the given object is currently in the success state
12687 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
12691 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
12692 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
12693 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
12694 fn drop(&mut self) {
12695 if self.result_ok {
12696 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12697 let _ = unsafe { Box::from_raw(self.contents.result) };
12700 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12701 let _ = unsafe { Box::from_raw(self.contents.err) };
12706 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
12707 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12708 let contents = if o.result_ok {
12709 let result = unsafe { o.contents.result };
12710 unsafe { o.contents.result = std::ptr::null_mut() };
12711 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
12713 let err = unsafe { o.contents.err };
12714 unsafe { o.contents.err = std::ptr::null_mut(); }
12715 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
12719 result_ok: o.result_ok,
12723 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
12724 fn clone(&self) -> Self {
12725 if self.result_ok {
12726 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12727 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
12730 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12731 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12737 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
12738 /// but with all dynamically-allocated buffers duplicated in new buffers.
12739 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
12741 /// The contents of CResult_PingDecodeErrorZ
12742 pub union CResult_PingDecodeErrorZPtr {
12743 /// A pointer to the contents in the success state.
12744 /// Reading from this pointer when `result_ok` is not set is undefined.
12745 pub result: *mut crate::lightning::ln::msgs::Ping,
12746 /// A pointer to the contents in the error state.
12747 /// Reading from this pointer when `result_ok` is set is undefined.
12748 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12751 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
12752 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
12753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12754 pub struct CResult_PingDecodeErrorZ {
12755 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
12756 /// `err` or `result` depending on the state of `result_ok`.
12757 pub contents: CResult_PingDecodeErrorZPtr,
12758 /// Whether this CResult_PingDecodeErrorZ represents a success state.
12759 pub result_ok: bool,
12762 /// Creates a new CResult_PingDecodeErrorZ in the success state.
12763 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
12764 CResult_PingDecodeErrorZ {
12765 contents: CResult_PingDecodeErrorZPtr {
12766 result: Box::into_raw(Box::new(o)),
12772 /// Creates a new CResult_PingDecodeErrorZ in the error state.
12773 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
12774 CResult_PingDecodeErrorZ {
12775 contents: CResult_PingDecodeErrorZPtr {
12776 err: Box::into_raw(Box::new(e)),
12781 /// Checks if the given object is currently in the success state
12783 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
12787 /// Frees any resources used by the CResult_PingDecodeErrorZ.
12788 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
12789 impl Drop for CResult_PingDecodeErrorZ {
12790 fn drop(&mut self) {
12791 if self.result_ok {
12792 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12793 let _ = unsafe { Box::from_raw(self.contents.result) };
12796 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12797 let _ = unsafe { Box::from_raw(self.contents.err) };
12802 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
12803 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
12804 let contents = if o.result_ok {
12805 let result = unsafe { o.contents.result };
12806 unsafe { o.contents.result = std::ptr::null_mut() };
12807 CResult_PingDecodeErrorZPtr { result }
12809 let err = unsafe { o.contents.err };
12810 unsafe { o.contents.err = std::ptr::null_mut(); }
12811 CResult_PingDecodeErrorZPtr { err }
12815 result_ok: o.result_ok,
12819 impl Clone for CResult_PingDecodeErrorZ {
12820 fn clone(&self) -> Self {
12821 if self.result_ok {
12822 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
12823 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
12826 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
12827 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12833 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
12834 /// but with all dynamically-allocated buffers duplicated in new buffers.
12835 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
12837 /// The contents of CResult_PongDecodeErrorZ
12838 pub union CResult_PongDecodeErrorZPtr {
12839 /// A pointer to the contents in the success state.
12840 /// Reading from this pointer when `result_ok` is not set is undefined.
12841 pub result: *mut crate::lightning::ln::msgs::Pong,
12842 /// A pointer to the contents in the error state.
12843 /// Reading from this pointer when `result_ok` is set is undefined.
12844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12847 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
12848 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
12849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12850 pub struct CResult_PongDecodeErrorZ {
12851 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
12852 /// `err` or `result` depending on the state of `result_ok`.
12853 pub contents: CResult_PongDecodeErrorZPtr,
12854 /// Whether this CResult_PongDecodeErrorZ represents a success state.
12855 pub result_ok: bool,
12858 /// Creates a new CResult_PongDecodeErrorZ in the success state.
12859 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
12860 CResult_PongDecodeErrorZ {
12861 contents: CResult_PongDecodeErrorZPtr {
12862 result: Box::into_raw(Box::new(o)),
12868 /// Creates a new CResult_PongDecodeErrorZ in the error state.
12869 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
12870 CResult_PongDecodeErrorZ {
12871 contents: CResult_PongDecodeErrorZPtr {
12872 err: Box::into_raw(Box::new(e)),
12877 /// Checks if the given object is currently in the success state
12879 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
12883 /// Frees any resources used by the CResult_PongDecodeErrorZ.
12884 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
12885 impl Drop for CResult_PongDecodeErrorZ {
12886 fn drop(&mut self) {
12887 if self.result_ok {
12888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12889 let _ = unsafe { Box::from_raw(self.contents.result) };
12892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12893 let _ = unsafe { Box::from_raw(self.contents.err) };
12898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
12899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
12900 let contents = if o.result_ok {
12901 let result = unsafe { o.contents.result };
12902 unsafe { o.contents.result = std::ptr::null_mut() };
12903 CResult_PongDecodeErrorZPtr { result }
12905 let err = unsafe { o.contents.err };
12906 unsafe { o.contents.err = std::ptr::null_mut(); }
12907 CResult_PongDecodeErrorZPtr { err }
12911 result_ok: o.result_ok,
12915 impl Clone for CResult_PongDecodeErrorZ {
12916 fn clone(&self) -> Self {
12917 if self.result_ok {
12918 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
12919 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
12922 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
12923 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12929 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
12930 /// but with all dynamically-allocated buffers duplicated in new buffers.
12931 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
12933 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
12934 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12935 /// A pointer to the contents in the success state.
12936 /// Reading from this pointer when `result_ok` is not set is undefined.
12937 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
12938 /// A pointer to the contents in the error state.
12939 /// Reading from this pointer when `result_ok` is set is undefined.
12940 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12943 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12944 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12946 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12947 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
12948 /// `err` or `result` depending on the state of `result_ok`.
12949 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
12950 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
12951 pub result_ok: bool,
12954 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
12955 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12956 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12957 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12958 result: Box::into_raw(Box::new(o)),
12964 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
12965 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12966 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12967 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12968 err: Box::into_raw(Box::new(e)),
12973 /// Checks if the given object is currently in the success state
12975 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
12979 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
12980 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
12981 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12982 fn drop(&mut self) {
12983 if self.result_ok {
12984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12985 let _ = unsafe { Box::from_raw(self.contents.result) };
12988 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12989 let _ = unsafe { Box::from_raw(self.contents.err) };
12994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12995 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12996 let contents = if o.result_ok {
12997 let result = unsafe { o.contents.result };
12998 unsafe { o.contents.result = std::ptr::null_mut() };
12999 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13001 let err = unsafe { o.contents.err };
13002 unsafe { o.contents.err = std::ptr::null_mut(); }
13003 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13007 result_ok: o.result_ok,
13011 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13012 fn clone(&self) -> Self {
13013 if self.result_ok {
13014 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13015 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13018 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13019 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13025 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13026 /// but with all dynamically-allocated buffers duplicated in new buffers.
13027 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13029 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13030 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13031 /// A pointer to the contents in the success state.
13032 /// Reading from this pointer when `result_ok` is not set is undefined.
13033 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13034 /// A pointer to the contents in the error state.
13035 /// Reading from this pointer when `result_ok` is set is undefined.
13036 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13039 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13040 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13041 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13042 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
13043 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
13044 /// `err` or `result` depending on the state of `result_ok`.
13045 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
13046 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
13047 pub result_ok: bool,
13050 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13051 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
13052 CResult_ChannelAnnouncementDecodeErrorZ {
13053 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13054 result: Box::into_raw(Box::new(o)),
13060 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13061 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
13062 CResult_ChannelAnnouncementDecodeErrorZ {
13063 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13064 err: Box::into_raw(Box::new(e)),
13069 /// Checks if the given object is currently in the success state
13071 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
13075 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13076 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
13077 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
13078 fn drop(&mut self) {
13079 if self.result_ok {
13080 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13081 let _ = unsafe { Box::from_raw(self.contents.result) };
13084 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13085 let _ = unsafe { Box::from_raw(self.contents.err) };
13090 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
13091 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13092 let contents = if o.result_ok {
13093 let result = unsafe { o.contents.result };
13094 unsafe { o.contents.result = std::ptr::null_mut() };
13095 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
13097 let err = unsafe { o.contents.err };
13098 unsafe { o.contents.err = std::ptr::null_mut(); }
13099 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
13103 result_ok: o.result_ok,
13107 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
13108 fn clone(&self) -> Self {
13109 if self.result_ok {
13110 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13111 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13114 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13115 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13121 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13122 /// but with all dynamically-allocated buffers duplicated in new buffers.
13123 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13125 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
13126 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13127 /// A pointer to the contents in the success state.
13128 /// Reading from this pointer when `result_ok` is not set is undefined.
13129 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
13130 /// A pointer to the contents in the error state.
13131 /// Reading from this pointer when `result_ok` is set is undefined.
13132 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13135 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13136 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13138 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
13139 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
13140 /// `err` or `result` depending on the state of `result_ok`.
13141 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
13142 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
13143 pub result_ok: bool,
13146 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13147 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
13148 CResult_UnsignedChannelUpdateDecodeErrorZ {
13149 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13150 result: Box::into_raw(Box::new(o)),
13156 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
13157 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
13158 CResult_UnsignedChannelUpdateDecodeErrorZ {
13159 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13160 err: Box::into_raw(Box::new(e)),
13165 /// Checks if the given object is currently in the success state
13167 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
13171 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
13172 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
13173 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
13174 fn drop(&mut self) {
13175 if self.result_ok {
13176 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13177 let _ = unsafe { Box::from_raw(self.contents.result) };
13180 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13181 let _ = unsafe { Box::from_raw(self.contents.err) };
13186 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
13187 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
13188 let contents = if o.result_ok {
13189 let result = unsafe { o.contents.result };
13190 unsafe { o.contents.result = std::ptr::null_mut() };
13191 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
13193 let err = unsafe { o.contents.err };
13194 unsafe { o.contents.err = std::ptr::null_mut(); }
13195 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
13199 result_ok: o.result_ok,
13203 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
13204 fn clone(&self) -> Self {
13205 if self.result_ok {
13206 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13207 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
13210 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13211 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13217 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
13218 /// but with all dynamically-allocated buffers duplicated in new buffers.
13219 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
13221 /// The contents of CResult_ChannelUpdateDecodeErrorZ
13222 pub union CResult_ChannelUpdateDecodeErrorZPtr {
13223 /// A pointer to the contents in the success state.
13224 /// Reading from this pointer when `result_ok` is not set is undefined.
13225 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
13226 /// A pointer to the contents in the error state.
13227 /// Reading from this pointer when `result_ok` is set is undefined.
13228 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13231 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13232 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13234 pub struct CResult_ChannelUpdateDecodeErrorZ {
13235 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
13236 /// `err` or `result` depending on the state of `result_ok`.
13237 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
13238 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
13239 pub result_ok: bool,
13242 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
13243 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
13244 CResult_ChannelUpdateDecodeErrorZ {
13245 contents: CResult_ChannelUpdateDecodeErrorZPtr {
13246 result: Box::into_raw(Box::new(o)),
13252 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
13253 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
13254 CResult_ChannelUpdateDecodeErrorZ {
13255 contents: CResult_ChannelUpdateDecodeErrorZPtr {
13256 err: Box::into_raw(Box::new(e)),
13261 /// Checks if the given object is currently in the success state
13263 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
13267 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
13268 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
13269 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
13270 fn drop(&mut self) {
13271 if self.result_ok {
13272 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13273 let _ = unsafe { Box::from_raw(self.contents.result) };
13276 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13277 let _ = unsafe { Box::from_raw(self.contents.err) };
13282 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
13283 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
13284 let contents = if o.result_ok {
13285 let result = unsafe { o.contents.result };
13286 unsafe { o.contents.result = std::ptr::null_mut() };
13287 CResult_ChannelUpdateDecodeErrorZPtr { result }
13289 let err = unsafe { o.contents.err };
13290 unsafe { o.contents.err = std::ptr::null_mut(); }
13291 CResult_ChannelUpdateDecodeErrorZPtr { err }
13295 result_ok: o.result_ok,
13299 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
13300 fn clone(&self) -> Self {
13301 if self.result_ok {
13302 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
13303 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
13306 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
13307 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13313 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
13314 /// but with all dynamically-allocated buffers duplicated in new buffers.
13315 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
13317 /// The contents of CResult_ErrorMessageDecodeErrorZ
13318 pub union CResult_ErrorMessageDecodeErrorZPtr {
13319 /// A pointer to the contents in the success state.
13320 /// Reading from this pointer when `result_ok` is not set is undefined.
13321 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
13322 /// A pointer to the contents in the error state.
13323 /// Reading from this pointer when `result_ok` is set is undefined.
13324 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13327 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
13328 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
13329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13330 pub struct CResult_ErrorMessageDecodeErrorZ {
13331 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
13332 /// `err` or `result` depending on the state of `result_ok`.
13333 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
13334 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
13335 pub result_ok: bool,
13338 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
13339 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
13340 CResult_ErrorMessageDecodeErrorZ {
13341 contents: CResult_ErrorMessageDecodeErrorZPtr {
13342 result: Box::into_raw(Box::new(o)),
13348 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
13349 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
13350 CResult_ErrorMessageDecodeErrorZ {
13351 contents: CResult_ErrorMessageDecodeErrorZPtr {
13352 err: Box::into_raw(Box::new(e)),
13357 /// Checks if the given object is currently in the success state
13359 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
13363 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
13364 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
13365 impl Drop for CResult_ErrorMessageDecodeErrorZ {
13366 fn drop(&mut self) {
13367 if self.result_ok {
13368 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13369 let _ = unsafe { Box::from_raw(self.contents.result) };
13372 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13373 let _ = unsafe { Box::from_raw(self.contents.err) };
13378 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
13379 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
13380 let contents = if o.result_ok {
13381 let result = unsafe { o.contents.result };
13382 unsafe { o.contents.result = std::ptr::null_mut() };
13383 CResult_ErrorMessageDecodeErrorZPtr { result }
13385 let err = unsafe { o.contents.err };
13386 unsafe { o.contents.err = std::ptr::null_mut(); }
13387 CResult_ErrorMessageDecodeErrorZPtr { err }
13391 result_ok: o.result_ok,
13395 impl Clone for CResult_ErrorMessageDecodeErrorZ {
13396 fn clone(&self) -> Self {
13397 if self.result_ok {
13398 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
13399 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
13402 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
13403 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13409 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13410 /// but with all dynamically-allocated buffers duplicated in new buffers.
13411 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
13413 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
13414 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13415 /// A pointer to the contents in the success state.
13416 /// Reading from this pointer when `result_ok` is not set is undefined.
13417 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
13418 /// A pointer to the contents in the error state.
13419 /// Reading from this pointer when `result_ok` is set is undefined.
13420 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13423 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13424 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13426 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13427 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
13428 /// `err` or `result` depending on the state of `result_ok`.
13429 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
13430 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
13431 pub result_ok: bool,
13434 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13435 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13436 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13437 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13438 result: Box::into_raw(Box::new(o)),
13444 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13445 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13446 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13447 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13448 err: Box::into_raw(Box::new(e)),
13453 /// Checks if the given object is currently in the success state
13455 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
13459 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13460 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
13461 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13462 fn drop(&mut self) {
13463 if self.result_ok {
13464 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13465 let _ = unsafe { Box::from_raw(self.contents.result) };
13468 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13469 let _ = unsafe { Box::from_raw(self.contents.err) };
13474 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13475 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13476 let contents = if o.result_ok {
13477 let result = unsafe { o.contents.result };
13478 unsafe { o.contents.result = std::ptr::null_mut() };
13479 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
13481 let err = unsafe { o.contents.err };
13482 unsafe { o.contents.err = std::ptr::null_mut(); }
13483 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
13487 result_ok: o.result_ok,
13491 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13492 fn clone(&self) -> Self {
13493 if self.result_ok {
13494 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13495 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13498 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13499 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13505 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13506 /// but with all dynamically-allocated buffers duplicated in new buffers.
13507 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13509 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
13510 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
13511 /// A pointer to the contents in the success state.
13512 /// Reading from this pointer when `result_ok` is not set is undefined.
13513 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
13514 /// A pointer to the contents in the error state.
13515 /// Reading from this pointer when `result_ok` is set is undefined.
13516 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13519 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13520 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13522 pub struct CResult_NodeAnnouncementDecodeErrorZ {
13523 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
13524 /// `err` or `result` depending on the state of `result_ok`.
13525 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
13526 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
13527 pub result_ok: bool,
13530 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13531 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
13532 CResult_NodeAnnouncementDecodeErrorZ {
13533 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13534 result: Box::into_raw(Box::new(o)),
13540 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13541 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
13542 CResult_NodeAnnouncementDecodeErrorZ {
13543 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13544 err: Box::into_raw(Box::new(e)),
13549 /// Checks if the given object is currently in the success state
13551 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
13555 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13556 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
13557 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
13558 fn drop(&mut self) {
13559 if self.result_ok {
13560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13561 let _ = unsafe { Box::from_raw(self.contents.result) };
13564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13565 let _ = unsafe { Box::from_raw(self.contents.err) };
13570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
13571 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13572 let contents = if o.result_ok {
13573 let result = unsafe { o.contents.result };
13574 unsafe { o.contents.result = std::ptr::null_mut() };
13575 CResult_NodeAnnouncementDecodeErrorZPtr { result }
13577 let err = unsafe { o.contents.err };
13578 unsafe { o.contents.err = std::ptr::null_mut(); }
13579 CResult_NodeAnnouncementDecodeErrorZPtr { err }
13583 result_ok: o.result_ok,
13587 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
13588 fn clone(&self) -> Self {
13589 if self.result_ok {
13590 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13591 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13594 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13595 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13601 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13602 /// but with all dynamically-allocated buffers duplicated in new buffers.
13603 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13605 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
13606 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
13607 /// A pointer to the contents in the success state.
13608 /// Reading from this pointer when `result_ok` is not set is undefined.
13609 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
13610 /// A pointer to the contents in the error state.
13611 /// Reading from this pointer when `result_ok` is set is undefined.
13612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13615 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
13616 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
13617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13618 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
13619 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
13620 /// `err` or `result` depending on the state of `result_ok`.
13621 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
13622 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
13623 pub result_ok: bool,
13626 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13627 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13628 CResult_QueryShortChannelIdsDecodeErrorZ {
13629 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13630 result: Box::into_raw(Box::new(o)),
13636 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13637 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13638 CResult_QueryShortChannelIdsDecodeErrorZ {
13639 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13640 err: Box::into_raw(Box::new(e)),
13645 /// Checks if the given object is currently in the success state
13647 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
13651 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13652 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
13653 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
13654 fn drop(&mut self) {
13655 if self.result_ok {
13656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13657 let _ = unsafe { Box::from_raw(self.contents.result) };
13660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13661 let _ = unsafe { Box::from_raw(self.contents.err) };
13666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
13667 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
13668 let contents = if o.result_ok {
13669 let result = unsafe { o.contents.result };
13670 unsafe { o.contents.result = std::ptr::null_mut() };
13671 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
13673 let err = unsafe { o.contents.err };
13674 unsafe { o.contents.err = std::ptr::null_mut(); }
13675 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
13679 result_ok: o.result_ok,
13683 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
13684 fn clone(&self) -> Self {
13685 if self.result_ok {
13686 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13687 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
13690 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13697 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13698 /// but with all dynamically-allocated buffers duplicated in new buffers.
13699 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
13701 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
13702 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13703 /// A pointer to the contents in the success state.
13704 /// Reading from this pointer when `result_ok` is not set is undefined.
13705 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
13706 /// A pointer to the contents in the error state.
13707 /// Reading from this pointer when `result_ok` is set is undefined.
13708 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13711 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
13712 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
13713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13714 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13715 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
13716 /// `err` or `result` depending on the state of `result_ok`.
13717 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
13718 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
13719 pub result_ok: bool,
13722 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13723 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13724 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13725 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13726 result: Box::into_raw(Box::new(o)),
13732 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13733 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13734 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13735 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13736 err: Box::into_raw(Box::new(e)),
13741 /// Checks if the given object is currently in the success state
13743 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
13747 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13748 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
13749 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13750 fn drop(&mut self) {
13751 if self.result_ok {
13752 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13753 let _ = unsafe { Box::from_raw(self.contents.result) };
13756 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13757 let _ = unsafe { Box::from_raw(self.contents.err) };
13762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13763 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
13764 let contents = if o.result_ok {
13765 let result = unsafe { o.contents.result };
13766 unsafe { o.contents.result = std::ptr::null_mut() };
13767 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
13769 let err = unsafe { o.contents.err };
13770 unsafe { o.contents.err = std::ptr::null_mut(); }
13771 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
13775 result_ok: o.result_ok,
13779 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13780 fn clone(&self) -> Self {
13781 if self.result_ok {
13782 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13783 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
13786 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13787 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13793 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13794 /// but with all dynamically-allocated buffers duplicated in new buffers.
13795 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
13797 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
13798 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
13799 /// A pointer to the contents in the success state.
13800 /// Reading from this pointer when `result_ok` is not set is undefined.
13801 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
13802 /// A pointer to the contents in the error state.
13803 /// Reading from this pointer when `result_ok` is set is undefined.
13804 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13807 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
13808 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13809 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13810 pub struct CResult_QueryChannelRangeDecodeErrorZ {
13811 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
13812 /// `err` or `result` depending on the state of `result_ok`.
13813 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
13814 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
13815 pub result_ok: bool,
13818 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13819 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
13820 CResult_QueryChannelRangeDecodeErrorZ {
13821 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13822 result: Box::into_raw(Box::new(o)),
13828 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13829 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
13830 CResult_QueryChannelRangeDecodeErrorZ {
13831 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13832 err: Box::into_raw(Box::new(e)),
13837 /// Checks if the given object is currently in the success state
13839 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
13843 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13844 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
13845 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
13846 fn drop(&mut self) {
13847 if self.result_ok {
13848 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13849 let _ = unsafe { Box::from_raw(self.contents.result) };
13852 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13853 let _ = unsafe { Box::from_raw(self.contents.err) };
13858 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
13859 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13860 let contents = if o.result_ok {
13861 let result = unsafe { o.contents.result };
13862 unsafe { o.contents.result = std::ptr::null_mut() };
13863 CResult_QueryChannelRangeDecodeErrorZPtr { result }
13865 let err = unsafe { o.contents.err };
13866 unsafe { o.contents.err = std::ptr::null_mut(); }
13867 CResult_QueryChannelRangeDecodeErrorZPtr { err }
13871 result_ok: o.result_ok,
13875 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
13876 fn clone(&self) -> Self {
13877 if self.result_ok {
13878 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13879 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
13882 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13883 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13889 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13890 /// but with all dynamically-allocated buffers duplicated in new buffers.
13891 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13893 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
13894 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
13895 /// A pointer to the contents in the success state.
13896 /// Reading from this pointer when `result_ok` is not set is undefined.
13897 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
13898 /// A pointer to the contents in the error state.
13899 /// Reading from this pointer when `result_ok` is set is undefined.
13900 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13903 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
13904 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13906 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
13907 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
13908 /// `err` or `result` depending on the state of `result_ok`.
13909 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
13910 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
13911 pub result_ok: bool,
13914 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13915 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
13916 CResult_ReplyChannelRangeDecodeErrorZ {
13917 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13918 result: Box::into_raw(Box::new(o)),
13924 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13925 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
13926 CResult_ReplyChannelRangeDecodeErrorZ {
13927 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13928 err: Box::into_raw(Box::new(e)),
13933 /// Checks if the given object is currently in the success state
13935 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
13939 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13940 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
13941 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
13942 fn drop(&mut self) {
13943 if self.result_ok {
13944 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13945 let _ = unsafe { Box::from_raw(self.contents.result) };
13948 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13949 let _ = unsafe { Box::from_raw(self.contents.err) };
13954 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
13955 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13956 let contents = if o.result_ok {
13957 let result = unsafe { o.contents.result };
13958 unsafe { o.contents.result = std::ptr::null_mut() };
13959 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
13961 let err = unsafe { o.contents.err };
13962 unsafe { o.contents.err = std::ptr::null_mut(); }
13963 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
13967 result_ok: o.result_ok,
13971 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
13972 fn clone(&self) -> Self {
13973 if self.result_ok {
13974 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13975 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
13978 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13979 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13985 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13986 /// but with all dynamically-allocated buffers duplicated in new buffers.
13987 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13989 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
13990 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
13991 /// A pointer to the contents in the success state.
13992 /// Reading from this pointer when `result_ok` is not set is undefined.
13993 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
13994 /// A pointer to the contents in the error state.
13995 /// Reading from this pointer when `result_ok` is set is undefined.
13996 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13999 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
14000 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
14001 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14002 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
14003 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
14004 /// `err` or `result` depending on the state of `result_ok`.
14005 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
14006 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
14007 pub result_ok: bool,
14010 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
14011 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
14012 CResult_GossipTimestampFilterDecodeErrorZ {
14013 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14014 result: Box::into_raw(Box::new(o)),
14020 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
14021 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
14022 CResult_GossipTimestampFilterDecodeErrorZ {
14023 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14024 err: Box::into_raw(Box::new(e)),
14029 /// Checks if the given object is currently in the success state
14031 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
14035 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
14036 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
14037 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
14038 fn drop(&mut self) {
14039 if self.result_ok {
14040 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14041 let _ = unsafe { Box::from_raw(self.contents.result) };
14044 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14045 let _ = unsafe { Box::from_raw(self.contents.err) };
14050 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
14051 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
14052 let contents = if o.result_ok {
14053 let result = unsafe { o.contents.result };
14054 unsafe { o.contents.result = std::ptr::null_mut() };
14055 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
14057 let err = unsafe { o.contents.err };
14058 unsafe { o.contents.err = std::ptr::null_mut(); }
14059 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
14063 result_ok: o.result_ok,
14067 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
14068 fn clone(&self) -> Self {
14069 if self.result_ok {
14070 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14071 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
14074 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14075 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14081 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
14082 /// but with all dynamically-allocated buffers duplicated in new buffers.
14083 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
14085 /// The contents of CResult_InvoiceSignOrCreationErrorZ
14086 pub union CResult_InvoiceSignOrCreationErrorZPtr {
14087 /// A pointer to the contents in the success state.
14088 /// Reading from this pointer when `result_ok` is not set is undefined.
14089 pub result: *mut crate::lightning_invoice::Invoice,
14090 /// A pointer to the contents in the error state.
14091 /// Reading from this pointer when `result_ok` is set is undefined.
14092 pub err: *mut crate::lightning_invoice::SignOrCreationError,
14095 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
14096 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
14097 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14098 pub struct CResult_InvoiceSignOrCreationErrorZ {
14099 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
14100 /// `err` or `result` depending on the state of `result_ok`.
14101 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
14102 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
14103 pub result_ok: bool,
14106 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
14107 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
14108 CResult_InvoiceSignOrCreationErrorZ {
14109 contents: CResult_InvoiceSignOrCreationErrorZPtr {
14110 result: Box::into_raw(Box::new(o)),
14116 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
14117 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
14118 CResult_InvoiceSignOrCreationErrorZ {
14119 contents: CResult_InvoiceSignOrCreationErrorZPtr {
14120 err: Box::into_raw(Box::new(e)),
14125 /// Checks if the given object is currently in the success state
14127 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
14131 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
14132 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
14133 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
14134 fn drop(&mut self) {
14135 if self.result_ok {
14136 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14137 let _ = unsafe { Box::from_raw(self.contents.result) };
14140 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14141 let _ = unsafe { Box::from_raw(self.contents.err) };
14146 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
14147 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
14148 let contents = if o.result_ok {
14149 let result = unsafe { o.contents.result };
14150 unsafe { o.contents.result = std::ptr::null_mut() };
14151 CResult_InvoiceSignOrCreationErrorZPtr { result }
14153 let err = unsafe { o.contents.err };
14154 unsafe { o.contents.err = std::ptr::null_mut(); }
14155 CResult_InvoiceSignOrCreationErrorZPtr { err }
14159 result_ok: o.result_ok,
14163 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
14164 fn clone(&self) -> Self {
14165 if self.result_ok {
14166 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
14167 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
14170 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
14171 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
14177 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
14178 /// but with all dynamically-allocated buffers duplicated in new buffers.
14179 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
14181 /// An enum which can either contain a crate::lightning::chain::Filter or not
14182 pub enum COption_FilterZ {
14183 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
14184 Some(crate::lightning::chain::Filter),
14185 /// When we're in this state, this COption_FilterZ contains nothing
14188 impl COption_FilterZ {
14189 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
14190 if let Self::None = self { false } else { true }
14192 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
14195 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
14196 if let Self::Some(v) = self { v } else { unreachable!() }
14200 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
14201 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
14202 COption_FilterZ::Some(o)
14205 /// Constructs a new COption_FilterZ containing nothing
14206 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
14207 COption_FilterZ::None
14210 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
14211 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
14213 /// The contents of CResult_LockedChannelMonitorNoneZ
14214 pub union CResult_LockedChannelMonitorNoneZPtr {
14215 /// A pointer to the contents in the success state.
14216 /// Reading from this pointer when `result_ok` is not set is undefined.
14217 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
14218 /// Note that this value is always NULL, as there are no contents in the Err variant
14219 pub err: *mut std::ffi::c_void,
14222 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
14223 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
14224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14225 pub struct CResult_LockedChannelMonitorNoneZ {
14226 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
14227 /// `err` or `result` depending on the state of `result_ok`.
14228 pub contents: CResult_LockedChannelMonitorNoneZPtr,
14229 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
14230 pub result_ok: bool,
14233 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
14234 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
14235 CResult_LockedChannelMonitorNoneZ {
14236 contents: CResult_LockedChannelMonitorNoneZPtr {
14237 result: Box::into_raw(Box::new(o)),
14243 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
14244 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
14245 CResult_LockedChannelMonitorNoneZ {
14246 contents: CResult_LockedChannelMonitorNoneZPtr {
14247 err: std::ptr::null_mut(),
14252 /// Checks if the given object is currently in the success state
14254 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
14258 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
14259 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
14260 impl Drop for CResult_LockedChannelMonitorNoneZ {
14261 fn drop(&mut self) {
14262 if self.result_ok {
14263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14264 let _ = unsafe { Box::from_raw(self.contents.result) };
14270 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
14271 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
14272 let contents = if o.result_ok {
14273 let result = unsafe { o.contents.result };
14274 unsafe { o.contents.result = std::ptr::null_mut() };
14275 CResult_LockedChannelMonitorNoneZPtr { result }
14277 let _ = unsafe { Box::from_raw(o.contents.err) };
14278 o.contents.err = std::ptr::null_mut();
14279 CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
14283 result_ok: o.result_ok,
14288 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
14289 /// This corresponds to std::vector in C++
14290 pub struct CVec_OutPointZ {
14291 /// The elements in the array.
14292 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14293 pub data: *mut crate::lightning::chain::transaction::OutPoint,
14294 /// The number of elements pointed to by `data`.
14297 impl CVec_OutPointZ {
14298 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
14299 if self.datalen == 0 { return Vec::new(); }
14300 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14301 self.data = std::ptr::null_mut();
14305 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
14306 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
14309 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
14310 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
14311 let datalen = v.len();
14312 let data = Box::into_raw(v.into_boxed_slice());
14313 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14317 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14318 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
14319 impl Drop for CVec_OutPointZ {
14320 fn drop(&mut self) {
14321 if self.datalen == 0 { return; }
14322 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
14325 impl Clone for CVec_OutPointZ {
14326 fn clone(&self) -> Self {
14327 let mut res = Vec::new();
14328 if self.datalen == 0 { return Self::from(res); }
14329 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });