2 use alloc::str::FromStr;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
11 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
12 /// This corresponds to std::vector in C++
13 pub struct CVec_PublicKeyZ {
14 /// The elements in the array.
15 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16 pub data: *mut crate::c_types::PublicKey,
17 /// The number of elements pointed to by `data`.
20 impl CVec_PublicKeyZ {
21 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
22 if self.datalen == 0 { return Vec::new(); }
23 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
24 self.data = core::ptr::null_mut();
28 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
29 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
32 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
33 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
34 let datalen = v.len();
35 let data = Box::into_raw(v.into_boxed_slice());
36 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
40 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
41 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
42 impl Drop for CVec_PublicKeyZ {
44 if self.datalen == 0 { return; }
45 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
48 impl Clone for CVec_PublicKeyZ {
49 fn clone(&self) -> Self {
50 let mut res = Vec::new();
51 if self.datalen == 0 { return Self::from(res); }
52 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
57 /// The contents of CResult_BlindedRouteNoneZ
58 pub union CResult_BlindedRouteNoneZPtr {
59 /// A pointer to the contents in the success state.
60 /// Reading from this pointer when `result_ok` is not set is undefined.
61 pub result: *mut crate::lightning::onion_message::blinded_route::BlindedRoute,
62 /// Note that this value is always NULL, as there are no contents in the Err variant
63 pub err: *mut core::ffi::c_void,
66 /// A CResult_BlindedRouteNoneZ represents the result of a fallible operation,
67 /// containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a () on failure.
68 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
69 pub struct CResult_BlindedRouteNoneZ {
70 /// The contents of this CResult_BlindedRouteNoneZ, accessible via either
71 /// `err` or `result` depending on the state of `result_ok`.
72 pub contents: CResult_BlindedRouteNoneZPtr,
73 /// Whether this CResult_BlindedRouteNoneZ represents a success state.
77 /// Creates a new CResult_BlindedRouteNoneZ in the success state.
78 pub extern "C" fn CResult_BlindedRouteNoneZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedRoute) -> CResult_BlindedRouteNoneZ {
79 CResult_BlindedRouteNoneZ {
80 contents: CResult_BlindedRouteNoneZPtr {
81 result: Box::into_raw(Box::new(o)),
87 /// Creates a new CResult_BlindedRouteNoneZ in the error state.
88 pub extern "C" fn CResult_BlindedRouteNoneZ_err() -> CResult_BlindedRouteNoneZ {
89 CResult_BlindedRouteNoneZ {
90 contents: CResult_BlindedRouteNoneZPtr {
91 err: core::ptr::null_mut(),
96 /// Checks if the given object is currently in the success state
98 pub extern "C" fn CResult_BlindedRouteNoneZ_is_ok(o: &CResult_BlindedRouteNoneZ) -> bool {
102 /// Frees any resources used by the CResult_BlindedRouteNoneZ.
103 pub extern "C" fn CResult_BlindedRouteNoneZ_free(_res: CResult_BlindedRouteNoneZ) { }
104 impl Drop for CResult_BlindedRouteNoneZ {
107 if unsafe { !(self.contents.result as *mut ()).is_null() } {
108 let _ = unsafe { Box::from_raw(self.contents.result) };
114 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedRoute, ()>> for CResult_BlindedRouteNoneZ {
115 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedRoute, ()>) -> Self {
116 let contents = if o.result_ok {
117 let result = unsafe { o.contents.result };
118 unsafe { o.contents.result = core::ptr::null_mut() };
119 CResult_BlindedRouteNoneZPtr { result }
121 let _ = unsafe { Box::from_raw(o.contents.err) };
122 o.contents.err = core::ptr::null_mut();
123 CResult_BlindedRouteNoneZPtr { err: core::ptr::null_mut() }
127 result_ok: o.result_ok,
132 /// The contents of CResult_BlindedRouteDecodeErrorZ
133 pub union CResult_BlindedRouteDecodeErrorZPtr {
134 /// A pointer to the contents in the success state.
135 /// Reading from this pointer when `result_ok` is not set is undefined.
136 pub result: *mut crate::lightning::onion_message::blinded_route::BlindedRoute,
137 /// A pointer to the contents in the error state.
138 /// Reading from this pointer when `result_ok` is set is undefined.
139 pub err: *mut crate::lightning::ln::msgs::DecodeError,
142 /// A CResult_BlindedRouteDecodeErrorZ represents the result of a fallible operation,
143 /// containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a crate::lightning::ln::msgs::DecodeError on failure.
144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
145 pub struct CResult_BlindedRouteDecodeErrorZ {
146 /// The contents of this CResult_BlindedRouteDecodeErrorZ, accessible via either
147 /// `err` or `result` depending on the state of `result_ok`.
148 pub contents: CResult_BlindedRouteDecodeErrorZPtr,
149 /// Whether this CResult_BlindedRouteDecodeErrorZ represents a success state.
153 /// Creates a new CResult_BlindedRouteDecodeErrorZ in the success state.
154 pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedRoute) -> CResult_BlindedRouteDecodeErrorZ {
155 CResult_BlindedRouteDecodeErrorZ {
156 contents: CResult_BlindedRouteDecodeErrorZPtr {
157 result: Box::into_raw(Box::new(o)),
163 /// Creates a new CResult_BlindedRouteDecodeErrorZ in the error state.
164 pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedRouteDecodeErrorZ {
165 CResult_BlindedRouteDecodeErrorZ {
166 contents: CResult_BlindedRouteDecodeErrorZPtr {
167 err: Box::into_raw(Box::new(e)),
172 /// Checks if the given object is currently in the success state
174 pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_is_ok(o: &CResult_BlindedRouteDecodeErrorZ) -> bool {
178 /// Frees any resources used by the CResult_BlindedRouteDecodeErrorZ.
179 pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_free(_res: CResult_BlindedRouteDecodeErrorZ) { }
180 impl Drop for CResult_BlindedRouteDecodeErrorZ {
183 if unsafe { !(self.contents.result as *mut ()).is_null() } {
184 let _ = unsafe { Box::from_raw(self.contents.result) };
187 if unsafe { !(self.contents.err as *mut ()).is_null() } {
188 let _ = unsafe { Box::from_raw(self.contents.err) };
193 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedRoute, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedRouteDecodeErrorZ {
194 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedRoute, crate::lightning::ln::msgs::DecodeError>) -> Self {
195 let contents = if o.result_ok {
196 let result = unsafe { o.contents.result };
197 unsafe { o.contents.result = core::ptr::null_mut() };
198 CResult_BlindedRouteDecodeErrorZPtr { result }
200 let err = unsafe { o.contents.err };
201 unsafe { o.contents.err = core::ptr::null_mut(); }
202 CResult_BlindedRouteDecodeErrorZPtr { err }
206 result_ok: o.result_ok,
211 /// The contents of CResult_BlindedHopDecodeErrorZ
212 pub union CResult_BlindedHopDecodeErrorZPtr {
213 /// A pointer to the contents in the success state.
214 /// Reading from this pointer when `result_ok` is not set is undefined.
215 pub result: *mut crate::lightning::onion_message::blinded_route::BlindedHop,
216 /// A pointer to the contents in the error state.
217 /// Reading from this pointer when `result_ok` is set is undefined.
218 pub err: *mut crate::lightning::ln::msgs::DecodeError,
221 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
222 /// containing a crate::lightning::onion_message::blinded_route::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
223 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
224 pub struct CResult_BlindedHopDecodeErrorZ {
225 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
226 /// `err` or `result` depending on the state of `result_ok`.
227 pub contents: CResult_BlindedHopDecodeErrorZPtr,
228 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
232 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
233 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
234 CResult_BlindedHopDecodeErrorZ {
235 contents: CResult_BlindedHopDecodeErrorZPtr {
236 result: Box::into_raw(Box::new(o)),
242 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
243 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
244 CResult_BlindedHopDecodeErrorZ {
245 contents: CResult_BlindedHopDecodeErrorZPtr {
246 err: Box::into_raw(Box::new(e)),
251 /// Checks if the given object is currently in the success state
253 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
257 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
258 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
259 impl Drop for CResult_BlindedHopDecodeErrorZ {
262 if unsafe { !(self.contents.result as *mut ()).is_null() } {
263 let _ = unsafe { Box::from_raw(self.contents.result) };
266 if unsafe { !(self.contents.err as *mut ()).is_null() } {
267 let _ = unsafe { Box::from_raw(self.contents.err) };
272 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
273 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
274 let contents = if o.result_ok {
275 let result = unsafe { o.contents.result };
276 unsafe { o.contents.result = core::ptr::null_mut() };
277 CResult_BlindedHopDecodeErrorZPtr { result }
279 let err = unsafe { o.contents.err };
280 unsafe { o.contents.err = core::ptr::null_mut(); }
281 CResult_BlindedHopDecodeErrorZPtr { err }
285 result_ok: o.result_ok,
290 /// The contents of CResult_NoneNoneZ
291 pub union CResult_NoneNoneZPtr {
292 /// Note that this value is always NULL, as there are no contents in the OK variant
293 pub result: *mut core::ffi::c_void,
294 /// Note that this value is always NULL, as there are no contents in the Err variant
295 pub err: *mut core::ffi::c_void,
298 /// A CResult_NoneNoneZ represents the result of a fallible operation,
299 /// containing a () on success and a () on failure.
300 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
301 pub struct CResult_NoneNoneZ {
302 /// The contents of this CResult_NoneNoneZ, accessible via either
303 /// `err` or `result` depending on the state of `result_ok`.
304 pub contents: CResult_NoneNoneZPtr,
305 /// Whether this CResult_NoneNoneZ represents a success state.
309 /// Creates a new CResult_NoneNoneZ in the success state.
310 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
312 contents: CResult_NoneNoneZPtr {
313 result: core::ptr::null_mut(),
319 /// Creates a new CResult_NoneNoneZ in the error state.
320 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
322 contents: CResult_NoneNoneZPtr {
323 err: core::ptr::null_mut(),
328 /// Checks if the given object is currently in the success state
330 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
334 /// Frees any resources used by the CResult_NoneNoneZ.
335 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
336 impl Drop for CResult_NoneNoneZ {
343 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
344 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
345 let contents = if o.result_ok {
346 let _ = unsafe { Box::from_raw(o.contents.result) };
347 o.contents.result = core::ptr::null_mut();
348 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
350 let _ = unsafe { Box::from_raw(o.contents.err) };
351 o.contents.err = core::ptr::null_mut();
352 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
356 result_ok: o.result_ok,
360 impl Clone for CResult_NoneNoneZ {
361 fn clone(&self) -> Self {
363 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
364 result: core::ptr::null_mut()
367 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
368 err: core::ptr::null_mut()
374 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
375 /// but with all dynamically-allocated buffers duplicated in new buffers.
376 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
378 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
379 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
380 /// A pointer to the contents in the success state.
381 /// Reading from this pointer when `result_ok` is not set is undefined.
382 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
383 /// A pointer to the contents in the error state.
384 /// Reading from this pointer when `result_ok` is set is undefined.
385 pub err: *mut crate::lightning::ln::msgs::DecodeError,
388 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
389 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
391 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
392 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
393 /// `err` or `result` depending on the state of `result_ok`.
394 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
395 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
399 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
400 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
401 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
402 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
403 result: Box::into_raw(Box::new(o)),
409 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
410 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
411 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
412 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
413 err: Box::into_raw(Box::new(e)),
418 /// Checks if the given object is currently in the success state
420 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
424 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
425 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
426 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
429 if unsafe { !(self.contents.result as *mut ()).is_null() } {
430 let _ = unsafe { Box::from_raw(self.contents.result) };
433 if unsafe { !(self.contents.err as *mut ()).is_null() } {
434 let _ = unsafe { Box::from_raw(self.contents.err) };
439 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
440 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
441 let contents = if o.result_ok {
442 let result = unsafe { o.contents.result };
443 unsafe { o.contents.result = core::ptr::null_mut() };
444 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
446 let err = unsafe { o.contents.err };
447 unsafe { o.contents.err = core::ptr::null_mut(); }
448 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
452 result_ok: o.result_ok,
456 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
457 fn clone(&self) -> Self {
459 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
460 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
463 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
464 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
470 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
471 /// but with all dynamically-allocated buffers duplicated in new buffers.
472 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
474 /// The contents of CResult_SecretKeyErrorZ
475 pub union CResult_SecretKeyErrorZPtr {
476 /// A pointer to the contents in the success state.
477 /// Reading from this pointer when `result_ok` is not set is undefined.
478 pub result: *mut crate::c_types::SecretKey,
479 /// A pointer to the contents in the error state.
480 /// Reading from this pointer when `result_ok` is set is undefined.
481 pub err: *mut crate::c_types::Secp256k1Error,
484 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
485 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
487 pub struct CResult_SecretKeyErrorZ {
488 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
489 /// `err` or `result` depending on the state of `result_ok`.
490 pub contents: CResult_SecretKeyErrorZPtr,
491 /// Whether this CResult_SecretKeyErrorZ represents a success state.
495 /// Creates a new CResult_SecretKeyErrorZ in the success state.
496 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
497 CResult_SecretKeyErrorZ {
498 contents: CResult_SecretKeyErrorZPtr {
499 result: Box::into_raw(Box::new(o)),
505 /// Creates a new CResult_SecretKeyErrorZ in the error state.
506 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
507 CResult_SecretKeyErrorZ {
508 contents: CResult_SecretKeyErrorZPtr {
509 err: Box::into_raw(Box::new(e)),
514 /// Checks if the given object is currently in the success state
516 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
520 /// Frees any resources used by the CResult_SecretKeyErrorZ.
521 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
522 impl Drop for CResult_SecretKeyErrorZ {
525 if unsafe { !(self.contents.result as *mut ()).is_null() } {
526 let _ = unsafe { Box::from_raw(self.contents.result) };
529 if unsafe { !(self.contents.err as *mut ()).is_null() } {
530 let _ = unsafe { Box::from_raw(self.contents.err) };
535 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
536 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
537 let contents = if o.result_ok {
538 let result = unsafe { o.contents.result };
539 unsafe { o.contents.result = core::ptr::null_mut() };
540 CResult_SecretKeyErrorZPtr { result }
542 let err = unsafe { o.contents.err };
543 unsafe { o.contents.err = core::ptr::null_mut(); }
544 CResult_SecretKeyErrorZPtr { err }
548 result_ok: o.result_ok,
552 impl Clone for CResult_SecretKeyErrorZ {
553 fn clone(&self) -> Self {
555 Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
556 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
559 Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
560 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
566 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
567 /// but with all dynamically-allocated buffers duplicated in new buffers.
568 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
570 /// The contents of CResult_PublicKeyErrorZ
571 pub union CResult_PublicKeyErrorZPtr {
572 /// A pointer to the contents in the success state.
573 /// Reading from this pointer when `result_ok` is not set is undefined.
574 pub result: *mut crate::c_types::PublicKey,
575 /// A pointer to the contents in the error state.
576 /// Reading from this pointer when `result_ok` is set is undefined.
577 pub err: *mut crate::c_types::Secp256k1Error,
580 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
581 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
582 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
583 pub struct CResult_PublicKeyErrorZ {
584 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
585 /// `err` or `result` depending on the state of `result_ok`.
586 pub contents: CResult_PublicKeyErrorZPtr,
587 /// Whether this CResult_PublicKeyErrorZ represents a success state.
591 /// Creates a new CResult_PublicKeyErrorZ in the success state.
592 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
593 CResult_PublicKeyErrorZ {
594 contents: CResult_PublicKeyErrorZPtr {
595 result: Box::into_raw(Box::new(o)),
601 /// Creates a new CResult_PublicKeyErrorZ in the error state.
602 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
603 CResult_PublicKeyErrorZ {
604 contents: CResult_PublicKeyErrorZPtr {
605 err: Box::into_raw(Box::new(e)),
610 /// Checks if the given object is currently in the success state
612 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
616 /// Frees any resources used by the CResult_PublicKeyErrorZ.
617 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
618 impl Drop for CResult_PublicKeyErrorZ {
621 if unsafe { !(self.contents.result as *mut ()).is_null() } {
622 let _ = unsafe { Box::from_raw(self.contents.result) };
625 if unsafe { !(self.contents.err as *mut ()).is_null() } {
626 let _ = unsafe { Box::from_raw(self.contents.err) };
631 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
632 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
633 let contents = if o.result_ok {
634 let result = unsafe { o.contents.result };
635 unsafe { o.contents.result = core::ptr::null_mut() };
636 CResult_PublicKeyErrorZPtr { result }
638 let err = unsafe { o.contents.err };
639 unsafe { o.contents.err = core::ptr::null_mut(); }
640 CResult_PublicKeyErrorZPtr { err }
644 result_ok: o.result_ok,
648 impl Clone for CResult_PublicKeyErrorZ {
649 fn clone(&self) -> Self {
651 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
652 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
655 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
656 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
662 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
663 /// but with all dynamically-allocated buffers duplicated in new buffers.
664 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
666 /// The contents of CResult_TxCreationKeysDecodeErrorZ
667 pub union CResult_TxCreationKeysDecodeErrorZPtr {
668 /// A pointer to the contents in the success state.
669 /// Reading from this pointer when `result_ok` is not set is undefined.
670 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
671 /// A pointer to the contents in the error state.
672 /// Reading from this pointer when `result_ok` is set is undefined.
673 pub err: *mut crate::lightning::ln::msgs::DecodeError,
676 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
677 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
679 pub struct CResult_TxCreationKeysDecodeErrorZ {
680 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
681 /// `err` or `result` depending on the state of `result_ok`.
682 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
683 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
687 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
688 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
689 CResult_TxCreationKeysDecodeErrorZ {
690 contents: CResult_TxCreationKeysDecodeErrorZPtr {
691 result: Box::into_raw(Box::new(o)),
697 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
698 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
699 CResult_TxCreationKeysDecodeErrorZ {
700 contents: CResult_TxCreationKeysDecodeErrorZPtr {
701 err: Box::into_raw(Box::new(e)),
706 /// Checks if the given object is currently in the success state
708 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
712 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
713 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
714 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
717 if unsafe { !(self.contents.result as *mut ()).is_null() } {
718 let _ = unsafe { Box::from_raw(self.contents.result) };
721 if unsafe { !(self.contents.err as *mut ()).is_null() } {
722 let _ = unsafe { Box::from_raw(self.contents.err) };
727 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
728 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
729 let contents = if o.result_ok {
730 let result = unsafe { o.contents.result };
731 unsafe { o.contents.result = core::ptr::null_mut() };
732 CResult_TxCreationKeysDecodeErrorZPtr { result }
734 let err = unsafe { o.contents.err };
735 unsafe { o.contents.err = core::ptr::null_mut(); }
736 CResult_TxCreationKeysDecodeErrorZPtr { err }
740 result_ok: o.result_ok,
744 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
745 fn clone(&self) -> Self {
747 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
748 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
751 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
752 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
758 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
759 /// but with all dynamically-allocated buffers duplicated in new buffers.
760 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
762 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
763 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
764 /// A pointer to the contents in the success state.
765 /// Reading from this pointer when `result_ok` is not set is undefined.
766 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
767 /// A pointer to the contents in the error state.
768 /// Reading from this pointer when `result_ok` is set is undefined.
769 pub err: *mut crate::lightning::ln::msgs::DecodeError,
772 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
773 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
775 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
776 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
777 /// `err` or `result` depending on the state of `result_ok`.
778 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
779 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
783 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
784 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
785 CResult_ChannelPublicKeysDecodeErrorZ {
786 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
787 result: Box::into_raw(Box::new(o)),
793 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
794 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
795 CResult_ChannelPublicKeysDecodeErrorZ {
796 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
797 err: Box::into_raw(Box::new(e)),
802 /// Checks if the given object is currently in the success state
804 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
808 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
809 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
810 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
813 if unsafe { !(self.contents.result as *mut ()).is_null() } {
814 let _ = unsafe { Box::from_raw(self.contents.result) };
817 if unsafe { !(self.contents.err as *mut ()).is_null() } {
818 let _ = unsafe { Box::from_raw(self.contents.err) };
823 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
824 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
825 let contents = if o.result_ok {
826 let result = unsafe { o.contents.result };
827 unsafe { o.contents.result = core::ptr::null_mut() };
828 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
830 let err = unsafe { o.contents.err };
831 unsafe { o.contents.err = core::ptr::null_mut(); }
832 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
836 result_ok: o.result_ok,
840 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
841 fn clone(&self) -> Self {
843 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
844 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
847 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
848 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
854 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
855 /// but with all dynamically-allocated buffers duplicated in new buffers.
856 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
858 /// The contents of CResult_TxCreationKeysErrorZ
859 pub union CResult_TxCreationKeysErrorZPtr {
860 /// A pointer to the contents in the success state.
861 /// Reading from this pointer when `result_ok` is not set is undefined.
862 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
863 /// A pointer to the contents in the error state.
864 /// Reading from this pointer when `result_ok` is set is undefined.
865 pub err: *mut crate::c_types::Secp256k1Error,
868 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
869 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
871 pub struct CResult_TxCreationKeysErrorZ {
872 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
873 /// `err` or `result` depending on the state of `result_ok`.
874 pub contents: CResult_TxCreationKeysErrorZPtr,
875 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
879 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
880 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
881 CResult_TxCreationKeysErrorZ {
882 contents: CResult_TxCreationKeysErrorZPtr {
883 result: Box::into_raw(Box::new(o)),
889 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
890 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
891 CResult_TxCreationKeysErrorZ {
892 contents: CResult_TxCreationKeysErrorZPtr {
893 err: Box::into_raw(Box::new(e)),
898 /// Checks if the given object is currently in the success state
900 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
904 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
905 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
906 impl Drop for CResult_TxCreationKeysErrorZ {
909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
910 let _ = unsafe { Box::from_raw(self.contents.result) };
913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
914 let _ = unsafe { Box::from_raw(self.contents.err) };
919 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
920 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
921 let contents = if o.result_ok {
922 let result = unsafe { o.contents.result };
923 unsafe { o.contents.result = core::ptr::null_mut() };
924 CResult_TxCreationKeysErrorZPtr { result }
926 let err = unsafe { o.contents.err };
927 unsafe { o.contents.err = core::ptr::null_mut(); }
928 CResult_TxCreationKeysErrorZPtr { err }
932 result_ok: o.result_ok,
936 impl Clone for CResult_TxCreationKeysErrorZ {
937 fn clone(&self) -> Self {
939 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
940 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
943 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
944 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
950 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
951 /// but with all dynamically-allocated buffers duplicated in new buffers.
952 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
955 /// An enum which can either contain a u32 or not
956 pub enum COption_u32Z {
957 /// When we're in this state, this COption_u32Z contains a u32
959 /// When we're in this state, this COption_u32Z contains nothing
963 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
964 if let Self::None = self { false } else { true }
966 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
969 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
970 if let Self::Some(v) = self { v } else { unreachable!() }
974 /// Constructs a new COption_u32Z containing a u32
975 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
976 COption_u32Z::Some(o)
979 /// Constructs a new COption_u32Z containing nothing
980 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
984 /// Frees any resources associated with the u32, if we are in the Some state
985 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
987 /// Creates a new COption_u32Z which has the same data as `orig`
988 /// but with all dynamically-allocated buffers duplicated in new buffers.
989 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
991 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
992 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
993 /// A pointer to the contents in the success state.
994 /// Reading from this pointer when `result_ok` is not set is undefined.
995 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
996 /// A pointer to the contents in the error state.
997 /// Reading from this pointer when `result_ok` is set is undefined.
998 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1001 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
1002 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
1003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1004 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
1005 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
1006 /// `err` or `result` depending on the state of `result_ok`.
1007 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
1008 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1009 pub result_ok: bool,
1012 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
1013 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
1014 CResult_HTLCOutputInCommitmentDecodeErrorZ {
1015 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1016 result: Box::into_raw(Box::new(o)),
1022 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
1023 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
1024 CResult_HTLCOutputInCommitmentDecodeErrorZ {
1025 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1026 err: Box::into_raw(Box::new(e)),
1031 /// Checks if the given object is currently in the success state
1033 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
1037 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
1038 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
1039 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1040 fn drop(&mut self) {
1042 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1043 let _ = unsafe { Box::from_raw(self.contents.result) };
1046 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1047 let _ = unsafe { Box::from_raw(self.contents.err) };
1052 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1053 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
1054 let contents = if o.result_ok {
1055 let result = unsafe { o.contents.result };
1056 unsafe { o.contents.result = core::ptr::null_mut() };
1057 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
1059 let err = unsafe { o.contents.err };
1060 unsafe { o.contents.err = core::ptr::null_mut(); }
1061 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
1065 result_ok: o.result_ok,
1069 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1070 fn clone(&self) -> Self {
1072 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1073 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
1076 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1077 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1083 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
1084 /// but with all dynamically-allocated buffers duplicated in new buffers.
1085 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
1087 /// An enum which can either contain a or not
1088 pub enum COption_NoneZ {
1089 /// When we're in this state, this COption_NoneZ contains a
1091 /// When we're in this state, this COption_NoneZ contains nothing
1094 impl COption_NoneZ {
1095 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1096 if let Self::None = self { false } else { true }
1098 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1103 /// Constructs a new COption_NoneZ containing a
1104 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
1108 /// Constructs a new COption_NoneZ containing nothing
1109 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
1113 /// Frees any resources associated with the , if we are in the Some state
1114 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
1116 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1117 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1118 /// A pointer to the contents in the success state.
1119 /// Reading from this pointer when `result_ok` is not set is undefined.
1120 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
1121 /// A pointer to the contents in the error state.
1122 /// Reading from this pointer when `result_ok` is set is undefined.
1123 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1126 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1127 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1129 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1130 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1131 /// `err` or `result` depending on the state of `result_ok`.
1132 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
1133 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1134 pub result_ok: bool,
1137 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
1138 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1139 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1140 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1141 result: Box::into_raw(Box::new(o)),
1147 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
1148 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1149 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1150 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1151 err: Box::into_raw(Box::new(e)),
1156 /// Checks if the given object is currently in the success state
1158 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
1162 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
1163 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
1164 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1165 fn drop(&mut self) {
1167 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1168 let _ = unsafe { Box::from_raw(self.contents.result) };
1171 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1172 let _ = unsafe { Box::from_raw(self.contents.err) };
1177 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1178 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1179 let contents = if o.result_ok {
1180 let result = unsafe { o.contents.result };
1181 unsafe { o.contents.result = core::ptr::null_mut() };
1182 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
1184 let err = unsafe { o.contents.err };
1185 unsafe { o.contents.err = core::ptr::null_mut(); }
1186 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
1190 result_ok: o.result_ok,
1194 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1195 fn clone(&self) -> Self {
1197 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1198 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1201 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1202 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1208 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1209 /// but with all dynamically-allocated buffers duplicated in new buffers.
1210 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1212 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1213 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
1214 /// A pointer to the contents in the success state.
1215 /// Reading from this pointer when `result_ok` is not set is undefined.
1216 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
1217 /// A pointer to the contents in the error state.
1218 /// Reading from this pointer when `result_ok` is set is undefined.
1219 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1222 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1223 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1225 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
1226 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1227 /// `err` or `result` depending on the state of `result_ok`.
1228 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
1229 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1230 pub result_ok: bool,
1233 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
1234 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1235 CResult_ChannelTransactionParametersDecodeErrorZ {
1236 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1237 result: Box::into_raw(Box::new(o)),
1243 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
1244 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1245 CResult_ChannelTransactionParametersDecodeErrorZ {
1246 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1247 err: Box::into_raw(Box::new(e)),
1252 /// Checks if the given object is currently in the success state
1254 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
1258 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
1259 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
1260 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
1261 fn drop(&mut self) {
1263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1264 let _ = unsafe { Box::from_raw(self.contents.result) };
1267 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1268 let _ = unsafe { Box::from_raw(self.contents.err) };
1273 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
1274 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1275 let contents = if o.result_ok {
1276 let result = unsafe { o.contents.result };
1277 unsafe { o.contents.result = core::ptr::null_mut() };
1278 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1280 let err = unsafe { o.contents.err };
1281 unsafe { o.contents.err = core::ptr::null_mut(); }
1282 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1286 result_ok: o.result_ok,
1290 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1291 fn clone(&self) -> Self {
1293 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1294 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1297 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1298 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1304 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1305 /// but with all dynamically-allocated buffers duplicated in new buffers.
1306 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1308 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1309 /// This corresponds to std::vector in C++
1310 pub struct CVec_SignatureZ {
1311 /// The elements in the array.
1312 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1313 pub data: *mut crate::c_types::Signature,
1314 /// The number of elements pointed to by `data`.
1317 impl CVec_SignatureZ {
1318 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1319 if self.datalen == 0 { return Vec::new(); }
1320 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1321 self.data = core::ptr::null_mut();
1325 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1326 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1329 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1330 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1331 let datalen = v.len();
1332 let data = Box::into_raw(v.into_boxed_slice());
1333 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1337 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1338 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1339 impl Drop for CVec_SignatureZ {
1340 fn drop(&mut self) {
1341 if self.datalen == 0 { return; }
1342 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1345 impl Clone for CVec_SignatureZ {
1346 fn clone(&self) -> Self {
1347 let mut res = Vec::new();
1348 if self.datalen == 0 { return Self::from(res); }
1349 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1354 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1355 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1356 /// A pointer to the contents in the success state.
1357 /// Reading from this pointer when `result_ok` is not set is undefined.
1358 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1359 /// A pointer to the contents in the error state.
1360 /// Reading from this pointer when `result_ok` is set is undefined.
1361 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1364 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1365 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1367 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1368 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1369 /// `err` or `result` depending on the state of `result_ok`.
1370 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1371 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1372 pub result_ok: bool,
1375 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1376 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1377 CResult_HolderCommitmentTransactionDecodeErrorZ {
1378 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1379 result: Box::into_raw(Box::new(o)),
1385 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1386 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1387 CResult_HolderCommitmentTransactionDecodeErrorZ {
1388 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1389 err: Box::into_raw(Box::new(e)),
1394 /// Checks if the given object is currently in the success state
1396 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1400 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1401 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1402 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1403 fn drop(&mut self) {
1405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1406 let _ = unsafe { Box::from_raw(self.contents.result) };
1409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1410 let _ = unsafe { Box::from_raw(self.contents.err) };
1415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1417 let contents = if o.result_ok {
1418 let result = unsafe { o.contents.result };
1419 unsafe { o.contents.result = core::ptr::null_mut() };
1420 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1422 let err = unsafe { o.contents.err };
1423 unsafe { o.contents.err = core::ptr::null_mut(); }
1424 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1428 result_ok: o.result_ok,
1432 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1433 fn clone(&self) -> Self {
1435 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1436 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1439 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1440 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1446 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1447 /// but with all dynamically-allocated buffers duplicated in new buffers.
1448 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1450 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1451 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1452 /// A pointer to the contents in the success state.
1453 /// Reading from this pointer when `result_ok` is not set is undefined.
1454 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1455 /// A pointer to the contents in the error state.
1456 /// Reading from this pointer when `result_ok` is set is undefined.
1457 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1460 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1461 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1463 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1464 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1465 /// `err` or `result` depending on the state of `result_ok`.
1466 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1467 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1468 pub result_ok: bool,
1471 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1472 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1473 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1474 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1475 result: Box::into_raw(Box::new(o)),
1481 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1482 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1483 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1484 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1485 err: Box::into_raw(Box::new(e)),
1490 /// Checks if the given object is currently in the success state
1492 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1496 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1497 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1498 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1499 fn drop(&mut self) {
1501 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1502 let _ = unsafe { Box::from_raw(self.contents.result) };
1505 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1506 let _ = unsafe { Box::from_raw(self.contents.err) };
1511 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1512 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1513 let contents = if o.result_ok {
1514 let result = unsafe { o.contents.result };
1515 unsafe { o.contents.result = core::ptr::null_mut() };
1516 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1518 let err = unsafe { o.contents.err };
1519 unsafe { o.contents.err = core::ptr::null_mut(); }
1520 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1524 result_ok: o.result_ok,
1528 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1529 fn clone(&self) -> Self {
1531 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1532 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1535 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1536 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1542 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1543 /// but with all dynamically-allocated buffers duplicated in new buffers.
1544 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1546 /// The contents of CResult_TrustedClosingTransactionNoneZ
1547 pub union CResult_TrustedClosingTransactionNoneZPtr {
1548 /// A pointer to the contents in the success state.
1549 /// Reading from this pointer when `result_ok` is not set is undefined.
1550 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1551 /// Note that this value is always NULL, as there are no contents in the Err variant
1552 pub err: *mut core::ffi::c_void,
1555 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1556 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1558 pub struct CResult_TrustedClosingTransactionNoneZ {
1559 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1560 /// `err` or `result` depending on the state of `result_ok`.
1561 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1562 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1563 pub result_ok: bool,
1566 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1567 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1568 CResult_TrustedClosingTransactionNoneZ {
1569 contents: CResult_TrustedClosingTransactionNoneZPtr {
1570 result: Box::into_raw(Box::new(o)),
1576 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1577 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1578 CResult_TrustedClosingTransactionNoneZ {
1579 contents: CResult_TrustedClosingTransactionNoneZPtr {
1580 err: core::ptr::null_mut(),
1585 /// Checks if the given object is currently in the success state
1587 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1591 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1592 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1593 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1594 fn drop(&mut self) {
1596 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1597 let _ = unsafe { Box::from_raw(self.contents.result) };
1603 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1604 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1605 let contents = if o.result_ok {
1606 let result = unsafe { o.contents.result };
1607 unsafe { o.contents.result = core::ptr::null_mut() };
1608 CResult_TrustedClosingTransactionNoneZPtr { result }
1610 let _ = unsafe { Box::from_raw(o.contents.err) };
1611 o.contents.err = core::ptr::null_mut();
1612 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1616 result_ok: o.result_ok,
1621 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1622 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1623 /// A pointer to the contents in the success state.
1624 /// Reading from this pointer when `result_ok` is not set is undefined.
1625 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1626 /// A pointer to the contents in the error state.
1627 /// Reading from this pointer when `result_ok` is set is undefined.
1628 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1631 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1632 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1633 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1634 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1635 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1636 /// `err` or `result` depending on the state of `result_ok`.
1637 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1638 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1639 pub result_ok: bool,
1642 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1643 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1644 CResult_CommitmentTransactionDecodeErrorZ {
1645 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1646 result: Box::into_raw(Box::new(o)),
1652 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1653 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1654 CResult_CommitmentTransactionDecodeErrorZ {
1655 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1656 err: Box::into_raw(Box::new(e)),
1661 /// Checks if the given object is currently in the success state
1663 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1667 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1668 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1669 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1670 fn drop(&mut self) {
1672 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1673 let _ = unsafe { Box::from_raw(self.contents.result) };
1676 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1677 let _ = unsafe { Box::from_raw(self.contents.err) };
1682 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1683 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1684 let contents = if o.result_ok {
1685 let result = unsafe { o.contents.result };
1686 unsafe { o.contents.result = core::ptr::null_mut() };
1687 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1689 let err = unsafe { o.contents.err };
1690 unsafe { o.contents.err = core::ptr::null_mut(); }
1691 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1695 result_ok: o.result_ok,
1699 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1700 fn clone(&self) -> Self {
1702 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1703 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1706 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1707 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1713 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1714 /// but with all dynamically-allocated buffers duplicated in new buffers.
1715 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1717 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1718 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1719 /// A pointer to the contents in the success state.
1720 /// Reading from this pointer when `result_ok` is not set is undefined.
1721 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1722 /// Note that this value is always NULL, as there are no contents in the Err variant
1723 pub err: *mut core::ffi::c_void,
1726 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1727 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1729 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1730 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1731 /// `err` or `result` depending on the state of `result_ok`.
1732 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1733 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1734 pub result_ok: bool,
1737 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1738 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1739 CResult_TrustedCommitmentTransactionNoneZ {
1740 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1741 result: Box::into_raw(Box::new(o)),
1747 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1748 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1749 CResult_TrustedCommitmentTransactionNoneZ {
1750 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1751 err: core::ptr::null_mut(),
1756 /// Checks if the given object is currently in the success state
1758 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1762 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1763 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1764 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1765 fn drop(&mut self) {
1767 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1768 let _ = unsafe { Box::from_raw(self.contents.result) };
1774 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1775 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1776 let contents = if o.result_ok {
1777 let result = unsafe { o.contents.result };
1778 unsafe { o.contents.result = core::ptr::null_mut() };
1779 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1781 let _ = unsafe { Box::from_raw(o.contents.err) };
1782 o.contents.err = core::ptr::null_mut();
1783 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1787 result_ok: o.result_ok,
1792 /// The contents of CResult_CVec_SignatureZNoneZ
1793 pub union CResult_CVec_SignatureZNoneZPtr {
1794 /// A pointer to the contents in the success state.
1795 /// Reading from this pointer when `result_ok` is not set is undefined.
1796 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1797 /// Note that this value is always NULL, as there are no contents in the Err variant
1798 pub err: *mut core::ffi::c_void,
1801 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1802 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1804 pub struct CResult_CVec_SignatureZNoneZ {
1805 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1806 /// `err` or `result` depending on the state of `result_ok`.
1807 pub contents: CResult_CVec_SignatureZNoneZPtr,
1808 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1809 pub result_ok: bool,
1812 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1813 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1814 CResult_CVec_SignatureZNoneZ {
1815 contents: CResult_CVec_SignatureZNoneZPtr {
1816 result: Box::into_raw(Box::new(o)),
1822 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1823 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1824 CResult_CVec_SignatureZNoneZ {
1825 contents: CResult_CVec_SignatureZNoneZPtr {
1826 err: core::ptr::null_mut(),
1831 /// Checks if the given object is currently in the success state
1833 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1837 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1838 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1839 impl Drop for CResult_CVec_SignatureZNoneZ {
1840 fn drop(&mut self) {
1842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1843 let _ = unsafe { Box::from_raw(self.contents.result) };
1849 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1850 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1851 let contents = if o.result_ok {
1852 let result = unsafe { o.contents.result };
1853 unsafe { o.contents.result = core::ptr::null_mut() };
1854 CResult_CVec_SignatureZNoneZPtr { result }
1856 let _ = unsafe { Box::from_raw(o.contents.err) };
1857 o.contents.err = core::ptr::null_mut();
1858 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1862 result_ok: o.result_ok,
1866 impl Clone for CResult_CVec_SignatureZNoneZ {
1867 fn clone(&self) -> Self {
1869 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1870 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1873 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1874 err: core::ptr::null_mut()
1880 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1881 /// but with all dynamically-allocated buffers duplicated in new buffers.
1882 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1884 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1885 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1886 /// A pointer to the contents in the success state.
1887 /// Reading from this pointer when `result_ok` is not set is undefined.
1888 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1889 /// A pointer to the contents in the error state.
1890 /// Reading from this pointer when `result_ok` is set is undefined.
1891 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1894 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1895 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1897 pub struct CResult_ShutdownScriptDecodeErrorZ {
1898 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1899 /// `err` or `result` depending on the state of `result_ok`.
1900 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1901 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1902 pub result_ok: bool,
1905 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1906 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1907 CResult_ShutdownScriptDecodeErrorZ {
1908 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1909 result: Box::into_raw(Box::new(o)),
1915 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1916 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1917 CResult_ShutdownScriptDecodeErrorZ {
1918 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1919 err: Box::into_raw(Box::new(e)),
1924 /// Checks if the given object is currently in the success state
1926 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1930 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1931 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1932 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1933 fn drop(&mut self) {
1935 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1936 let _ = unsafe { Box::from_raw(self.contents.result) };
1939 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1940 let _ = unsafe { Box::from_raw(self.contents.err) };
1945 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1946 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1947 let contents = if o.result_ok {
1948 let result = unsafe { o.contents.result };
1949 unsafe { o.contents.result = core::ptr::null_mut() };
1950 CResult_ShutdownScriptDecodeErrorZPtr { result }
1952 let err = unsafe { o.contents.err };
1953 unsafe { o.contents.err = core::ptr::null_mut(); }
1954 CResult_ShutdownScriptDecodeErrorZPtr { err }
1958 result_ok: o.result_ok,
1962 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1963 fn clone(&self) -> Self {
1965 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1966 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1969 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1970 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1976 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1977 /// but with all dynamically-allocated buffers duplicated in new buffers.
1978 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1980 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1981 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1982 /// A pointer to the contents in the success state.
1983 /// Reading from this pointer when `result_ok` is not set is undefined.
1984 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1985 /// A pointer to the contents in the error state.
1986 /// Reading from this pointer when `result_ok` is set is undefined.
1987 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1990 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1991 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1993 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1994 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1995 /// `err` or `result` depending on the state of `result_ok`.
1996 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1997 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1998 pub result_ok: bool,
2001 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
2002 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
2003 CResult_ShutdownScriptInvalidShutdownScriptZ {
2004 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2005 result: Box::into_raw(Box::new(o)),
2011 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
2012 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
2013 CResult_ShutdownScriptInvalidShutdownScriptZ {
2014 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2015 err: Box::into_raw(Box::new(e)),
2020 /// Checks if the given object is currently in the success state
2022 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
2026 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
2027 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
2028 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
2029 fn drop(&mut self) {
2031 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2032 let _ = unsafe { Box::from_raw(self.contents.result) };
2035 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2036 let _ = unsafe { Box::from_raw(self.contents.err) };
2041 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
2042 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
2043 let contents = if o.result_ok {
2044 let result = unsafe { o.contents.result };
2045 unsafe { o.contents.result = core::ptr::null_mut() };
2046 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
2048 let err = unsafe { o.contents.err };
2049 unsafe { o.contents.err = core::ptr::null_mut(); }
2050 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
2054 result_ok: o.result_ok,
2058 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
2059 fn clone(&self) -> Self {
2061 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2062 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2065 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2066 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
2072 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
2073 /// but with all dynamically-allocated buffers duplicated in new buffers.
2074 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
2076 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2077 pub enum COption_WriteableScoreZ {
2078 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2079 Some(crate::lightning::routing::scoring::WriteableScore),
2080 /// When we're in this state, this COption_WriteableScoreZ contains nothing
2083 impl COption_WriteableScoreZ {
2084 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2085 if let Self::None = self { false } else { true }
2087 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2090 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2091 if let Self::Some(v) = self { v } else { unreachable!() }
2095 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2096 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2097 COption_WriteableScoreZ::Some(o)
2100 /// Constructs a new COption_WriteableScoreZ containing nothing
2101 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2102 COption_WriteableScoreZ::None
2105 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2106 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2108 /// The contents of CResult_NoneErrorZ
2109 pub union CResult_NoneErrorZPtr {
2110 /// Note that this value is always NULL, as there are no contents in the OK variant
2111 pub result: *mut core::ffi::c_void,
2112 /// A pointer to the contents in the error state.
2113 /// Reading from this pointer when `result_ok` is set is undefined.
2114 pub err: *mut crate::c_types::IOError,
2117 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2118 /// containing a () on success and a crate::c_types::IOError on failure.
2119 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2120 pub struct CResult_NoneErrorZ {
2121 /// The contents of this CResult_NoneErrorZ, accessible via either
2122 /// `err` or `result` depending on the state of `result_ok`.
2123 pub contents: CResult_NoneErrorZPtr,
2124 /// Whether this CResult_NoneErrorZ represents a success state.
2125 pub result_ok: bool,
2128 /// Creates a new CResult_NoneErrorZ in the success state.
2129 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2130 CResult_NoneErrorZ {
2131 contents: CResult_NoneErrorZPtr {
2132 result: core::ptr::null_mut(),
2138 /// Creates a new CResult_NoneErrorZ in the error state.
2139 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2140 CResult_NoneErrorZ {
2141 contents: CResult_NoneErrorZPtr {
2142 err: Box::into_raw(Box::new(e)),
2147 /// Checks if the given object is currently in the success state
2149 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2153 /// Frees any resources used by the CResult_NoneErrorZ.
2154 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2155 impl Drop for CResult_NoneErrorZ {
2156 fn drop(&mut self) {
2159 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2160 let _ = unsafe { Box::from_raw(self.contents.err) };
2165 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2166 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2167 let contents = if o.result_ok {
2168 let _ = unsafe { Box::from_raw(o.contents.result) };
2169 o.contents.result = core::ptr::null_mut();
2170 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2172 let err = unsafe { o.contents.err };
2173 unsafe { o.contents.err = core::ptr::null_mut(); }
2174 CResult_NoneErrorZPtr { err }
2178 result_ok: o.result_ok,
2182 impl Clone for CResult_NoneErrorZ {
2183 fn clone(&self) -> Self {
2185 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2186 result: core::ptr::null_mut()
2189 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2190 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2196 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2197 /// but with all dynamically-allocated buffers duplicated in new buffers.
2198 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2200 /// The contents of CResult_RouteHopDecodeErrorZ
2201 pub union CResult_RouteHopDecodeErrorZPtr {
2202 /// A pointer to the contents in the success state.
2203 /// Reading from this pointer when `result_ok` is not set is undefined.
2204 pub result: *mut crate::lightning::routing::router::RouteHop,
2205 /// A pointer to the contents in the error state.
2206 /// Reading from this pointer when `result_ok` is set is undefined.
2207 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2210 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2211 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2213 pub struct CResult_RouteHopDecodeErrorZ {
2214 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2215 /// `err` or `result` depending on the state of `result_ok`.
2216 pub contents: CResult_RouteHopDecodeErrorZPtr,
2217 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2218 pub result_ok: bool,
2221 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2222 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2223 CResult_RouteHopDecodeErrorZ {
2224 contents: CResult_RouteHopDecodeErrorZPtr {
2225 result: Box::into_raw(Box::new(o)),
2231 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2232 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2233 CResult_RouteHopDecodeErrorZ {
2234 contents: CResult_RouteHopDecodeErrorZPtr {
2235 err: Box::into_raw(Box::new(e)),
2240 /// Checks if the given object is currently in the success state
2242 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2246 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2247 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2248 impl Drop for CResult_RouteHopDecodeErrorZ {
2249 fn drop(&mut self) {
2251 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2252 let _ = unsafe { Box::from_raw(self.contents.result) };
2255 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2256 let _ = unsafe { Box::from_raw(self.contents.err) };
2261 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2262 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2263 let contents = if o.result_ok {
2264 let result = unsafe { o.contents.result };
2265 unsafe { o.contents.result = core::ptr::null_mut() };
2266 CResult_RouteHopDecodeErrorZPtr { result }
2268 let err = unsafe { o.contents.err };
2269 unsafe { o.contents.err = core::ptr::null_mut(); }
2270 CResult_RouteHopDecodeErrorZPtr { err }
2274 result_ok: o.result_ok,
2278 impl Clone for CResult_RouteHopDecodeErrorZ {
2279 fn clone(&self) -> Self {
2281 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2282 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2285 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2286 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2292 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2293 /// but with all dynamically-allocated buffers duplicated in new buffers.
2294 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2296 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2297 /// This corresponds to std::vector in C++
2298 pub struct CVec_RouteHopZ {
2299 /// The elements in the array.
2300 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2301 pub data: *mut crate::lightning::routing::router::RouteHop,
2302 /// The number of elements pointed to by `data`.
2305 impl CVec_RouteHopZ {
2306 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2307 if self.datalen == 0 { return Vec::new(); }
2308 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2309 self.data = core::ptr::null_mut();
2313 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2314 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2317 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2318 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2319 let datalen = v.len();
2320 let data = Box::into_raw(v.into_boxed_slice());
2321 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2325 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2326 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2327 impl Drop for CVec_RouteHopZ {
2328 fn drop(&mut self) {
2329 if self.datalen == 0 { return; }
2330 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2333 impl Clone for CVec_RouteHopZ {
2334 fn clone(&self) -> Self {
2335 let mut res = Vec::new();
2336 if self.datalen == 0 { return Self::from(res); }
2337 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2342 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2343 /// This corresponds to std::vector in C++
2344 pub struct CVec_CVec_RouteHopZZ {
2345 /// The elements in the array.
2346 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2347 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2348 /// The number of elements pointed to by `data`.
2351 impl CVec_CVec_RouteHopZZ {
2352 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2353 if self.datalen == 0 { return Vec::new(); }
2354 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2355 self.data = core::ptr::null_mut();
2359 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2360 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2363 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2364 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2365 let datalen = v.len();
2366 let data = Box::into_raw(v.into_boxed_slice());
2367 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2371 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2372 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2373 impl Drop for CVec_CVec_RouteHopZZ {
2374 fn drop(&mut self) {
2375 if self.datalen == 0 { return; }
2376 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2379 impl Clone for CVec_CVec_RouteHopZZ {
2380 fn clone(&self) -> Self {
2381 let mut res = Vec::new();
2382 if self.datalen == 0 { return Self::from(res); }
2383 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2388 /// The contents of CResult_RouteDecodeErrorZ
2389 pub union CResult_RouteDecodeErrorZPtr {
2390 /// A pointer to the contents in the success state.
2391 /// Reading from this pointer when `result_ok` is not set is undefined.
2392 pub result: *mut crate::lightning::routing::router::Route,
2393 /// A pointer to the contents in the error state.
2394 /// Reading from this pointer when `result_ok` is set is undefined.
2395 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2398 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2399 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2401 pub struct CResult_RouteDecodeErrorZ {
2402 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2403 /// `err` or `result` depending on the state of `result_ok`.
2404 pub contents: CResult_RouteDecodeErrorZPtr,
2405 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2406 pub result_ok: bool,
2409 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2410 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2411 CResult_RouteDecodeErrorZ {
2412 contents: CResult_RouteDecodeErrorZPtr {
2413 result: Box::into_raw(Box::new(o)),
2419 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2420 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2421 CResult_RouteDecodeErrorZ {
2422 contents: CResult_RouteDecodeErrorZPtr {
2423 err: Box::into_raw(Box::new(e)),
2428 /// Checks if the given object is currently in the success state
2430 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2434 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2435 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2436 impl Drop for CResult_RouteDecodeErrorZ {
2437 fn drop(&mut self) {
2439 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2440 let _ = unsafe { Box::from_raw(self.contents.result) };
2443 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2444 let _ = unsafe { Box::from_raw(self.contents.err) };
2449 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2450 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2451 let contents = if o.result_ok {
2452 let result = unsafe { o.contents.result };
2453 unsafe { o.contents.result = core::ptr::null_mut() };
2454 CResult_RouteDecodeErrorZPtr { result }
2456 let err = unsafe { o.contents.err };
2457 unsafe { o.contents.err = core::ptr::null_mut(); }
2458 CResult_RouteDecodeErrorZPtr { err }
2462 result_ok: o.result_ok,
2466 impl Clone for CResult_RouteDecodeErrorZ {
2467 fn clone(&self) -> Self {
2469 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2470 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2473 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2474 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2480 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2481 /// but with all dynamically-allocated buffers duplicated in new buffers.
2482 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2484 /// The contents of CResult_RouteParametersDecodeErrorZ
2485 pub union CResult_RouteParametersDecodeErrorZPtr {
2486 /// A pointer to the contents in the success state.
2487 /// Reading from this pointer when `result_ok` is not set is undefined.
2488 pub result: *mut crate::lightning::routing::router::RouteParameters,
2489 /// A pointer to the contents in the error state.
2490 /// Reading from this pointer when `result_ok` is set is undefined.
2491 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2494 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2495 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2497 pub struct CResult_RouteParametersDecodeErrorZ {
2498 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2499 /// `err` or `result` depending on the state of `result_ok`.
2500 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2501 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2502 pub result_ok: bool,
2505 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2506 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2507 CResult_RouteParametersDecodeErrorZ {
2508 contents: CResult_RouteParametersDecodeErrorZPtr {
2509 result: Box::into_raw(Box::new(o)),
2515 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2516 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2517 CResult_RouteParametersDecodeErrorZ {
2518 contents: CResult_RouteParametersDecodeErrorZPtr {
2519 err: Box::into_raw(Box::new(e)),
2524 /// Checks if the given object is currently in the success state
2526 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2530 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2531 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2532 impl Drop for CResult_RouteParametersDecodeErrorZ {
2533 fn drop(&mut self) {
2535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2536 let _ = unsafe { Box::from_raw(self.contents.result) };
2539 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2540 let _ = unsafe { Box::from_raw(self.contents.err) };
2545 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2546 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2547 let contents = if o.result_ok {
2548 let result = unsafe { o.contents.result };
2549 unsafe { o.contents.result = core::ptr::null_mut() };
2550 CResult_RouteParametersDecodeErrorZPtr { result }
2552 let err = unsafe { o.contents.err };
2553 unsafe { o.contents.err = core::ptr::null_mut(); }
2554 CResult_RouteParametersDecodeErrorZPtr { err }
2558 result_ok: o.result_ok,
2562 impl Clone for CResult_RouteParametersDecodeErrorZ {
2563 fn clone(&self) -> Self {
2565 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2566 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2569 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2570 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2576 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2577 /// but with all dynamically-allocated buffers duplicated in new buffers.
2578 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2580 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2581 /// This corresponds to std::vector in C++
2582 pub struct CVec_RouteHintZ {
2583 /// The elements in the array.
2584 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2585 pub data: *mut crate::lightning::routing::router::RouteHint,
2586 /// The number of elements pointed to by `data`.
2589 impl CVec_RouteHintZ {
2590 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2591 if self.datalen == 0 { return Vec::new(); }
2592 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2593 self.data = core::ptr::null_mut();
2597 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2598 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2601 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2602 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2603 let datalen = v.len();
2604 let data = Box::into_raw(v.into_boxed_slice());
2605 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2609 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2610 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2611 impl Drop for CVec_RouteHintZ {
2612 fn drop(&mut self) {
2613 if self.datalen == 0 { return; }
2614 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2617 impl Clone for CVec_RouteHintZ {
2618 fn clone(&self) -> Self {
2619 let mut res = Vec::new();
2620 if self.datalen == 0 { return Self::from(res); }
2621 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2627 /// An enum which can either contain a u64 or not
2628 pub enum COption_u64Z {
2629 /// When we're in this state, this COption_u64Z contains a u64
2631 /// When we're in this state, this COption_u64Z contains nothing
2635 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2636 if let Self::None = self { false } else { true }
2638 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2641 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2642 if let Self::Some(v) = self { v } else { unreachable!() }
2646 /// Constructs a new COption_u64Z containing a u64
2647 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2648 COption_u64Z::Some(o)
2651 /// Constructs a new COption_u64Z containing nothing
2652 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2656 /// Frees any resources associated with the u64, if we are in the Some state
2657 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2659 /// Creates a new COption_u64Z which has the same data as `orig`
2660 /// but with all dynamically-allocated buffers duplicated in new buffers.
2661 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2663 /// A dynamically-allocated array of u64s of arbitrary size.
2664 /// This corresponds to std::vector in C++
2665 pub struct CVec_u64Z {
2666 /// The elements in the array.
2667 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2669 /// The number of elements pointed to by `data`.
2673 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2674 if self.datalen == 0 { return Vec::new(); }
2675 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2676 self.data = core::ptr::null_mut();
2680 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2681 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2684 impl From<Vec<u64>> for CVec_u64Z {
2685 fn from(v: Vec<u64>) -> Self {
2686 let datalen = v.len();
2687 let data = Box::into_raw(v.into_boxed_slice());
2688 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2692 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2693 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2694 impl Drop for CVec_u64Z {
2695 fn drop(&mut self) {
2696 if self.datalen == 0 { return; }
2697 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2700 impl Clone for CVec_u64Z {
2701 fn clone(&self) -> Self {
2702 let mut res = Vec::new();
2703 if self.datalen == 0 { return Self::from(res); }
2704 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2709 /// The contents of CResult_PaymentParametersDecodeErrorZ
2710 pub union CResult_PaymentParametersDecodeErrorZPtr {
2711 /// A pointer to the contents in the success state.
2712 /// Reading from this pointer when `result_ok` is not set is undefined.
2713 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2714 /// A pointer to the contents in the error state.
2715 /// Reading from this pointer when `result_ok` is set is undefined.
2716 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2719 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2720 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2721 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2722 pub struct CResult_PaymentParametersDecodeErrorZ {
2723 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2724 /// `err` or `result` depending on the state of `result_ok`.
2725 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2726 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2727 pub result_ok: bool,
2730 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2731 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2732 CResult_PaymentParametersDecodeErrorZ {
2733 contents: CResult_PaymentParametersDecodeErrorZPtr {
2734 result: Box::into_raw(Box::new(o)),
2740 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2741 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2742 CResult_PaymentParametersDecodeErrorZ {
2743 contents: CResult_PaymentParametersDecodeErrorZPtr {
2744 err: Box::into_raw(Box::new(e)),
2749 /// Checks if the given object is currently in the success state
2751 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2755 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2756 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2757 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2758 fn drop(&mut self) {
2760 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2761 let _ = unsafe { Box::from_raw(self.contents.result) };
2764 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2765 let _ = unsafe { Box::from_raw(self.contents.err) };
2770 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2771 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2772 let contents = if o.result_ok {
2773 let result = unsafe { o.contents.result };
2774 unsafe { o.contents.result = core::ptr::null_mut() };
2775 CResult_PaymentParametersDecodeErrorZPtr { result }
2777 let err = unsafe { o.contents.err };
2778 unsafe { o.contents.err = core::ptr::null_mut(); }
2779 CResult_PaymentParametersDecodeErrorZPtr { err }
2783 result_ok: o.result_ok,
2787 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2788 fn clone(&self) -> Self {
2790 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2791 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2794 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2795 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2801 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2802 /// but with all dynamically-allocated buffers duplicated in new buffers.
2803 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2805 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2806 /// This corresponds to std::vector in C++
2807 pub struct CVec_RouteHintHopZ {
2808 /// The elements in the array.
2809 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2810 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2811 /// The number of elements pointed to by `data`.
2814 impl CVec_RouteHintHopZ {
2815 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2816 if self.datalen == 0 { return Vec::new(); }
2817 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2818 self.data = core::ptr::null_mut();
2822 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2823 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2826 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2827 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2828 let datalen = v.len();
2829 let data = Box::into_raw(v.into_boxed_slice());
2830 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2834 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2835 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2836 impl Drop for CVec_RouteHintHopZ {
2837 fn drop(&mut self) {
2838 if self.datalen == 0 { return; }
2839 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2842 impl Clone for CVec_RouteHintHopZ {
2843 fn clone(&self) -> Self {
2844 let mut res = Vec::new();
2845 if self.datalen == 0 { return Self::from(res); }
2846 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2851 /// The contents of CResult_RouteHintDecodeErrorZ
2852 pub union CResult_RouteHintDecodeErrorZPtr {
2853 /// A pointer to the contents in the success state.
2854 /// Reading from this pointer when `result_ok` is not set is undefined.
2855 pub result: *mut crate::lightning::routing::router::RouteHint,
2856 /// A pointer to the contents in the error state.
2857 /// Reading from this pointer when `result_ok` is set is undefined.
2858 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2861 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2862 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2864 pub struct CResult_RouteHintDecodeErrorZ {
2865 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2866 /// `err` or `result` depending on the state of `result_ok`.
2867 pub contents: CResult_RouteHintDecodeErrorZPtr,
2868 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2869 pub result_ok: bool,
2872 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2873 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2874 CResult_RouteHintDecodeErrorZ {
2875 contents: CResult_RouteHintDecodeErrorZPtr {
2876 result: Box::into_raw(Box::new(o)),
2882 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2883 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2884 CResult_RouteHintDecodeErrorZ {
2885 contents: CResult_RouteHintDecodeErrorZPtr {
2886 err: Box::into_raw(Box::new(e)),
2891 /// Checks if the given object is currently in the success state
2893 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2897 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2898 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2899 impl Drop for CResult_RouteHintDecodeErrorZ {
2900 fn drop(&mut self) {
2902 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2903 let _ = unsafe { Box::from_raw(self.contents.result) };
2906 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2907 let _ = unsafe { Box::from_raw(self.contents.err) };
2912 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2913 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2914 let contents = if o.result_ok {
2915 let result = unsafe { o.contents.result };
2916 unsafe { o.contents.result = core::ptr::null_mut() };
2917 CResult_RouteHintDecodeErrorZPtr { result }
2919 let err = unsafe { o.contents.err };
2920 unsafe { o.contents.err = core::ptr::null_mut(); }
2921 CResult_RouteHintDecodeErrorZPtr { err }
2925 result_ok: o.result_ok,
2929 impl Clone for CResult_RouteHintDecodeErrorZ {
2930 fn clone(&self) -> Self {
2932 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2933 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2936 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2937 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2943 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2944 /// but with all dynamically-allocated buffers duplicated in new buffers.
2945 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2947 /// The contents of CResult_RouteHintHopDecodeErrorZ
2948 pub union CResult_RouteHintHopDecodeErrorZPtr {
2949 /// A pointer to the contents in the success state.
2950 /// Reading from this pointer when `result_ok` is not set is undefined.
2951 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2952 /// A pointer to the contents in the error state.
2953 /// Reading from this pointer when `result_ok` is set is undefined.
2954 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2957 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2958 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2959 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2960 pub struct CResult_RouteHintHopDecodeErrorZ {
2961 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2962 /// `err` or `result` depending on the state of `result_ok`.
2963 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2964 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2965 pub result_ok: bool,
2968 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2969 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2970 CResult_RouteHintHopDecodeErrorZ {
2971 contents: CResult_RouteHintHopDecodeErrorZPtr {
2972 result: Box::into_raw(Box::new(o)),
2978 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2979 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2980 CResult_RouteHintHopDecodeErrorZ {
2981 contents: CResult_RouteHintHopDecodeErrorZPtr {
2982 err: Box::into_raw(Box::new(e)),
2987 /// Checks if the given object is currently in the success state
2989 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2993 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2994 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2995 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2996 fn drop(&mut self) {
2998 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2999 let _ = unsafe { Box::from_raw(self.contents.result) };
3002 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3003 let _ = unsafe { Box::from_raw(self.contents.err) };
3008 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3009 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3010 let contents = if o.result_ok {
3011 let result = unsafe { o.contents.result };
3012 unsafe { o.contents.result = core::ptr::null_mut() };
3013 CResult_RouteHintHopDecodeErrorZPtr { result }
3015 let err = unsafe { o.contents.err };
3016 unsafe { o.contents.err = core::ptr::null_mut(); }
3017 CResult_RouteHintHopDecodeErrorZPtr { err }
3021 result_ok: o.result_ok,
3025 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3026 fn clone(&self) -> Self {
3028 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3029 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3032 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3033 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3039 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3040 /// but with all dynamically-allocated buffers duplicated in new buffers.
3041 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3043 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3044 /// This corresponds to std::vector in C++
3045 pub struct CVec_ChannelDetailsZ {
3046 /// The elements in the array.
3047 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3048 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3049 /// The number of elements pointed to by `data`.
3052 impl CVec_ChannelDetailsZ {
3053 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3054 if self.datalen == 0 { return Vec::new(); }
3055 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3056 self.data = core::ptr::null_mut();
3060 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3061 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3064 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3065 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3066 let datalen = v.len();
3067 let data = Box::into_raw(v.into_boxed_slice());
3068 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3072 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3073 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3074 impl Drop for CVec_ChannelDetailsZ {
3075 fn drop(&mut self) {
3076 if self.datalen == 0 { return; }
3077 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3080 impl Clone for CVec_ChannelDetailsZ {
3081 fn clone(&self) -> Self {
3082 let mut res = Vec::new();
3083 if self.datalen == 0 { return Self::from(res); }
3084 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3089 /// The contents of CResult_RouteLightningErrorZ
3090 pub union CResult_RouteLightningErrorZPtr {
3091 /// A pointer to the contents in the success state.
3092 /// Reading from this pointer when `result_ok` is not set is undefined.
3093 pub result: *mut crate::lightning::routing::router::Route,
3094 /// A pointer to the contents in the error state.
3095 /// Reading from this pointer when `result_ok` is set is undefined.
3096 pub err: *mut crate::lightning::ln::msgs::LightningError,
3099 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3100 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3101 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3102 pub struct CResult_RouteLightningErrorZ {
3103 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3104 /// `err` or `result` depending on the state of `result_ok`.
3105 pub contents: CResult_RouteLightningErrorZPtr,
3106 /// Whether this CResult_RouteLightningErrorZ represents a success state.
3107 pub result_ok: bool,
3110 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3111 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3112 CResult_RouteLightningErrorZ {
3113 contents: CResult_RouteLightningErrorZPtr {
3114 result: Box::into_raw(Box::new(o)),
3120 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3121 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3122 CResult_RouteLightningErrorZ {
3123 contents: CResult_RouteLightningErrorZPtr {
3124 err: Box::into_raw(Box::new(e)),
3129 /// Checks if the given object is currently in the success state
3131 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3135 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3136 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3137 impl Drop for CResult_RouteLightningErrorZ {
3138 fn drop(&mut self) {
3140 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3141 let _ = unsafe { Box::from_raw(self.contents.result) };
3144 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3145 let _ = unsafe { Box::from_raw(self.contents.err) };
3150 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3151 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3152 let contents = if o.result_ok {
3153 let result = unsafe { o.contents.result };
3154 unsafe { o.contents.result = core::ptr::null_mut() };
3155 CResult_RouteLightningErrorZPtr { result }
3157 let err = unsafe { o.contents.err };
3158 unsafe { o.contents.err = core::ptr::null_mut(); }
3159 CResult_RouteLightningErrorZPtr { err }
3163 result_ok: o.result_ok,
3167 impl Clone for CResult_RouteLightningErrorZ {
3168 fn clone(&self) -> Self {
3170 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3171 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3174 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3175 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3181 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3182 /// but with all dynamically-allocated buffers duplicated in new buffers.
3183 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3185 /// The contents of CResult_PaymentPurposeDecodeErrorZ
3186 pub union CResult_PaymentPurposeDecodeErrorZPtr {
3187 /// A pointer to the contents in the success state.
3188 /// Reading from this pointer when `result_ok` is not set is undefined.
3189 pub result: *mut crate::lightning::util::events::PaymentPurpose,
3190 /// A pointer to the contents in the error state.
3191 /// Reading from this pointer when `result_ok` is set is undefined.
3192 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3195 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
3196 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
3197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3198 pub struct CResult_PaymentPurposeDecodeErrorZ {
3199 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
3200 /// `err` or `result` depending on the state of `result_ok`.
3201 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
3202 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
3203 pub result_ok: bool,
3206 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
3207 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
3208 CResult_PaymentPurposeDecodeErrorZ {
3209 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3210 result: Box::into_raw(Box::new(o)),
3216 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
3217 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
3218 CResult_PaymentPurposeDecodeErrorZ {
3219 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3220 err: Box::into_raw(Box::new(e)),
3225 /// Checks if the given object is currently in the success state
3227 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
3231 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
3232 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
3233 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
3234 fn drop(&mut self) {
3236 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3237 let _ = unsafe { Box::from_raw(self.contents.result) };
3240 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3241 let _ = unsafe { Box::from_raw(self.contents.err) };
3246 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
3247 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
3248 let contents = if o.result_ok {
3249 let result = unsafe { o.contents.result };
3250 unsafe { o.contents.result = core::ptr::null_mut() };
3251 CResult_PaymentPurposeDecodeErrorZPtr { result }
3253 let err = unsafe { o.contents.err };
3254 unsafe { o.contents.err = core::ptr::null_mut(); }
3255 CResult_PaymentPurposeDecodeErrorZPtr { err }
3259 result_ok: o.result_ok,
3263 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
3264 fn clone(&self) -> Self {
3266 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3267 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
3270 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3271 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3277 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
3278 /// but with all dynamically-allocated buffers duplicated in new buffers.
3279 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3282 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3283 pub enum COption_ClosureReasonZ {
3284 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3285 Some(crate::lightning::util::events::ClosureReason),
3286 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3289 impl COption_ClosureReasonZ {
3290 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3291 if let Self::None = self { false } else { true }
3293 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3296 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3297 if let Self::Some(v) = self { v } else { unreachable!() }
3301 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3302 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3303 COption_ClosureReasonZ::Some(o)
3306 /// Constructs a new COption_ClosureReasonZ containing nothing
3307 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3308 COption_ClosureReasonZ::None
3311 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3312 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3314 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3315 /// but with all dynamically-allocated buffers duplicated in new buffers.
3316 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3318 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3319 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3320 /// A pointer to the contents in the success state.
3321 /// Reading from this pointer when `result_ok` is not set is undefined.
3322 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3323 /// A pointer to the contents in the error state.
3324 /// Reading from this pointer when `result_ok` is set is undefined.
3325 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3328 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3329 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3331 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3332 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3333 /// `err` or `result` depending on the state of `result_ok`.
3334 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3335 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3336 pub result_ok: bool,
3339 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3340 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3341 CResult_COption_ClosureReasonZDecodeErrorZ {
3342 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3343 result: Box::into_raw(Box::new(o)),
3349 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3350 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3351 CResult_COption_ClosureReasonZDecodeErrorZ {
3352 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3353 err: Box::into_raw(Box::new(e)),
3358 /// Checks if the given object is currently in the success state
3360 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3364 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3365 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3366 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3367 fn drop(&mut self) {
3369 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3370 let _ = unsafe { Box::from_raw(self.contents.result) };
3373 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3374 let _ = unsafe { Box::from_raw(self.contents.err) };
3379 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3380 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3381 let contents = if o.result_ok {
3382 let result = unsafe { o.contents.result };
3383 unsafe { o.contents.result = core::ptr::null_mut() };
3384 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3386 let err = unsafe { o.contents.err };
3387 unsafe { o.contents.err = core::ptr::null_mut(); }
3388 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3392 result_ok: o.result_ok,
3396 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3397 fn clone(&self) -> Self {
3399 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3400 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3403 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3404 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3410 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3411 /// but with all dynamically-allocated buffers duplicated in new buffers.
3412 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3415 /// An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3416 pub enum COption_HTLCDestinationZ {
3417 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3418 Some(crate::lightning::util::events::HTLCDestination),
3419 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
3422 impl COption_HTLCDestinationZ {
3423 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3424 if let Self::None = self { false } else { true }
3426 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3429 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::HTLCDestination {
3430 if let Self::Some(v) = self { v } else { unreachable!() }
3434 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
3435 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::util::events::HTLCDestination) -> COption_HTLCDestinationZ {
3436 COption_HTLCDestinationZ::Some(o)
3439 /// Constructs a new COption_HTLCDestinationZ containing nothing
3440 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
3441 COption_HTLCDestinationZ::None
3444 /// Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
3445 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
3447 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
3448 /// but with all dynamically-allocated buffers duplicated in new buffers.
3449 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
3451 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3452 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3453 /// A pointer to the contents in the success state.
3454 /// Reading from this pointer when `result_ok` is not set is undefined.
3455 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
3456 /// A pointer to the contents in the error state.
3457 /// Reading from this pointer when `result_ok` is set is undefined.
3458 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3461 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3462 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3463 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3464 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
3465 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3466 /// `err` or `result` depending on the state of `result_ok`.
3467 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
3468 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3469 pub result_ok: bool,
3472 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
3473 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3474 CResult_COption_HTLCDestinationZDecodeErrorZ {
3475 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3476 result: Box::into_raw(Box::new(o)),
3482 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
3483 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3484 CResult_COption_HTLCDestinationZDecodeErrorZ {
3485 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3486 err: Box::into_raw(Box::new(e)),
3491 /// Checks if the given object is currently in the success state
3493 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
3497 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
3498 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
3499 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
3500 fn drop(&mut self) {
3502 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3503 let _ = unsafe { Box::from_raw(self.contents.result) };
3506 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3507 let _ = unsafe { Box::from_raw(self.contents.err) };
3512 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
3513 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3514 let contents = if o.result_ok {
3515 let result = unsafe { o.contents.result };
3516 unsafe { o.contents.result = core::ptr::null_mut() };
3517 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
3519 let err = unsafe { o.contents.err };
3520 unsafe { o.contents.err = core::ptr::null_mut(); }
3521 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
3525 result_ok: o.result_ok,
3529 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
3530 fn clone(&self) -> Self {
3532 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3533 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
3536 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3537 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3543 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
3544 /// but with all dynamically-allocated buffers duplicated in new buffers.
3545 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
3548 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3549 pub enum COption_NetworkUpdateZ {
3550 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3551 Some(crate::lightning::routing::gossip::NetworkUpdate),
3552 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3555 impl COption_NetworkUpdateZ {
3556 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3557 if let Self::None = self { false } else { true }
3559 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3562 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3563 if let Self::Some(v) = self { v } else { unreachable!() }
3567 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3568 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3569 COption_NetworkUpdateZ::Some(o)
3572 /// Constructs a new COption_NetworkUpdateZ containing nothing
3573 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3574 COption_NetworkUpdateZ::None
3577 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3578 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3580 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3581 /// but with all dynamically-allocated buffers duplicated in new buffers.
3582 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3584 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3585 /// This corresponds to std::vector in C++
3586 pub struct CVec_SpendableOutputDescriptorZ {
3587 /// The elements in the array.
3588 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3589 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3590 /// The number of elements pointed to by `data`.
3593 impl CVec_SpendableOutputDescriptorZ {
3594 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3595 if self.datalen == 0 { return Vec::new(); }
3596 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3597 self.data = core::ptr::null_mut();
3601 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3602 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3605 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3606 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3607 let datalen = v.len();
3608 let data = Box::into_raw(v.into_boxed_slice());
3609 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3613 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3614 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3615 impl Drop for CVec_SpendableOutputDescriptorZ {
3616 fn drop(&mut self) {
3617 if self.datalen == 0 { return; }
3618 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3621 impl Clone for CVec_SpendableOutputDescriptorZ {
3622 fn clone(&self) -> Self {
3623 let mut res = Vec::new();
3624 if self.datalen == 0 { return Self::from(res); }
3625 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3631 /// An enum which can either contain a crate::lightning::util::events::Event or not
3632 pub enum COption_EventZ {
3633 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3634 Some(crate::lightning::util::events::Event),
3635 /// When we're in this state, this COption_EventZ contains nothing
3638 impl COption_EventZ {
3639 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3640 if let Self::None = self { false } else { true }
3642 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3645 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3646 if let Self::Some(v) = self { v } else { unreachable!() }
3650 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3651 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3652 COption_EventZ::Some(o)
3655 /// Constructs a new COption_EventZ containing nothing
3656 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3657 COption_EventZ::None
3660 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3661 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3663 /// Creates a new COption_EventZ which has the same data as `orig`
3664 /// but with all dynamically-allocated buffers duplicated in new buffers.
3665 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3667 /// The contents of CResult_COption_EventZDecodeErrorZ
3668 pub union CResult_COption_EventZDecodeErrorZPtr {
3669 /// A pointer to the contents in the success state.
3670 /// Reading from this pointer when `result_ok` is not set is undefined.
3671 pub result: *mut crate::c_types::derived::COption_EventZ,
3672 /// A pointer to the contents in the error state.
3673 /// Reading from this pointer when `result_ok` is set is undefined.
3674 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3677 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3678 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3680 pub struct CResult_COption_EventZDecodeErrorZ {
3681 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3682 /// `err` or `result` depending on the state of `result_ok`.
3683 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3684 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3685 pub result_ok: bool,
3688 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3689 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3690 CResult_COption_EventZDecodeErrorZ {
3691 contents: CResult_COption_EventZDecodeErrorZPtr {
3692 result: Box::into_raw(Box::new(o)),
3698 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3699 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3700 CResult_COption_EventZDecodeErrorZ {
3701 contents: CResult_COption_EventZDecodeErrorZPtr {
3702 err: Box::into_raw(Box::new(e)),
3707 /// Checks if the given object is currently in the success state
3709 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3713 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3714 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3715 impl Drop for CResult_COption_EventZDecodeErrorZ {
3716 fn drop(&mut self) {
3718 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3719 let _ = unsafe { Box::from_raw(self.contents.result) };
3722 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3723 let _ = unsafe { Box::from_raw(self.contents.err) };
3728 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3729 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3730 let contents = if o.result_ok {
3731 let result = unsafe { o.contents.result };
3732 unsafe { o.contents.result = core::ptr::null_mut() };
3733 CResult_COption_EventZDecodeErrorZPtr { result }
3735 let err = unsafe { o.contents.err };
3736 unsafe { o.contents.err = core::ptr::null_mut(); }
3737 CResult_COption_EventZDecodeErrorZPtr { err }
3741 result_ok: o.result_ok,
3745 impl Clone for CResult_COption_EventZDecodeErrorZ {
3746 fn clone(&self) -> Self {
3748 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3749 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3752 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3753 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3759 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3760 /// but with all dynamically-allocated buffers duplicated in new buffers.
3761 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3763 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3764 /// This corresponds to std::vector in C++
3765 pub struct CVec_MessageSendEventZ {
3766 /// The elements in the array.
3767 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3768 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3769 /// The number of elements pointed to by `data`.
3772 impl CVec_MessageSendEventZ {
3773 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3774 if self.datalen == 0 { return Vec::new(); }
3775 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3776 self.data = core::ptr::null_mut();
3780 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3781 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3784 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3785 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3786 let datalen = v.len();
3787 let data = Box::into_raw(v.into_boxed_slice());
3788 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3792 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3793 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3794 impl Drop for CVec_MessageSendEventZ {
3795 fn drop(&mut self) {
3796 if self.datalen == 0 { return; }
3797 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3800 impl Clone for CVec_MessageSendEventZ {
3801 fn clone(&self) -> Self {
3802 let mut res = Vec::new();
3803 if self.datalen == 0 { return Self::from(res); }
3804 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3809 /// The contents of CResult_TxOutAccessErrorZ
3810 pub union CResult_TxOutAccessErrorZPtr {
3811 /// A pointer to the contents in the success state.
3812 /// Reading from this pointer when `result_ok` is not set is undefined.
3813 pub result: *mut crate::c_types::TxOut,
3814 /// A pointer to the contents in the error state.
3815 /// Reading from this pointer when `result_ok` is set is undefined.
3816 pub err: *mut crate::lightning::chain::AccessError,
3819 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3820 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3821 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3822 pub struct CResult_TxOutAccessErrorZ {
3823 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3824 /// `err` or `result` depending on the state of `result_ok`.
3825 pub contents: CResult_TxOutAccessErrorZPtr,
3826 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3827 pub result_ok: bool,
3830 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3831 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3832 CResult_TxOutAccessErrorZ {
3833 contents: CResult_TxOutAccessErrorZPtr {
3834 result: Box::into_raw(Box::new(o)),
3840 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3841 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3842 CResult_TxOutAccessErrorZ {
3843 contents: CResult_TxOutAccessErrorZPtr {
3844 err: Box::into_raw(Box::new(e)),
3849 /// Checks if the given object is currently in the success state
3851 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3855 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3856 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3857 impl Drop for CResult_TxOutAccessErrorZ {
3858 fn drop(&mut self) {
3860 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3861 let _ = unsafe { Box::from_raw(self.contents.result) };
3864 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3865 let _ = unsafe { Box::from_raw(self.contents.err) };
3870 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3871 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3872 let contents = if o.result_ok {
3873 let result = unsafe { o.contents.result };
3874 unsafe { o.contents.result = core::ptr::null_mut() };
3875 CResult_TxOutAccessErrorZPtr { result }
3877 let err = unsafe { o.contents.err };
3878 unsafe { o.contents.err = core::ptr::null_mut(); }
3879 CResult_TxOutAccessErrorZPtr { err }
3883 result_ok: o.result_ok,
3887 impl Clone for CResult_TxOutAccessErrorZ {
3888 fn clone(&self) -> Self {
3890 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3891 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3894 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3895 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3901 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3902 /// but with all dynamically-allocated buffers duplicated in new buffers.
3903 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3905 /// A tuple of 2 elements. See the individual fields for the types contained.
3906 pub struct C2Tuple_usizeTransactionZ {
3907 /// The element at position 0
3909 /// The element at position 1
3910 pub b: crate::c_types::Transaction,
3912 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3913 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3920 impl C2Tuple_usizeTransactionZ {
3921 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3925 impl Clone for C2Tuple_usizeTransactionZ {
3926 fn clone(&self) -> Self {
3928 a: Clone::clone(&self.a),
3929 b: Clone::clone(&self.b),
3934 /// Creates a new tuple which has the same data as `orig`
3935 /// but with all dynamically-allocated buffers duplicated in new buffers.
3936 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3937 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3939 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3940 C2Tuple_usizeTransactionZ { a, b, }
3944 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3945 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3947 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3948 /// This corresponds to std::vector in C++
3949 pub struct CVec_C2Tuple_usizeTransactionZZ {
3950 /// The elements in the array.
3951 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3952 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3953 /// The number of elements pointed to by `data`.
3956 impl CVec_C2Tuple_usizeTransactionZZ {
3957 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3958 if self.datalen == 0 { return Vec::new(); }
3959 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3960 self.data = core::ptr::null_mut();
3964 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3965 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3968 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3969 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3970 let datalen = v.len();
3971 let data = Box::into_raw(v.into_boxed_slice());
3972 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3976 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3977 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3978 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3979 fn drop(&mut self) {
3980 if self.datalen == 0 { return; }
3981 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3984 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3985 fn clone(&self) -> Self {
3986 let mut res = Vec::new();
3987 if self.datalen == 0 { return Self::from(res); }
3988 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3993 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3994 /// This corresponds to std::vector in C++
3995 pub struct CVec_TxidZ {
3996 /// The elements in the array.
3997 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3998 pub data: *mut crate::c_types::ThirtyTwoBytes,
3999 /// The number of elements pointed to by `data`.
4003 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4004 if self.datalen == 0 { return Vec::new(); }
4005 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4006 self.data = core::ptr::null_mut();
4010 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4011 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4014 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
4015 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4016 let datalen = v.len();
4017 let data = Box::into_raw(v.into_boxed_slice());
4018 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4022 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4023 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
4024 impl Drop for CVec_TxidZ {
4025 fn drop(&mut self) {
4026 if self.datalen == 0 { return; }
4027 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4030 impl Clone for CVec_TxidZ {
4031 fn clone(&self) -> Self {
4032 let mut res = Vec::new();
4033 if self.datalen == 0 { return Self::from(res); }
4034 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4039 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4040 /// This corresponds to std::vector in C++
4041 pub struct CVec_MonitorEventZ {
4042 /// The elements in the array.
4043 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4044 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
4045 /// The number of elements pointed to by `data`.
4048 impl CVec_MonitorEventZ {
4049 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
4050 if self.datalen == 0 { return Vec::new(); }
4051 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4052 self.data = core::ptr::null_mut();
4056 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
4057 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4060 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4061 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
4062 let datalen = v.len();
4063 let data = Box::into_raw(v.into_boxed_slice());
4064 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4068 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4069 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4070 impl Drop for CVec_MonitorEventZ {
4071 fn drop(&mut self) {
4072 if self.datalen == 0 { return; }
4073 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4076 impl Clone for CVec_MonitorEventZ {
4077 fn clone(&self) -> Self {
4078 let mut res = Vec::new();
4079 if self.datalen == 0 { return Self::from(res); }
4080 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4085 /// A tuple of 3 elements. See the individual fields for the types contained.
4086 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4087 /// The element at position 0
4088 pub a: crate::lightning::chain::transaction::OutPoint,
4089 /// The element at position 1
4090 pub b: crate::c_types::derived::CVec_MonitorEventZ,
4091 /// The element at position 2
4092 pub c: crate::c_types::PublicKey,
4094 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4095 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4103 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4104 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4105 (self.a, self.b, self.c)
4108 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4109 fn clone(&self) -> Self {
4111 a: Clone::clone(&self.a),
4112 b: Clone::clone(&self.b),
4113 c: Clone::clone(&self.c),
4118 /// Creates a new tuple which has the same data as `orig`
4119 /// but with all dynamically-allocated buffers duplicated in new buffers.
4120 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4121 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4123 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4124 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4128 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4129 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4131 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4132 /// This corresponds to std::vector in C++
4133 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4134 /// The elements in the array.
4135 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4136 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4137 /// The number of elements pointed to by `data`.
4140 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4141 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4142 if self.datalen == 0 { return Vec::new(); }
4143 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4144 self.data = core::ptr::null_mut();
4148 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4149 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4152 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4153 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4154 let datalen = v.len();
4155 let data = Box::into_raw(v.into_boxed_slice());
4156 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4160 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4161 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4162 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4163 fn drop(&mut self) {
4164 if self.datalen == 0 { return; }
4165 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4168 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4169 fn clone(&self) -> Self {
4170 let mut res = Vec::new();
4171 if self.datalen == 0 { return Self::from(res); }
4172 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4177 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4178 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4179 /// A pointer to the contents in the success state.
4180 /// Reading from this pointer when `result_ok` is not set is undefined.
4181 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4182 /// A pointer to the contents in the error state.
4183 /// Reading from this pointer when `result_ok` is set is undefined.
4184 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4187 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4188 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4190 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4191 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4192 /// `err` or `result` depending on the state of `result_ok`.
4193 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4194 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4195 pub result_ok: bool,
4198 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4199 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4200 CResult_FixedPenaltyScorerDecodeErrorZ {
4201 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4202 result: Box::into_raw(Box::new(o)),
4208 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4209 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4210 CResult_FixedPenaltyScorerDecodeErrorZ {
4211 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4212 err: Box::into_raw(Box::new(e)),
4217 /// Checks if the given object is currently in the success state
4219 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4223 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4224 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4225 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4226 fn drop(&mut self) {
4228 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4229 let _ = unsafe { Box::from_raw(self.contents.result) };
4232 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4233 let _ = unsafe { Box::from_raw(self.contents.err) };
4238 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4239 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4240 let contents = if o.result_ok {
4241 let result = unsafe { o.contents.result };
4242 unsafe { o.contents.result = core::ptr::null_mut() };
4243 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4245 let err = unsafe { o.contents.err };
4246 unsafe { o.contents.err = core::ptr::null_mut(); }
4247 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4251 result_ok: o.result_ok,
4255 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4256 fn clone(&self) -> Self {
4258 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4259 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4262 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4263 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4269 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4270 /// but with all dynamically-allocated buffers duplicated in new buffers.
4271 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4273 /// A tuple of 2 elements. See the individual fields for the types contained.
4274 pub struct C2Tuple_u64u64Z {
4275 /// The element at position 0
4277 /// The element at position 1
4280 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4281 fn from (tup: (u64, u64)) -> Self {
4288 impl C2Tuple_u64u64Z {
4289 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4293 impl Clone for C2Tuple_u64u64Z {
4294 fn clone(&self) -> Self {
4296 a: Clone::clone(&self.a),
4297 b: Clone::clone(&self.b),
4302 /// Creates a new tuple which has the same data as `orig`
4303 /// but with all dynamically-allocated buffers duplicated in new buffers.
4304 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4305 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4307 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4308 C2Tuple_u64u64Z { a, b, }
4312 /// Frees any resources used by the C2Tuple_u64u64Z.
4313 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4316 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4317 pub enum COption_C2Tuple_u64u64ZZ {
4318 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4319 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4320 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4323 impl COption_C2Tuple_u64u64ZZ {
4324 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4325 if let Self::None = self { false } else { true }
4327 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4330 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4331 if let Self::Some(v) = self { v } else { unreachable!() }
4335 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4336 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4337 COption_C2Tuple_u64u64ZZ::Some(o)
4340 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4341 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4342 COption_C2Tuple_u64u64ZZ::None
4345 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4346 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4348 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4349 /// but with all dynamically-allocated buffers duplicated in new buffers.
4350 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4352 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4353 /// This corresponds to std::vector in C++
4354 pub struct CVec_NodeIdZ {
4355 /// The elements in the array.
4356 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4357 pub data: *mut crate::lightning::routing::gossip::NodeId,
4358 /// The number of elements pointed to by `data`.
4362 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4363 if self.datalen == 0 { return Vec::new(); }
4364 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4365 self.data = core::ptr::null_mut();
4369 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4370 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4373 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4374 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4375 let datalen = v.len();
4376 let data = Box::into_raw(v.into_boxed_slice());
4377 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4381 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4382 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4383 impl Drop for CVec_NodeIdZ {
4384 fn drop(&mut self) {
4385 if self.datalen == 0 { return; }
4386 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4389 impl Clone for CVec_NodeIdZ {
4390 fn clone(&self) -> Self {
4391 let mut res = Vec::new();
4392 if self.datalen == 0 { return Self::from(res); }
4393 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4398 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4399 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4400 /// A pointer to the contents in the success state.
4401 /// Reading from this pointer when `result_ok` is not set is undefined.
4402 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4403 /// A pointer to the contents in the error state.
4404 /// Reading from this pointer when `result_ok` is set is undefined.
4405 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4408 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4409 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4411 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4412 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4413 /// `err` or `result` depending on the state of `result_ok`.
4414 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4415 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4416 pub result_ok: bool,
4419 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4420 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4421 CResult_ProbabilisticScorerDecodeErrorZ {
4422 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4423 result: Box::into_raw(Box::new(o)),
4429 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4430 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4431 CResult_ProbabilisticScorerDecodeErrorZ {
4432 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4433 err: Box::into_raw(Box::new(e)),
4438 /// Checks if the given object is currently in the success state
4440 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4444 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4445 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4446 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4447 fn drop(&mut self) {
4449 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4450 let _ = unsafe { Box::from_raw(self.contents.result) };
4453 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4454 let _ = unsafe { Box::from_raw(self.contents.err) };
4459 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4460 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4461 let contents = if o.result_ok {
4462 let result = unsafe { o.contents.result };
4463 unsafe { o.contents.result = core::ptr::null_mut() };
4464 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4466 let err = unsafe { o.contents.err };
4467 unsafe { o.contents.err = core::ptr::null_mut(); }
4468 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4472 result_ok: o.result_ok,
4477 /// The contents of CResult_InitFeaturesDecodeErrorZ
4478 pub union CResult_InitFeaturesDecodeErrorZPtr {
4479 /// A pointer to the contents in the success state.
4480 /// Reading from this pointer when `result_ok` is not set is undefined.
4481 pub result: *mut crate::lightning::ln::features::InitFeatures,
4482 /// A pointer to the contents in the error state.
4483 /// Reading from this pointer when `result_ok` is set is undefined.
4484 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4487 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4488 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4490 pub struct CResult_InitFeaturesDecodeErrorZ {
4491 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4492 /// `err` or `result` depending on the state of `result_ok`.
4493 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4494 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4495 pub result_ok: bool,
4498 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4499 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4500 CResult_InitFeaturesDecodeErrorZ {
4501 contents: CResult_InitFeaturesDecodeErrorZPtr {
4502 result: Box::into_raw(Box::new(o)),
4508 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4509 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4510 CResult_InitFeaturesDecodeErrorZ {
4511 contents: CResult_InitFeaturesDecodeErrorZPtr {
4512 err: Box::into_raw(Box::new(e)),
4517 /// Checks if the given object is currently in the success state
4519 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4523 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4524 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4525 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4526 fn drop(&mut self) {
4528 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4529 let _ = unsafe { Box::from_raw(self.contents.result) };
4532 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4533 let _ = unsafe { Box::from_raw(self.contents.err) };
4538 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4539 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4540 let contents = if o.result_ok {
4541 let result = unsafe { o.contents.result };
4542 unsafe { o.contents.result = core::ptr::null_mut() };
4543 CResult_InitFeaturesDecodeErrorZPtr { result }
4545 let err = unsafe { o.contents.err };
4546 unsafe { o.contents.err = core::ptr::null_mut(); }
4547 CResult_InitFeaturesDecodeErrorZPtr { err }
4551 result_ok: o.result_ok,
4555 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4556 fn clone(&self) -> Self {
4558 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4559 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4562 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4563 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4569 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4570 /// but with all dynamically-allocated buffers duplicated in new buffers.
4571 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4573 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4574 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
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::ln::features::ChannelFeatures,
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_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4584 /// containing a crate::lightning::ln::features::ChannelFeatures 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_ChannelFeaturesDecodeErrorZ {
4587 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4588 /// `err` or `result` depending on the state of `result_ok`.
4589 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4590 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4591 pub result_ok: bool,
4594 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4595 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4596 CResult_ChannelFeaturesDecodeErrorZ {
4597 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4598 result: Box::into_raw(Box::new(o)),
4604 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4605 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4606 CResult_ChannelFeaturesDecodeErrorZ {
4607 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
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_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4619 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4620 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4621 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
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::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4635 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, 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 = core::ptr::null_mut() };
4639 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4641 let err = unsafe { o.contents.err };
4642 unsafe { o.contents.err = core::ptr::null_mut(); }
4643 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4647 result_ok: o.result_ok,
4651 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4652 fn clone(&self) -> Self {
4654 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4655 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4658 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4659 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4665 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4666 /// but with all dynamically-allocated buffers duplicated in new buffers.
4667 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4669 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4670 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4671 /// A pointer to the contents in the success state.
4672 /// Reading from this pointer when `result_ok` is not set is undefined.
4673 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4674 /// A pointer to the contents in the error state.
4675 /// Reading from this pointer when `result_ok` is set is undefined.
4676 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4679 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4680 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4682 pub struct CResult_NodeFeaturesDecodeErrorZ {
4683 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4684 /// `err` or `result` depending on the state of `result_ok`.
4685 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4686 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4687 pub result_ok: bool,
4690 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4691 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4692 CResult_NodeFeaturesDecodeErrorZ {
4693 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4694 result: Box::into_raw(Box::new(o)),
4700 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4701 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4702 CResult_NodeFeaturesDecodeErrorZ {
4703 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4704 err: Box::into_raw(Box::new(e)),
4709 /// Checks if the given object is currently in the success state
4711 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4715 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4716 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4717 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4718 fn drop(&mut self) {
4720 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4721 let _ = unsafe { Box::from_raw(self.contents.result) };
4724 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4725 let _ = unsafe { Box::from_raw(self.contents.err) };
4730 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4731 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4732 let contents = if o.result_ok {
4733 let result = unsafe { o.contents.result };
4734 unsafe { o.contents.result = core::ptr::null_mut() };
4735 CResult_NodeFeaturesDecodeErrorZPtr { result }
4737 let err = unsafe { o.contents.err };
4738 unsafe { o.contents.err = core::ptr::null_mut(); }
4739 CResult_NodeFeaturesDecodeErrorZPtr { err }
4743 result_ok: o.result_ok,
4747 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4748 fn clone(&self) -> Self {
4750 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4751 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4754 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4755 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4761 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4762 /// but with all dynamically-allocated buffers duplicated in new buffers.
4763 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4765 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4766 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4767 /// A pointer to the contents in the success state.
4768 /// Reading from this pointer when `result_ok` is not set is undefined.
4769 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4770 /// A pointer to the contents in the error state.
4771 /// Reading from this pointer when `result_ok` is set is undefined.
4772 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4775 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4776 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4777 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4778 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4779 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4780 /// `err` or `result` depending on the state of `result_ok`.
4781 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4782 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4783 pub result_ok: bool,
4786 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4787 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4788 CResult_InvoiceFeaturesDecodeErrorZ {
4789 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4790 result: Box::into_raw(Box::new(o)),
4796 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4797 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4798 CResult_InvoiceFeaturesDecodeErrorZ {
4799 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4800 err: Box::into_raw(Box::new(e)),
4805 /// Checks if the given object is currently in the success state
4807 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4811 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4812 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4813 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4814 fn drop(&mut self) {
4816 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4817 let _ = unsafe { Box::from_raw(self.contents.result) };
4820 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4821 let _ = unsafe { Box::from_raw(self.contents.err) };
4826 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4827 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4828 let contents = if o.result_ok {
4829 let result = unsafe { o.contents.result };
4830 unsafe { o.contents.result = core::ptr::null_mut() };
4831 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4833 let err = unsafe { o.contents.err };
4834 unsafe { o.contents.err = core::ptr::null_mut(); }
4835 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4839 result_ok: o.result_ok,
4843 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4844 fn clone(&self) -> Self {
4846 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4847 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4850 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4851 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4857 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4858 /// but with all dynamically-allocated buffers duplicated in new buffers.
4859 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4861 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4862 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4863 /// A pointer to the contents in the success state.
4864 /// Reading from this pointer when `result_ok` is not set is undefined.
4865 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4866 /// A pointer to the contents in the error state.
4867 /// Reading from this pointer when `result_ok` is set is undefined.
4868 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4871 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4872 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4874 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4875 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4876 /// `err` or `result` depending on the state of `result_ok`.
4877 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4878 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4879 pub result_ok: bool,
4882 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4883 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4884 CResult_ChannelTypeFeaturesDecodeErrorZ {
4885 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4886 result: Box::into_raw(Box::new(o)),
4892 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4893 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4894 CResult_ChannelTypeFeaturesDecodeErrorZ {
4895 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4896 err: Box::into_raw(Box::new(e)),
4901 /// Checks if the given object is currently in the success state
4903 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4907 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4908 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4909 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4910 fn drop(&mut self) {
4912 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4913 let _ = unsafe { Box::from_raw(self.contents.result) };
4916 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4917 let _ = unsafe { Box::from_raw(self.contents.err) };
4922 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4923 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4924 let contents = if o.result_ok {
4925 let result = unsafe { o.contents.result };
4926 unsafe { o.contents.result = core::ptr::null_mut() };
4927 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4929 let err = unsafe { o.contents.err };
4930 unsafe { o.contents.err = core::ptr::null_mut(); }
4931 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4935 result_ok: o.result_ok,
4939 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4940 fn clone(&self) -> Self {
4942 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4943 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4946 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4947 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4953 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4954 /// but with all dynamically-allocated buffers duplicated in new buffers.
4955 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4957 /// The contents of CResult_NodeIdDecodeErrorZ
4958 pub union CResult_NodeIdDecodeErrorZPtr {
4959 /// A pointer to the contents in the success state.
4960 /// Reading from this pointer when `result_ok` is not set is undefined.
4961 pub result: *mut crate::lightning::routing::gossip::NodeId,
4962 /// A pointer to the contents in the error state.
4963 /// Reading from this pointer when `result_ok` is set is undefined.
4964 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4967 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4968 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4969 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4970 pub struct CResult_NodeIdDecodeErrorZ {
4971 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4972 /// `err` or `result` depending on the state of `result_ok`.
4973 pub contents: CResult_NodeIdDecodeErrorZPtr,
4974 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4975 pub result_ok: bool,
4978 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4979 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4980 CResult_NodeIdDecodeErrorZ {
4981 contents: CResult_NodeIdDecodeErrorZPtr {
4982 result: Box::into_raw(Box::new(o)),
4988 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4989 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4990 CResult_NodeIdDecodeErrorZ {
4991 contents: CResult_NodeIdDecodeErrorZPtr {
4992 err: Box::into_raw(Box::new(e)),
4997 /// Checks if the given object is currently in the success state
4999 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5003 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5004 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5005 impl Drop for CResult_NodeIdDecodeErrorZ {
5006 fn drop(&mut self) {
5008 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5009 let _ = unsafe { Box::from_raw(self.contents.result) };
5012 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5013 let _ = unsafe { Box::from_raw(self.contents.err) };
5018 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5019 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5020 let contents = if o.result_ok {
5021 let result = unsafe { o.contents.result };
5022 unsafe { o.contents.result = core::ptr::null_mut() };
5023 CResult_NodeIdDecodeErrorZPtr { result }
5025 let err = unsafe { o.contents.err };
5026 unsafe { o.contents.err = core::ptr::null_mut(); }
5027 CResult_NodeIdDecodeErrorZPtr { err }
5031 result_ok: o.result_ok,
5035 impl Clone for CResult_NodeIdDecodeErrorZ {
5036 fn clone(&self) -> Self {
5038 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5039 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5042 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5043 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5049 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5050 /// but with all dynamically-allocated buffers duplicated in new buffers.
5051 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5053 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5054 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5055 /// A pointer to the contents in the success state.
5056 /// Reading from this pointer when `result_ok` is not set is undefined.
5057 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
5058 /// A pointer to the contents in the error state.
5059 /// Reading from this pointer when `result_ok` is set is undefined.
5060 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5063 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5064 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5065 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5066 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
5067 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5068 /// `err` or `result` depending on the state of `result_ok`.
5069 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
5070 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5071 pub result_ok: bool,
5074 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
5075 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5076 CResult_COption_NetworkUpdateZDecodeErrorZ {
5077 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5078 result: Box::into_raw(Box::new(o)),
5084 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
5085 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5086 CResult_COption_NetworkUpdateZDecodeErrorZ {
5087 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5088 err: Box::into_raw(Box::new(e)),
5093 /// Checks if the given object is currently in the success state
5095 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
5099 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
5100 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
5101 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
5102 fn drop(&mut self) {
5104 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5105 let _ = unsafe { Box::from_raw(self.contents.result) };
5108 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5109 let _ = unsafe { Box::from_raw(self.contents.err) };
5114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
5115 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5116 let contents = if o.result_ok {
5117 let result = unsafe { o.contents.result };
5118 unsafe { o.contents.result = core::ptr::null_mut() };
5119 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
5121 let err = unsafe { o.contents.err };
5122 unsafe { o.contents.err = core::ptr::null_mut(); }
5123 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
5127 result_ok: o.result_ok,
5131 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
5132 fn clone(&self) -> Self {
5134 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5135 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5138 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5139 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5145 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5146 /// but with all dynamically-allocated buffers duplicated in new buffers.
5147 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5149 /// An enum which can either contain a crate::lightning::chain::Access or not
5150 pub enum COption_AccessZ {
5151 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5152 Some(crate::lightning::chain::Access),
5153 /// When we're in this state, this COption_AccessZ contains nothing
5156 impl COption_AccessZ {
5157 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5158 if let Self::None = self { false } else { true }
5160 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5163 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
5164 if let Self::Some(v) = self { v } else { unreachable!() }
5168 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
5169 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
5170 COption_AccessZ::Some(o)
5173 /// Constructs a new COption_AccessZ containing nothing
5174 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
5175 COption_AccessZ::None
5178 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
5179 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
5181 /// The contents of CResult_boolLightningErrorZ
5182 pub union CResult_boolLightningErrorZPtr {
5183 /// A pointer to the contents in the success state.
5184 /// Reading from this pointer when `result_ok` is not set is undefined.
5185 pub result: *mut bool,
5186 /// A pointer to the contents in the error state.
5187 /// Reading from this pointer when `result_ok` is set is undefined.
5188 pub err: *mut crate::lightning::ln::msgs::LightningError,
5191 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5192 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5194 pub struct CResult_boolLightningErrorZ {
5195 /// The contents of this CResult_boolLightningErrorZ, accessible via either
5196 /// `err` or `result` depending on the state of `result_ok`.
5197 pub contents: CResult_boolLightningErrorZPtr,
5198 /// Whether this CResult_boolLightningErrorZ represents a success state.
5199 pub result_ok: bool,
5202 /// Creates a new CResult_boolLightningErrorZ in the success state.
5203 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5204 CResult_boolLightningErrorZ {
5205 contents: CResult_boolLightningErrorZPtr {
5206 result: Box::into_raw(Box::new(o)),
5212 /// Creates a new CResult_boolLightningErrorZ in the error state.
5213 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5214 CResult_boolLightningErrorZ {
5215 contents: CResult_boolLightningErrorZPtr {
5216 err: Box::into_raw(Box::new(e)),
5221 /// Checks if the given object is currently in the success state
5223 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5227 /// Frees any resources used by the CResult_boolLightningErrorZ.
5228 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5229 impl Drop for CResult_boolLightningErrorZ {
5230 fn drop(&mut self) {
5232 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5233 let _ = unsafe { Box::from_raw(self.contents.result) };
5236 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5237 let _ = unsafe { Box::from_raw(self.contents.err) };
5242 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5243 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5244 let contents = if o.result_ok {
5245 let result = unsafe { o.contents.result };
5246 unsafe { o.contents.result = core::ptr::null_mut() };
5247 CResult_boolLightningErrorZPtr { result }
5249 let err = unsafe { o.contents.err };
5250 unsafe { o.contents.err = core::ptr::null_mut(); }
5251 CResult_boolLightningErrorZPtr { err }
5255 result_ok: o.result_ok,
5259 impl Clone for CResult_boolLightningErrorZ {
5260 fn clone(&self) -> Self {
5262 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5263 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5266 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5267 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5273 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5274 /// but with all dynamically-allocated buffers duplicated in new buffers.
5275 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5277 /// A tuple of 3 elements. See the individual fields for the types contained.
5278 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5279 /// The element at position 0
5280 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5281 /// The element at position 1
5282 pub b: crate::lightning::ln::msgs::ChannelUpdate,
5283 /// The element at position 2
5284 pub c: crate::lightning::ln::msgs::ChannelUpdate,
5286 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5287 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5295 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5296 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5297 (self.a, self.b, self.c)
5300 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5301 fn clone(&self) -> Self {
5303 a: Clone::clone(&self.a),
5304 b: Clone::clone(&self.b),
5305 c: Clone::clone(&self.c),
5310 /// Creates a new tuple which has the same data as `orig`
5311 /// but with all dynamically-allocated buffers duplicated in new buffers.
5312 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5313 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5315 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 {
5316 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5320 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5321 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5324 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5325 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5326 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5327 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
5328 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5331 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5332 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5333 if let Self::None = self { false } else { true }
5335 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5338 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5339 if let Self::Some(v) = self { v } else { unreachable!() }
5343 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5344 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5345 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
5348 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
5349 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5350 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
5353 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
5354 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5356 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
5357 /// but with all dynamically-allocated buffers duplicated in new buffers.
5358 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
5360 /// The contents of CResult_NoneLightningErrorZ
5361 pub union CResult_NoneLightningErrorZPtr {
5362 /// Note that this value is always NULL, as there are no contents in the OK variant
5363 pub result: *mut core::ffi::c_void,
5364 /// A pointer to the contents in the error state.
5365 /// Reading from this pointer when `result_ok` is set is undefined.
5366 pub err: *mut crate::lightning::ln::msgs::LightningError,
5369 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5370 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5371 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5372 pub struct CResult_NoneLightningErrorZ {
5373 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5374 /// `err` or `result` depending on the state of `result_ok`.
5375 pub contents: CResult_NoneLightningErrorZPtr,
5376 /// Whether this CResult_NoneLightningErrorZ represents a success state.
5377 pub result_ok: bool,
5380 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5381 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5382 CResult_NoneLightningErrorZ {
5383 contents: CResult_NoneLightningErrorZPtr {
5384 result: core::ptr::null_mut(),
5390 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5391 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5392 CResult_NoneLightningErrorZ {
5393 contents: CResult_NoneLightningErrorZPtr {
5394 err: Box::into_raw(Box::new(e)),
5399 /// Checks if the given object is currently in the success state
5401 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5405 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5406 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5407 impl Drop for CResult_NoneLightningErrorZ {
5408 fn drop(&mut self) {
5411 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5412 let _ = unsafe { Box::from_raw(self.contents.err) };
5417 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5418 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5419 let contents = if o.result_ok {
5420 let _ = unsafe { Box::from_raw(o.contents.result) };
5421 o.contents.result = core::ptr::null_mut();
5422 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5424 let err = unsafe { o.contents.err };
5425 unsafe { o.contents.err = core::ptr::null_mut(); }
5426 CResult_NoneLightningErrorZPtr { err }
5430 result_ok: o.result_ok,
5434 impl Clone for CResult_NoneLightningErrorZ {
5435 fn clone(&self) -> Self {
5437 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5438 result: core::ptr::null_mut()
5441 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5442 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5448 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5449 /// but with all dynamically-allocated buffers duplicated in new buffers.
5450 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5452 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5453 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5454 /// A pointer to the contents in the success state.
5455 /// Reading from this pointer when `result_ok` is not set is undefined.
5456 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5457 /// A pointer to the contents in the error state.
5458 /// Reading from this pointer when `result_ok` is set is undefined.
5459 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5462 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5463 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5465 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5466 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5467 /// `err` or `result` depending on the state of `result_ok`.
5468 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5469 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5470 pub result_ok: bool,
5473 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5474 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5475 CResult_ChannelUpdateInfoDecodeErrorZ {
5476 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5477 result: Box::into_raw(Box::new(o)),
5483 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5484 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5485 CResult_ChannelUpdateInfoDecodeErrorZ {
5486 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5487 err: Box::into_raw(Box::new(e)),
5492 /// Checks if the given object is currently in the success state
5494 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5498 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5499 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5500 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5501 fn drop(&mut self) {
5503 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5504 let _ = unsafe { Box::from_raw(self.contents.result) };
5507 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5508 let _ = unsafe { Box::from_raw(self.contents.err) };
5513 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5514 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5515 let contents = if o.result_ok {
5516 let result = unsafe { o.contents.result };
5517 unsafe { o.contents.result = core::ptr::null_mut() };
5518 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5520 let err = unsafe { o.contents.err };
5521 unsafe { o.contents.err = core::ptr::null_mut(); }
5522 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5526 result_ok: o.result_ok,
5530 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5531 fn clone(&self) -> Self {
5533 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5534 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5537 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5538 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5544 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5545 /// but with all dynamically-allocated buffers duplicated in new buffers.
5546 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5548 /// The contents of CResult_ChannelInfoDecodeErrorZ
5549 pub union CResult_ChannelInfoDecodeErrorZPtr {
5550 /// A pointer to the contents in the success state.
5551 /// Reading from this pointer when `result_ok` is not set is undefined.
5552 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5553 /// A pointer to the contents in the error state.
5554 /// Reading from this pointer when `result_ok` is set is undefined.
5555 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5558 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5559 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5561 pub struct CResult_ChannelInfoDecodeErrorZ {
5562 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5563 /// `err` or `result` depending on the state of `result_ok`.
5564 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5565 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5566 pub result_ok: bool,
5569 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5570 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5571 CResult_ChannelInfoDecodeErrorZ {
5572 contents: CResult_ChannelInfoDecodeErrorZPtr {
5573 result: Box::into_raw(Box::new(o)),
5579 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5580 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5581 CResult_ChannelInfoDecodeErrorZ {
5582 contents: CResult_ChannelInfoDecodeErrorZPtr {
5583 err: Box::into_raw(Box::new(e)),
5588 /// Checks if the given object is currently in the success state
5590 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5594 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5595 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5596 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5597 fn drop(&mut self) {
5599 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5600 let _ = unsafe { Box::from_raw(self.contents.result) };
5603 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5604 let _ = unsafe { Box::from_raw(self.contents.err) };
5609 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5610 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5611 let contents = if o.result_ok {
5612 let result = unsafe { o.contents.result };
5613 unsafe { o.contents.result = core::ptr::null_mut() };
5614 CResult_ChannelInfoDecodeErrorZPtr { result }
5616 let err = unsafe { o.contents.err };
5617 unsafe { o.contents.err = core::ptr::null_mut(); }
5618 CResult_ChannelInfoDecodeErrorZPtr { err }
5622 result_ok: o.result_ok,
5626 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5627 fn clone(&self) -> Self {
5629 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5630 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5633 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5634 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5640 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5641 /// but with all dynamically-allocated buffers duplicated in new buffers.
5642 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5644 /// The contents of CResult_RoutingFeesDecodeErrorZ
5645 pub union CResult_RoutingFeesDecodeErrorZPtr {
5646 /// A pointer to the contents in the success state.
5647 /// Reading from this pointer when `result_ok` is not set is undefined.
5648 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5649 /// A pointer to the contents in the error state.
5650 /// Reading from this pointer when `result_ok` is set is undefined.
5651 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5654 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5655 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5656 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5657 pub struct CResult_RoutingFeesDecodeErrorZ {
5658 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5659 /// `err` or `result` depending on the state of `result_ok`.
5660 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5661 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5662 pub result_ok: bool,
5665 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5666 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5667 CResult_RoutingFeesDecodeErrorZ {
5668 contents: CResult_RoutingFeesDecodeErrorZPtr {
5669 result: Box::into_raw(Box::new(o)),
5675 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5676 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5677 CResult_RoutingFeesDecodeErrorZ {
5678 contents: CResult_RoutingFeesDecodeErrorZPtr {
5679 err: Box::into_raw(Box::new(e)),
5684 /// Checks if the given object is currently in the success state
5686 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5690 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5691 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5692 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5693 fn drop(&mut self) {
5695 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5696 let _ = unsafe { Box::from_raw(self.contents.result) };
5699 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5700 let _ = unsafe { Box::from_raw(self.contents.err) };
5705 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5706 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5707 let contents = if o.result_ok {
5708 let result = unsafe { o.contents.result };
5709 unsafe { o.contents.result = core::ptr::null_mut() };
5710 CResult_RoutingFeesDecodeErrorZPtr { result }
5712 let err = unsafe { o.contents.err };
5713 unsafe { o.contents.err = core::ptr::null_mut(); }
5714 CResult_RoutingFeesDecodeErrorZPtr { err }
5718 result_ok: o.result_ok,
5722 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5723 fn clone(&self) -> Self {
5725 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5726 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5729 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5730 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5736 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5737 /// but with all dynamically-allocated buffers duplicated in new buffers.
5738 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5740 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5741 /// This corresponds to std::vector in C++
5742 pub struct CVec_NetAddressZ {
5743 /// The elements in the array.
5744 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5745 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5746 /// The number of elements pointed to by `data`.
5749 impl CVec_NetAddressZ {
5750 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5751 if self.datalen == 0 { return Vec::new(); }
5752 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5753 self.data = core::ptr::null_mut();
5757 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5758 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5761 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5762 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5763 let datalen = v.len();
5764 let data = Box::into_raw(v.into_boxed_slice());
5765 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5769 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5770 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5771 impl Drop for CVec_NetAddressZ {
5772 fn drop(&mut self) {
5773 if self.datalen == 0 { return; }
5774 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5777 impl Clone for CVec_NetAddressZ {
5778 fn clone(&self) -> Self {
5779 let mut res = Vec::new();
5780 if self.datalen == 0 { return Self::from(res); }
5781 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5786 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5787 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5788 /// A pointer to the contents in the success state.
5789 /// Reading from this pointer when `result_ok` is not set is undefined.
5790 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5791 /// A pointer to the contents in the error state.
5792 /// Reading from this pointer when `result_ok` is set is undefined.
5793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5796 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5797 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5799 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5800 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5801 /// `err` or `result` depending on the state of `result_ok`.
5802 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5803 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5804 pub result_ok: bool,
5807 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5808 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5809 CResult_NodeAnnouncementInfoDecodeErrorZ {
5810 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5811 result: Box::into_raw(Box::new(o)),
5817 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5818 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5819 CResult_NodeAnnouncementInfoDecodeErrorZ {
5820 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5821 err: Box::into_raw(Box::new(e)),
5826 /// Checks if the given object is currently in the success state
5828 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5832 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5833 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5834 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5835 fn drop(&mut self) {
5837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5838 let _ = unsafe { Box::from_raw(self.contents.result) };
5841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5842 let _ = unsafe { Box::from_raw(self.contents.err) };
5847 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5849 let contents = if o.result_ok {
5850 let result = unsafe { o.contents.result };
5851 unsafe { o.contents.result = core::ptr::null_mut() };
5852 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5854 let err = unsafe { o.contents.err };
5855 unsafe { o.contents.err = core::ptr::null_mut(); }
5856 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5860 result_ok: o.result_ok,
5864 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5865 fn clone(&self) -> Self {
5867 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5868 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5871 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5872 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5878 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5879 /// but with all dynamically-allocated buffers duplicated in new buffers.
5880 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5882 /// The contents of CResult_NodeAliasDecodeErrorZ
5883 pub union CResult_NodeAliasDecodeErrorZPtr {
5884 /// A pointer to the contents in the success state.
5885 /// Reading from this pointer when `result_ok` is not set is undefined.
5886 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
5887 /// A pointer to the contents in the error state.
5888 /// Reading from this pointer when `result_ok` is set is undefined.
5889 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5892 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5893 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5895 pub struct CResult_NodeAliasDecodeErrorZ {
5896 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5897 /// `err` or `result` depending on the state of `result_ok`.
5898 pub contents: CResult_NodeAliasDecodeErrorZPtr,
5899 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5900 pub result_ok: bool,
5903 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
5904 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
5905 CResult_NodeAliasDecodeErrorZ {
5906 contents: CResult_NodeAliasDecodeErrorZPtr {
5907 result: Box::into_raw(Box::new(o)),
5913 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
5914 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
5915 CResult_NodeAliasDecodeErrorZ {
5916 contents: CResult_NodeAliasDecodeErrorZPtr {
5917 err: Box::into_raw(Box::new(e)),
5922 /// Checks if the given object is currently in the success state
5924 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
5928 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
5929 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
5930 impl Drop for CResult_NodeAliasDecodeErrorZ {
5931 fn drop(&mut self) {
5933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5934 let _ = unsafe { Box::from_raw(self.contents.result) };
5937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5938 let _ = unsafe { Box::from_raw(self.contents.err) };
5943 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
5944 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
5945 let contents = if o.result_ok {
5946 let result = unsafe { o.contents.result };
5947 unsafe { o.contents.result = core::ptr::null_mut() };
5948 CResult_NodeAliasDecodeErrorZPtr { result }
5950 let err = unsafe { o.contents.err };
5951 unsafe { o.contents.err = core::ptr::null_mut(); }
5952 CResult_NodeAliasDecodeErrorZPtr { err }
5956 result_ok: o.result_ok,
5960 impl Clone for CResult_NodeAliasDecodeErrorZ {
5961 fn clone(&self) -> Self {
5963 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
5964 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
5967 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
5968 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5974 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
5975 /// but with all dynamically-allocated buffers duplicated in new buffers.
5976 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
5978 /// The contents of CResult_NodeInfoDecodeErrorZ
5979 pub union CResult_NodeInfoDecodeErrorZPtr {
5980 /// A pointer to the contents in the success state.
5981 /// Reading from this pointer when `result_ok` is not set is undefined.
5982 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5983 /// A pointer to the contents in the error state.
5984 /// Reading from this pointer when `result_ok` is set is undefined.
5985 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5988 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5989 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5991 pub struct CResult_NodeInfoDecodeErrorZ {
5992 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5993 /// `err` or `result` depending on the state of `result_ok`.
5994 pub contents: CResult_NodeInfoDecodeErrorZPtr,
5995 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5996 pub result_ok: bool,
5999 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6000 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6001 CResult_NodeInfoDecodeErrorZ {
6002 contents: CResult_NodeInfoDecodeErrorZPtr {
6003 result: Box::into_raw(Box::new(o)),
6009 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6010 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6011 CResult_NodeInfoDecodeErrorZ {
6012 contents: CResult_NodeInfoDecodeErrorZPtr {
6013 err: Box::into_raw(Box::new(e)),
6018 /// Checks if the given object is currently in the success state
6020 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
6024 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
6025 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
6026 impl Drop for CResult_NodeInfoDecodeErrorZ {
6027 fn drop(&mut self) {
6029 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6030 let _ = unsafe { Box::from_raw(self.contents.result) };
6033 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6034 let _ = unsafe { Box::from_raw(self.contents.err) };
6039 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
6040 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6041 let contents = if o.result_ok {
6042 let result = unsafe { o.contents.result };
6043 unsafe { o.contents.result = core::ptr::null_mut() };
6044 CResult_NodeInfoDecodeErrorZPtr { result }
6046 let err = unsafe { o.contents.err };
6047 unsafe { o.contents.err = core::ptr::null_mut(); }
6048 CResult_NodeInfoDecodeErrorZPtr { err }
6052 result_ok: o.result_ok,
6056 impl Clone for CResult_NodeInfoDecodeErrorZ {
6057 fn clone(&self) -> Self {
6059 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
6060 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
6063 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
6064 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6070 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
6071 /// but with all dynamically-allocated buffers duplicated in new buffers.
6072 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
6074 /// The contents of CResult_NetworkGraphDecodeErrorZ
6075 pub union CResult_NetworkGraphDecodeErrorZPtr {
6076 /// A pointer to the contents in the success state.
6077 /// Reading from this pointer when `result_ok` is not set is undefined.
6078 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
6079 /// A pointer to the contents in the error state.
6080 /// Reading from this pointer when `result_ok` is set is undefined.
6081 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6084 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6085 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6087 pub struct CResult_NetworkGraphDecodeErrorZ {
6088 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6089 /// `err` or `result` depending on the state of `result_ok`.
6090 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6091 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6092 pub result_ok: bool,
6095 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6096 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6097 CResult_NetworkGraphDecodeErrorZ {
6098 contents: CResult_NetworkGraphDecodeErrorZPtr {
6099 result: Box::into_raw(Box::new(o)),
6105 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6106 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6107 CResult_NetworkGraphDecodeErrorZ {
6108 contents: CResult_NetworkGraphDecodeErrorZPtr {
6109 err: Box::into_raw(Box::new(e)),
6114 /// Checks if the given object is currently in the success state
6116 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6120 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6121 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6122 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6123 fn drop(&mut self) {
6125 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6126 let _ = unsafe { Box::from_raw(self.contents.result) };
6129 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6130 let _ = unsafe { Box::from_raw(self.contents.err) };
6135 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6136 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6137 let contents = if o.result_ok {
6138 let result = unsafe { o.contents.result };
6139 unsafe { o.contents.result = core::ptr::null_mut() };
6140 CResult_NetworkGraphDecodeErrorZPtr { result }
6142 let err = unsafe { o.contents.err };
6143 unsafe { o.contents.err = core::ptr::null_mut(); }
6144 CResult_NetworkGraphDecodeErrorZPtr { err }
6148 result_ok: o.result_ok,
6154 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6155 pub enum COption_CVec_NetAddressZZ {
6156 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6157 Some(crate::c_types::derived::CVec_NetAddressZ),
6158 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6161 impl COption_CVec_NetAddressZZ {
6162 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6163 if let Self::None = self { false } else { true }
6165 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6168 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6169 if let Self::Some(v) = self { v } else { unreachable!() }
6173 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6174 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6175 COption_CVec_NetAddressZZ::Some(o)
6178 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6179 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6180 COption_CVec_NetAddressZZ::None
6183 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6184 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6186 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6187 /// but with all dynamically-allocated buffers duplicated in new buffers.
6188 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6190 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6191 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6192 /// A pointer to the contents in the success state.
6193 /// Reading from this pointer when `result_ok` is not set is undefined.
6194 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6195 /// A pointer to the contents in the error state.
6196 /// Reading from this pointer when `result_ok` is set is undefined.
6197 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6200 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6201 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6203 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6204 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6205 /// `err` or `result` depending on the state of `result_ok`.
6206 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6207 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6208 pub result_ok: bool,
6211 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6212 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6213 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6214 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6215 result: Box::into_raw(Box::new(o)),
6221 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6222 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6223 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6224 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6225 err: Box::into_raw(Box::new(e)),
6230 /// Checks if the given object is currently in the success state
6232 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6236 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6237 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6238 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6239 fn drop(&mut self) {
6241 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6242 let _ = unsafe { Box::from_raw(self.contents.result) };
6245 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6246 let _ = unsafe { Box::from_raw(self.contents.err) };
6251 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6252 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6253 let contents = if o.result_ok {
6254 let result = unsafe { o.contents.result };
6255 unsafe { o.contents.result = core::ptr::null_mut() };
6256 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6258 let err = unsafe { o.contents.err };
6259 unsafe { o.contents.err = core::ptr::null_mut(); }
6260 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6264 result_ok: o.result_ok,
6268 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6269 fn clone(&self) -> Self {
6271 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6272 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6275 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6276 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6282 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6283 /// but with all dynamically-allocated buffers duplicated in new buffers.
6284 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6286 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6287 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6288 /// A pointer to the contents in the success state.
6289 /// Reading from this pointer when `result_ok` is not set is undefined.
6290 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6291 /// A pointer to the contents in the error state.
6292 /// Reading from this pointer when `result_ok` is set is undefined.
6293 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6296 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6297 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6299 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6300 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6301 /// `err` or `result` depending on the state of `result_ok`.
6302 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6303 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6304 pub result_ok: bool,
6307 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6308 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6309 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6310 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6311 result: Box::into_raw(Box::new(o)),
6317 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6318 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6319 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6320 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6321 err: Box::into_raw(Box::new(e)),
6326 /// Checks if the given object is currently in the success state
6328 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6332 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6333 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6334 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6335 fn drop(&mut self) {
6337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6338 let _ = unsafe { Box::from_raw(self.contents.result) };
6341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6342 let _ = unsafe { Box::from_raw(self.contents.err) };
6347 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6348 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6349 let contents = if o.result_ok {
6350 let result = unsafe { o.contents.result };
6351 unsafe { o.contents.result = core::ptr::null_mut() };
6352 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6354 let err = unsafe { o.contents.err };
6355 unsafe { o.contents.err = core::ptr::null_mut(); }
6356 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6360 result_ok: o.result_ok,
6364 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6365 fn clone(&self) -> Self {
6367 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6368 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6371 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6378 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6379 /// but with all dynamically-allocated buffers duplicated in new buffers.
6380 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6382 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6383 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6384 /// A pointer to the contents in the success state.
6385 /// Reading from this pointer when `result_ok` is not set is undefined.
6386 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6387 /// A pointer to the contents in the error state.
6388 /// Reading from this pointer when `result_ok` is set is undefined.
6389 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6392 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6393 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6395 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6396 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6397 /// `err` or `result` depending on the state of `result_ok`.
6398 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6399 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6400 pub result_ok: bool,
6403 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6404 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6405 CResult_SpendableOutputDescriptorDecodeErrorZ {
6406 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6407 result: Box::into_raw(Box::new(o)),
6413 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6414 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6415 CResult_SpendableOutputDescriptorDecodeErrorZ {
6416 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6417 err: Box::into_raw(Box::new(e)),
6422 /// Checks if the given object is currently in the success state
6424 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6428 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6429 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6430 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6431 fn drop(&mut self) {
6433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6434 let _ = unsafe { Box::from_raw(self.contents.result) };
6437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6438 let _ = unsafe { Box::from_raw(self.contents.err) };
6443 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6444 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6445 let contents = if o.result_ok {
6446 let result = unsafe { o.contents.result };
6447 unsafe { o.contents.result = core::ptr::null_mut() };
6448 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6450 let err = unsafe { o.contents.err };
6451 unsafe { o.contents.err = core::ptr::null_mut(); }
6452 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6456 result_ok: o.result_ok,
6460 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6461 fn clone(&self) -> Self {
6463 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6464 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6467 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6468 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6474 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6475 /// but with all dynamically-allocated buffers duplicated in new buffers.
6476 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6478 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6479 /// This corresponds to std::vector in C++
6480 pub struct CVec_PaymentPreimageZ {
6481 /// The elements in the array.
6482 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6483 pub data: *mut crate::c_types::ThirtyTwoBytes,
6484 /// The number of elements pointed to by `data`.
6487 impl CVec_PaymentPreimageZ {
6488 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6489 if self.datalen == 0 { return Vec::new(); }
6490 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6491 self.data = core::ptr::null_mut();
6495 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6496 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6499 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6500 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6501 let datalen = v.len();
6502 let data = Box::into_raw(v.into_boxed_slice());
6503 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6507 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6508 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6509 impl Drop for CVec_PaymentPreimageZ {
6510 fn drop(&mut self) {
6511 if self.datalen == 0 { return; }
6512 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6515 impl Clone for CVec_PaymentPreimageZ {
6516 fn clone(&self) -> Self {
6517 let mut res = Vec::new();
6518 if self.datalen == 0 { return Self::from(res); }
6519 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6524 /// A tuple of 2 elements. See the individual fields for the types contained.
6525 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6526 /// The element at position 0
6527 pub a: crate::c_types::Signature,
6528 /// The element at position 1
6529 pub b: crate::c_types::derived::CVec_SignatureZ,
6531 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6532 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6539 impl C2Tuple_SignatureCVec_SignatureZZ {
6540 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6544 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6545 fn clone(&self) -> Self {
6547 a: Clone::clone(&self.a),
6548 b: Clone::clone(&self.b),
6553 /// Creates a new tuple which has the same data as `orig`
6554 /// but with all dynamically-allocated buffers duplicated in new buffers.
6555 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6556 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6558 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6559 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6563 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6564 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6566 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6567 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6568 /// A pointer to the contents in the success state.
6569 /// Reading from this pointer when `result_ok` is not set is undefined.
6570 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6571 /// Note that this value is always NULL, as there are no contents in the Err variant
6572 pub err: *mut core::ffi::c_void,
6575 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6576 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6578 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6579 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6580 /// `err` or `result` depending on the state of `result_ok`.
6581 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6582 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6583 pub result_ok: bool,
6586 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6587 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6588 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6589 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6590 result: Box::into_raw(Box::new(o)),
6596 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6597 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6598 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6599 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6600 err: core::ptr::null_mut(),
6605 /// Checks if the given object is currently in the success state
6607 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6611 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6612 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6613 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6614 fn drop(&mut self) {
6616 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6617 let _ = unsafe { Box::from_raw(self.contents.result) };
6623 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6624 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6625 let contents = if o.result_ok {
6626 let result = unsafe { o.contents.result };
6627 unsafe { o.contents.result = core::ptr::null_mut() };
6628 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6630 let _ = unsafe { Box::from_raw(o.contents.err) };
6631 o.contents.err = core::ptr::null_mut();
6632 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6636 result_ok: o.result_ok,
6640 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6641 fn clone(&self) -> Self {
6643 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6644 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6647 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6648 err: core::ptr::null_mut()
6654 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6655 /// but with all dynamically-allocated buffers duplicated in new buffers.
6656 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6658 /// The contents of CResult_SignatureNoneZ
6659 pub union CResult_SignatureNoneZPtr {
6660 /// A pointer to the contents in the success state.
6661 /// Reading from this pointer when `result_ok` is not set is undefined.
6662 pub result: *mut crate::c_types::Signature,
6663 /// Note that this value is always NULL, as there are no contents in the Err variant
6664 pub err: *mut core::ffi::c_void,
6667 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6668 /// containing a crate::c_types::Signature on success and a () on failure.
6669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6670 pub struct CResult_SignatureNoneZ {
6671 /// The contents of this CResult_SignatureNoneZ, accessible via either
6672 /// `err` or `result` depending on the state of `result_ok`.
6673 pub contents: CResult_SignatureNoneZPtr,
6674 /// Whether this CResult_SignatureNoneZ represents a success state.
6675 pub result_ok: bool,
6678 /// Creates a new CResult_SignatureNoneZ in the success state.
6679 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6680 CResult_SignatureNoneZ {
6681 contents: CResult_SignatureNoneZPtr {
6682 result: Box::into_raw(Box::new(o)),
6688 /// Creates a new CResult_SignatureNoneZ in the error state.
6689 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6690 CResult_SignatureNoneZ {
6691 contents: CResult_SignatureNoneZPtr {
6692 err: core::ptr::null_mut(),
6697 /// Checks if the given object is currently in the success state
6699 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6703 /// Frees any resources used by the CResult_SignatureNoneZ.
6704 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6705 impl Drop for CResult_SignatureNoneZ {
6706 fn drop(&mut self) {
6708 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6709 let _ = unsafe { Box::from_raw(self.contents.result) };
6715 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6716 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6717 let contents = if o.result_ok {
6718 let result = unsafe { o.contents.result };
6719 unsafe { o.contents.result = core::ptr::null_mut() };
6720 CResult_SignatureNoneZPtr { result }
6722 let _ = unsafe { Box::from_raw(o.contents.err) };
6723 o.contents.err = core::ptr::null_mut();
6724 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6728 result_ok: o.result_ok,
6732 impl Clone for CResult_SignatureNoneZ {
6733 fn clone(&self) -> Self {
6735 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6736 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6739 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6740 err: core::ptr::null_mut()
6746 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6747 /// but with all dynamically-allocated buffers duplicated in new buffers.
6748 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6750 /// A tuple of 2 elements. See the individual fields for the types contained.
6751 pub struct C2Tuple_SignatureSignatureZ {
6752 /// The element at position 0
6753 pub a: crate::c_types::Signature,
6754 /// The element at position 1
6755 pub b: crate::c_types::Signature,
6757 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6758 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6765 impl C2Tuple_SignatureSignatureZ {
6766 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6770 impl Clone for C2Tuple_SignatureSignatureZ {
6771 fn clone(&self) -> Self {
6773 a: Clone::clone(&self.a),
6774 b: Clone::clone(&self.b),
6779 /// Creates a new tuple which has the same data as `orig`
6780 /// but with all dynamically-allocated buffers duplicated in new buffers.
6781 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6782 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6784 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6785 C2Tuple_SignatureSignatureZ { a, b, }
6789 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6790 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6792 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6793 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6794 /// A pointer to the contents in the success state.
6795 /// Reading from this pointer when `result_ok` is not set is undefined.
6796 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6797 /// Note that this value is always NULL, as there are no contents in the Err variant
6798 pub err: *mut core::ffi::c_void,
6801 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6802 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6804 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6805 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6806 /// `err` or `result` depending on the state of `result_ok`.
6807 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6808 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6809 pub result_ok: bool,
6812 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6813 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6814 CResult_C2Tuple_SignatureSignatureZNoneZ {
6815 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6816 result: Box::into_raw(Box::new(o)),
6822 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6823 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6824 CResult_C2Tuple_SignatureSignatureZNoneZ {
6825 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6826 err: core::ptr::null_mut(),
6831 /// Checks if the given object is currently in the success state
6833 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6837 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6838 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6839 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6840 fn drop(&mut self) {
6842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6843 let _ = unsafe { Box::from_raw(self.contents.result) };
6849 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6850 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6851 let contents = if o.result_ok {
6852 let result = unsafe { o.contents.result };
6853 unsafe { o.contents.result = core::ptr::null_mut() };
6854 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6856 let _ = unsafe { Box::from_raw(o.contents.err) };
6857 o.contents.err = core::ptr::null_mut();
6858 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6862 result_ok: o.result_ok,
6866 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6867 fn clone(&self) -> Self {
6869 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6870 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6873 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6874 err: core::ptr::null_mut()
6880 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6881 /// but with all dynamically-allocated buffers duplicated in new buffers.
6882 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6884 /// The contents of CResult_SecretKeyNoneZ
6885 pub union CResult_SecretKeyNoneZPtr {
6886 /// A pointer to the contents in the success state.
6887 /// Reading from this pointer when `result_ok` is not set is undefined.
6888 pub result: *mut crate::c_types::SecretKey,
6889 /// Note that this value is always NULL, as there are no contents in the Err variant
6890 pub err: *mut core::ffi::c_void,
6893 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6894 /// containing a crate::c_types::SecretKey on success and a () on failure.
6895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6896 pub struct CResult_SecretKeyNoneZ {
6897 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6898 /// `err` or `result` depending on the state of `result_ok`.
6899 pub contents: CResult_SecretKeyNoneZPtr,
6900 /// Whether this CResult_SecretKeyNoneZ represents a success state.
6901 pub result_ok: bool,
6904 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6905 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6906 CResult_SecretKeyNoneZ {
6907 contents: CResult_SecretKeyNoneZPtr {
6908 result: Box::into_raw(Box::new(o)),
6914 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6915 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6916 CResult_SecretKeyNoneZ {
6917 contents: CResult_SecretKeyNoneZPtr {
6918 err: core::ptr::null_mut(),
6923 /// Checks if the given object is currently in the success state
6925 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6929 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6930 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6931 impl Drop for CResult_SecretKeyNoneZ {
6932 fn drop(&mut self) {
6934 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6935 let _ = unsafe { Box::from_raw(self.contents.result) };
6941 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6942 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6943 let contents = if o.result_ok {
6944 let result = unsafe { o.contents.result };
6945 unsafe { o.contents.result = core::ptr::null_mut() };
6946 CResult_SecretKeyNoneZPtr { result }
6948 let _ = unsafe { Box::from_raw(o.contents.err) };
6949 o.contents.err = core::ptr::null_mut();
6950 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6954 result_ok: o.result_ok,
6958 impl Clone for CResult_SecretKeyNoneZ {
6959 fn clone(&self) -> Self {
6961 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6962 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6965 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6966 err: core::ptr::null_mut()
6972 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6973 /// but with all dynamically-allocated buffers duplicated in new buffers.
6974 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6976 /// The contents of CResult_PublicKeyNoneZ
6977 pub union CResult_PublicKeyNoneZPtr {
6978 /// A pointer to the contents in the success state.
6979 /// Reading from this pointer when `result_ok` is not set is undefined.
6980 pub result: *mut crate::c_types::PublicKey,
6981 /// Note that this value is always NULL, as there are no contents in the Err variant
6982 pub err: *mut core::ffi::c_void,
6985 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
6986 /// containing a crate::c_types::PublicKey on success and a () on failure.
6987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6988 pub struct CResult_PublicKeyNoneZ {
6989 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
6990 /// `err` or `result` depending on the state of `result_ok`.
6991 pub contents: CResult_PublicKeyNoneZPtr,
6992 /// Whether this CResult_PublicKeyNoneZ represents a success state.
6993 pub result_ok: bool,
6996 /// Creates a new CResult_PublicKeyNoneZ in the success state.
6997 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
6998 CResult_PublicKeyNoneZ {
6999 contents: CResult_PublicKeyNoneZPtr {
7000 result: Box::into_raw(Box::new(o)),
7006 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7007 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7008 CResult_PublicKeyNoneZ {
7009 contents: CResult_PublicKeyNoneZPtr {
7010 err: core::ptr::null_mut(),
7015 /// Checks if the given object is currently in the success state
7017 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7021 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7022 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7023 impl Drop for CResult_PublicKeyNoneZ {
7024 fn drop(&mut self) {
7026 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7027 let _ = unsafe { Box::from_raw(self.contents.result) };
7033 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7034 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7035 let contents = if o.result_ok {
7036 let result = unsafe { o.contents.result };
7037 unsafe { o.contents.result = core::ptr::null_mut() };
7038 CResult_PublicKeyNoneZPtr { result }
7040 let _ = unsafe { Box::from_raw(o.contents.err) };
7041 o.contents.err = core::ptr::null_mut();
7042 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7046 result_ok: o.result_ok,
7050 impl Clone for CResult_PublicKeyNoneZ {
7051 fn clone(&self) -> Self {
7053 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7054 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7057 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7058 err: core::ptr::null_mut()
7064 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7065 /// but with all dynamically-allocated buffers duplicated in new buffers.
7066 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7068 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7069 pub enum COption_ScalarZ {
7070 /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7071 Some(crate::c_types::BigEndianScalar),
7072 /// When we're in this state, this COption_ScalarZ contains nothing
7075 impl COption_ScalarZ {
7076 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7077 if let Self::None = self { false } else { true }
7079 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7082 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7083 if let Self::Some(v) = self { v } else { unreachable!() }
7087 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7088 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7089 COption_ScalarZ::Some(o)
7092 /// Constructs a new COption_ScalarZ containing nothing
7093 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7094 COption_ScalarZ::None
7097 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7098 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7100 /// The contents of CResult_SharedSecretNoneZ
7101 pub union CResult_SharedSecretNoneZPtr {
7102 /// A pointer to the contents in the success state.
7103 /// Reading from this pointer when `result_ok` is not set is undefined.
7104 pub result: *mut crate::c_types::ThirtyTwoBytes,
7105 /// Note that this value is always NULL, as there are no contents in the Err variant
7106 pub err: *mut core::ffi::c_void,
7109 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7110 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7112 pub struct CResult_SharedSecretNoneZ {
7113 /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7114 /// `err` or `result` depending on the state of `result_ok`.
7115 pub contents: CResult_SharedSecretNoneZPtr,
7116 /// Whether this CResult_SharedSecretNoneZ represents a success state.
7117 pub result_ok: bool,
7120 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7121 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7122 CResult_SharedSecretNoneZ {
7123 contents: CResult_SharedSecretNoneZPtr {
7124 result: Box::into_raw(Box::new(o)),
7130 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7131 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7132 CResult_SharedSecretNoneZ {
7133 contents: CResult_SharedSecretNoneZPtr {
7134 err: core::ptr::null_mut(),
7139 /// Checks if the given object is currently in the success state
7141 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7145 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7146 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7147 impl Drop for CResult_SharedSecretNoneZ {
7148 fn drop(&mut self) {
7150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7151 let _ = unsafe { Box::from_raw(self.contents.result) };
7157 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7158 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7159 let contents = if o.result_ok {
7160 let result = unsafe { o.contents.result };
7161 unsafe { o.contents.result = core::ptr::null_mut() };
7162 CResult_SharedSecretNoneZPtr { result }
7164 let _ = unsafe { Box::from_raw(o.contents.err) };
7165 o.contents.err = core::ptr::null_mut();
7166 CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7170 result_ok: o.result_ok,
7174 impl Clone for CResult_SharedSecretNoneZ {
7175 fn clone(&self) -> Self {
7177 Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7178 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7181 Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7182 err: core::ptr::null_mut()
7188 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7189 /// but with all dynamically-allocated buffers duplicated in new buffers.
7190 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7192 /// The contents of CResult_SignDecodeErrorZ
7193 pub union CResult_SignDecodeErrorZPtr {
7194 /// A pointer to the contents in the success state.
7195 /// Reading from this pointer when `result_ok` is not set is undefined.
7196 pub result: *mut crate::lightning::chain::keysinterface::Sign,
7197 /// A pointer to the contents in the error state.
7198 /// Reading from this pointer when `result_ok` is set is undefined.
7199 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7202 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
7203 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
7204 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7205 pub struct CResult_SignDecodeErrorZ {
7206 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
7207 /// `err` or `result` depending on the state of `result_ok`.
7208 pub contents: CResult_SignDecodeErrorZPtr,
7209 /// Whether this CResult_SignDecodeErrorZ represents a success state.
7210 pub result_ok: bool,
7213 /// Creates a new CResult_SignDecodeErrorZ in the success state.
7214 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
7215 CResult_SignDecodeErrorZ {
7216 contents: CResult_SignDecodeErrorZPtr {
7217 result: Box::into_raw(Box::new(o)),
7223 /// Creates a new CResult_SignDecodeErrorZ in the error state.
7224 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
7225 CResult_SignDecodeErrorZ {
7226 contents: CResult_SignDecodeErrorZPtr {
7227 err: Box::into_raw(Box::new(e)),
7232 /// Checks if the given object is currently in the success state
7234 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
7238 /// Frees any resources used by the CResult_SignDecodeErrorZ.
7239 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
7240 impl Drop for CResult_SignDecodeErrorZ {
7241 fn drop(&mut self) {
7243 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7244 let _ = unsafe { Box::from_raw(self.contents.result) };
7247 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7248 let _ = unsafe { Box::from_raw(self.contents.err) };
7253 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
7254 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
7255 let contents = if o.result_ok {
7256 let result = unsafe { o.contents.result };
7257 unsafe { o.contents.result = core::ptr::null_mut() };
7258 CResult_SignDecodeErrorZPtr { result }
7260 let err = unsafe { o.contents.err };
7261 unsafe { o.contents.err = core::ptr::null_mut(); }
7262 CResult_SignDecodeErrorZPtr { err }
7266 result_ok: o.result_ok,
7270 impl Clone for CResult_SignDecodeErrorZ {
7271 fn clone(&self) -> Self {
7273 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
7274 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
7277 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
7278 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7284 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
7285 /// but with all dynamically-allocated buffers duplicated in new buffers.
7286 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
7288 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
7289 /// This corresponds to std::vector in C++
7290 pub struct CVec_u5Z {
7291 /// The elements in the array.
7292 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7293 pub data: *mut crate::c_types::u5,
7294 /// The number of elements pointed to by `data`.
7298 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
7299 if self.datalen == 0 { return Vec::new(); }
7300 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7301 self.data = core::ptr::null_mut();
7305 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
7306 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7309 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
7310 fn from(v: Vec<crate::c_types::u5>) -> Self {
7311 let datalen = v.len();
7312 let data = Box::into_raw(v.into_boxed_slice());
7313 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7317 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7318 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
7319 impl Drop for CVec_u5Z {
7320 fn drop(&mut self) {
7321 if self.datalen == 0 { return; }
7322 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7325 impl Clone for CVec_u5Z {
7326 fn clone(&self) -> Self {
7327 let mut res = Vec::new();
7328 if self.datalen == 0 { return Self::from(res); }
7329 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7334 /// The contents of CResult_RecoverableSignatureNoneZ
7335 pub union CResult_RecoverableSignatureNoneZPtr {
7336 /// A pointer to the contents in the success state.
7337 /// Reading from this pointer when `result_ok` is not set is undefined.
7338 pub result: *mut crate::c_types::RecoverableSignature,
7339 /// Note that this value is always NULL, as there are no contents in the Err variant
7340 pub err: *mut core::ffi::c_void,
7343 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7344 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
7345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7346 pub struct CResult_RecoverableSignatureNoneZ {
7347 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7348 /// `err` or `result` depending on the state of `result_ok`.
7349 pub contents: CResult_RecoverableSignatureNoneZPtr,
7350 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7351 pub result_ok: bool,
7354 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
7355 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
7356 CResult_RecoverableSignatureNoneZ {
7357 contents: CResult_RecoverableSignatureNoneZPtr {
7358 result: Box::into_raw(Box::new(o)),
7364 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
7365 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
7366 CResult_RecoverableSignatureNoneZ {
7367 contents: CResult_RecoverableSignatureNoneZPtr {
7368 err: core::ptr::null_mut(),
7373 /// Checks if the given object is currently in the success state
7375 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
7379 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
7380 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
7381 impl Drop for CResult_RecoverableSignatureNoneZ {
7382 fn drop(&mut self) {
7384 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7385 let _ = unsafe { Box::from_raw(self.contents.result) };
7391 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
7392 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
7393 let contents = if o.result_ok {
7394 let result = unsafe { o.contents.result };
7395 unsafe { o.contents.result = core::ptr::null_mut() };
7396 CResult_RecoverableSignatureNoneZPtr { result }
7398 let _ = unsafe { Box::from_raw(o.contents.err) };
7399 o.contents.err = core::ptr::null_mut();
7400 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
7404 result_ok: o.result_ok,
7408 impl Clone for CResult_RecoverableSignatureNoneZ {
7409 fn clone(&self) -> Self {
7411 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
7412 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
7415 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
7416 err: core::ptr::null_mut()
7422 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
7423 /// but with all dynamically-allocated buffers duplicated in new buffers.
7424 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
7426 /// A dynamically-allocated array of u8s of arbitrary size.
7427 /// This corresponds to std::vector in C++
7428 pub struct CVec_u8Z {
7429 /// The elements in the array.
7430 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7432 /// The number of elements pointed to by `data`.
7436 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7437 if self.datalen == 0 { return Vec::new(); }
7438 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7439 self.data = core::ptr::null_mut();
7443 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7444 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7447 impl From<Vec<u8>> for CVec_u8Z {
7448 fn from(v: Vec<u8>) -> Self {
7449 let datalen = v.len();
7450 let data = Box::into_raw(v.into_boxed_slice());
7451 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7455 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7456 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7457 impl Drop for CVec_u8Z {
7458 fn drop(&mut self) {
7459 if self.datalen == 0 { return; }
7460 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7463 impl Clone for CVec_u8Z {
7464 fn clone(&self) -> Self {
7465 let mut res = Vec::new();
7466 if self.datalen == 0 { return Self::from(res); }
7467 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7472 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7473 /// This corresponds to std::vector in C++
7474 pub struct CVec_CVec_u8ZZ {
7475 /// The elements in the array.
7476 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7477 pub data: *mut crate::c_types::derived::CVec_u8Z,
7478 /// The number of elements pointed to by `data`.
7481 impl CVec_CVec_u8ZZ {
7482 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7483 if self.datalen == 0 { return Vec::new(); }
7484 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7485 self.data = core::ptr::null_mut();
7489 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7490 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7493 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7494 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7495 let datalen = v.len();
7496 let data = Box::into_raw(v.into_boxed_slice());
7497 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7501 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7502 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7503 impl Drop for CVec_CVec_u8ZZ {
7504 fn drop(&mut self) {
7505 if self.datalen == 0 { return; }
7506 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7509 impl Clone for CVec_CVec_u8ZZ {
7510 fn clone(&self) -> Self {
7511 let mut res = Vec::new();
7512 if self.datalen == 0 { return Self::from(res); }
7513 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7518 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7519 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7520 /// A pointer to the contents in the success state.
7521 /// Reading from this pointer when `result_ok` is not set is undefined.
7522 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7523 /// Note that this value is always NULL, as there are no contents in the Err variant
7524 pub err: *mut core::ffi::c_void,
7527 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7528 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7530 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7531 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7532 /// `err` or `result` depending on the state of `result_ok`.
7533 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7534 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7535 pub result_ok: bool,
7538 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7539 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7540 CResult_CVec_CVec_u8ZZNoneZ {
7541 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7542 result: Box::into_raw(Box::new(o)),
7548 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7549 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7550 CResult_CVec_CVec_u8ZZNoneZ {
7551 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7552 err: core::ptr::null_mut(),
7557 /// Checks if the given object is currently in the success state
7559 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7563 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7564 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7565 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7566 fn drop(&mut self) {
7568 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7569 let _ = unsafe { Box::from_raw(self.contents.result) };
7575 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7576 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7577 let contents = if o.result_ok {
7578 let result = unsafe { o.contents.result };
7579 unsafe { o.contents.result = core::ptr::null_mut() };
7580 CResult_CVec_CVec_u8ZZNoneZPtr { result }
7582 let _ = unsafe { Box::from_raw(o.contents.err) };
7583 o.contents.err = core::ptr::null_mut();
7584 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7588 result_ok: o.result_ok,
7592 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7593 fn clone(&self) -> Self {
7595 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7596 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7599 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7600 err: core::ptr::null_mut()
7606 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7607 /// but with all dynamically-allocated buffers duplicated in new buffers.
7608 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7610 /// The contents of CResult_InMemorySignerDecodeErrorZ
7611 pub union CResult_InMemorySignerDecodeErrorZPtr {
7612 /// A pointer to the contents in the success state.
7613 /// Reading from this pointer when `result_ok` is not set is undefined.
7614 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7615 /// A pointer to the contents in the error state.
7616 /// Reading from this pointer when `result_ok` is set is undefined.
7617 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7620 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7621 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7623 pub struct CResult_InMemorySignerDecodeErrorZ {
7624 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7625 /// `err` or `result` depending on the state of `result_ok`.
7626 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7627 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7628 pub result_ok: bool,
7631 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7632 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7633 CResult_InMemorySignerDecodeErrorZ {
7634 contents: CResult_InMemorySignerDecodeErrorZPtr {
7635 result: Box::into_raw(Box::new(o)),
7641 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7642 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7643 CResult_InMemorySignerDecodeErrorZ {
7644 contents: CResult_InMemorySignerDecodeErrorZPtr {
7645 err: Box::into_raw(Box::new(e)),
7650 /// Checks if the given object is currently in the success state
7652 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7656 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7657 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7658 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7659 fn drop(&mut self) {
7661 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7662 let _ = unsafe { Box::from_raw(self.contents.result) };
7665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7666 let _ = unsafe { Box::from_raw(self.contents.err) };
7671 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7672 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7673 let contents = if o.result_ok {
7674 let result = unsafe { o.contents.result };
7675 unsafe { o.contents.result = core::ptr::null_mut() };
7676 CResult_InMemorySignerDecodeErrorZPtr { result }
7678 let err = unsafe { o.contents.err };
7679 unsafe { o.contents.err = core::ptr::null_mut(); }
7680 CResult_InMemorySignerDecodeErrorZPtr { err }
7684 result_ok: o.result_ok,
7688 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7689 fn clone(&self) -> Self {
7691 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7692 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7695 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7696 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7702 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7703 /// but with all dynamically-allocated buffers duplicated in new buffers.
7704 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7706 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7707 /// This corresponds to std::vector in C++
7708 pub struct CVec_TxOutZ {
7709 /// The elements in the array.
7710 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7711 pub data: *mut crate::c_types::TxOut,
7712 /// The number of elements pointed to by `data`.
7716 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7717 if self.datalen == 0 { return Vec::new(); }
7718 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7719 self.data = core::ptr::null_mut();
7723 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7724 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7727 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7728 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7729 let datalen = v.len();
7730 let data = Box::into_raw(v.into_boxed_slice());
7731 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7735 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7736 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7737 impl Drop for CVec_TxOutZ {
7738 fn drop(&mut self) {
7739 if self.datalen == 0 { return; }
7740 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7743 impl Clone for CVec_TxOutZ {
7744 fn clone(&self) -> Self {
7745 let mut res = Vec::new();
7746 if self.datalen == 0 { return Self::from(res); }
7747 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7752 /// The contents of CResult_TransactionNoneZ
7753 pub union CResult_TransactionNoneZPtr {
7754 /// A pointer to the contents in the success state.
7755 /// Reading from this pointer when `result_ok` is not set is undefined.
7756 pub result: *mut crate::c_types::Transaction,
7757 /// Note that this value is always NULL, as there are no contents in the Err variant
7758 pub err: *mut core::ffi::c_void,
7761 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7762 /// containing a crate::c_types::Transaction on success and a () on failure.
7763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7764 pub struct CResult_TransactionNoneZ {
7765 /// The contents of this CResult_TransactionNoneZ, accessible via either
7766 /// `err` or `result` depending on the state of `result_ok`.
7767 pub contents: CResult_TransactionNoneZPtr,
7768 /// Whether this CResult_TransactionNoneZ represents a success state.
7769 pub result_ok: bool,
7772 /// Creates a new CResult_TransactionNoneZ in the success state.
7773 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7774 CResult_TransactionNoneZ {
7775 contents: CResult_TransactionNoneZPtr {
7776 result: Box::into_raw(Box::new(o)),
7782 /// Creates a new CResult_TransactionNoneZ in the error state.
7783 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7784 CResult_TransactionNoneZ {
7785 contents: CResult_TransactionNoneZPtr {
7786 err: core::ptr::null_mut(),
7791 /// Checks if the given object is currently in the success state
7793 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7797 /// Frees any resources used by the CResult_TransactionNoneZ.
7798 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7799 impl Drop for CResult_TransactionNoneZ {
7800 fn drop(&mut self) {
7802 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7803 let _ = unsafe { Box::from_raw(self.contents.result) };
7809 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7810 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7811 let contents = if o.result_ok {
7812 let result = unsafe { o.contents.result };
7813 unsafe { o.contents.result = core::ptr::null_mut() };
7814 CResult_TransactionNoneZPtr { result }
7816 let _ = unsafe { Box::from_raw(o.contents.err) };
7817 o.contents.err = core::ptr::null_mut();
7818 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7822 result_ok: o.result_ok,
7826 impl Clone for CResult_TransactionNoneZ {
7827 fn clone(&self) -> Self {
7829 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7830 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7833 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7834 err: core::ptr::null_mut()
7840 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7841 /// but with all dynamically-allocated buffers duplicated in new buffers.
7842 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7844 /// A tuple of 2 elements. See the individual fields for the types contained.
7845 pub struct C2Tuple_BlockHashChannelMonitorZ {
7846 /// The element at position 0
7847 pub a: crate::c_types::ThirtyTwoBytes,
7848 /// The element at position 1
7849 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7851 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7852 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7859 impl C2Tuple_BlockHashChannelMonitorZ {
7860 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7864 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7866 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7867 C2Tuple_BlockHashChannelMonitorZ { a, b, }
7871 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7872 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7874 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7875 /// This corresponds to std::vector in C++
7876 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7877 /// The elements in the array.
7878 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7879 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7880 /// The number of elements pointed to by `data`.
7883 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7884 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7885 if self.datalen == 0 { return Vec::new(); }
7886 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7887 self.data = core::ptr::null_mut();
7891 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7892 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7895 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7896 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7897 let datalen = v.len();
7898 let data = Box::into_raw(v.into_boxed_slice());
7899 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7903 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7904 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7905 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7906 fn drop(&mut self) {
7907 if self.datalen == 0 { return; }
7908 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7912 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7913 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7914 /// A pointer to the contents in the success state.
7915 /// Reading from this pointer when `result_ok` is not set is undefined.
7916 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7917 /// A pointer to the contents in the error state.
7918 /// Reading from this pointer when `result_ok` is set is undefined.
7919 pub err: *mut crate::c_types::IOError,
7922 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7923 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7925 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7926 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7927 /// `err` or `result` depending on the state of `result_ok`.
7928 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7929 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7930 pub result_ok: bool,
7933 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7934 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7935 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7936 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7937 result: Box::into_raw(Box::new(o)),
7943 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7944 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7945 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7946 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7947 err: Box::into_raw(Box::new(e)),
7952 /// Checks if the given object is currently in the success state
7954 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7958 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7959 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7960 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7961 fn drop(&mut self) {
7963 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7964 let _ = unsafe { Box::from_raw(self.contents.result) };
7967 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7968 let _ = unsafe { Box::from_raw(self.contents.err) };
7973 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7974 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7975 let contents = if o.result_ok {
7976 let result = unsafe { o.contents.result };
7977 unsafe { o.contents.result = core::ptr::null_mut() };
7978 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7980 let err = unsafe { o.contents.err };
7981 unsafe { o.contents.err = core::ptr::null_mut(); }
7982 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7986 result_ok: o.result_ok,
7992 /// An enum which can either contain a u16 or not
7993 pub enum COption_u16Z {
7994 /// When we're in this state, this COption_u16Z contains a u16
7996 /// When we're in this state, this COption_u16Z contains nothing
8000 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8001 if let Self::None = self { false } else { true }
8003 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8006 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8007 if let Self::Some(v) = self { v } else { unreachable!() }
8011 /// Constructs a new COption_u16Z containing a u16
8012 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8013 COption_u16Z::Some(o)
8016 /// Constructs a new COption_u16Z containing nothing
8017 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8021 /// Frees any resources associated with the u16, if we are in the Some state
8022 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8024 /// Creates a new COption_u16Z which has the same data as `orig`
8025 /// but with all dynamically-allocated buffers duplicated in new buffers.
8026 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8028 /// The contents of CResult_NoneAPIErrorZ
8029 pub union CResult_NoneAPIErrorZPtr {
8030 /// Note that this value is always NULL, as there are no contents in the OK variant
8031 pub result: *mut core::ffi::c_void,
8032 /// A pointer to the contents in the error state.
8033 /// Reading from this pointer when `result_ok` is set is undefined.
8034 pub err: *mut crate::lightning::util::errors::APIError,
8037 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
8038 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
8039 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8040 pub struct CResult_NoneAPIErrorZ {
8041 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
8042 /// `err` or `result` depending on the state of `result_ok`.
8043 pub contents: CResult_NoneAPIErrorZPtr,
8044 /// Whether this CResult_NoneAPIErrorZ represents a success state.
8045 pub result_ok: bool,
8048 /// Creates a new CResult_NoneAPIErrorZ in the success state.
8049 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
8050 CResult_NoneAPIErrorZ {
8051 contents: CResult_NoneAPIErrorZPtr {
8052 result: core::ptr::null_mut(),
8058 /// Creates a new CResult_NoneAPIErrorZ in the error state.
8059 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
8060 CResult_NoneAPIErrorZ {
8061 contents: CResult_NoneAPIErrorZPtr {
8062 err: Box::into_raw(Box::new(e)),
8067 /// Checks if the given object is currently in the success state
8069 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
8073 /// Frees any resources used by the CResult_NoneAPIErrorZ.
8074 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
8075 impl Drop for CResult_NoneAPIErrorZ {
8076 fn drop(&mut self) {
8079 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8080 let _ = unsafe { Box::from_raw(self.contents.err) };
8085 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
8086 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
8087 let contents = if o.result_ok {
8088 let _ = unsafe { Box::from_raw(o.contents.result) };
8089 o.contents.result = core::ptr::null_mut();
8090 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
8092 let err = unsafe { o.contents.err };
8093 unsafe { o.contents.err = core::ptr::null_mut(); }
8094 CResult_NoneAPIErrorZPtr { err }
8098 result_ok: o.result_ok,
8102 impl Clone for CResult_NoneAPIErrorZ {
8103 fn clone(&self) -> Self {
8105 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
8106 result: core::ptr::null_mut()
8109 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
8110 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8116 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
8117 /// but with all dynamically-allocated buffers duplicated in new buffers.
8118 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
8120 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
8121 /// This corresponds to std::vector in C++
8122 pub struct CVec_CResult_NoneAPIErrorZZ {
8123 /// The elements in the array.
8124 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8125 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
8126 /// The number of elements pointed to by `data`.
8129 impl CVec_CResult_NoneAPIErrorZZ {
8130 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
8131 if self.datalen == 0 { return Vec::new(); }
8132 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8133 self.data = core::ptr::null_mut();
8137 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
8138 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8141 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
8142 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
8143 let datalen = v.len();
8144 let data = Box::into_raw(v.into_boxed_slice());
8145 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8149 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8150 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
8151 impl Drop for CVec_CResult_NoneAPIErrorZZ {
8152 fn drop(&mut self) {
8153 if self.datalen == 0 { return; }
8154 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8157 impl Clone for CVec_CResult_NoneAPIErrorZZ {
8158 fn clone(&self) -> Self {
8159 let mut res = Vec::new();
8160 if self.datalen == 0 { return Self::from(res); }
8161 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8166 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
8167 /// This corresponds to std::vector in C++
8168 pub struct CVec_APIErrorZ {
8169 /// The elements in the array.
8170 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8171 pub data: *mut crate::lightning::util::errors::APIError,
8172 /// The number of elements pointed to by `data`.
8175 impl CVec_APIErrorZ {
8176 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
8177 if self.datalen == 0 { return Vec::new(); }
8178 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8179 self.data = core::ptr::null_mut();
8183 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
8184 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8187 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
8188 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
8189 let datalen = v.len();
8190 let data = Box::into_raw(v.into_boxed_slice());
8191 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8195 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8196 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
8197 impl Drop for CVec_APIErrorZ {
8198 fn drop(&mut self) {
8199 if self.datalen == 0 { return; }
8200 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8203 impl Clone for CVec_APIErrorZ {
8204 fn clone(&self) -> Self {
8205 let mut res = Vec::new();
8206 if self.datalen == 0 { return Self::from(res); }
8207 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8212 /// The contents of CResult__u832APIErrorZ
8213 pub union CResult__u832APIErrorZPtr {
8214 /// A pointer to the contents in the success state.
8215 /// Reading from this pointer when `result_ok` is not set is undefined.
8216 pub result: *mut crate::c_types::ThirtyTwoBytes,
8217 /// A pointer to the contents in the error state.
8218 /// Reading from this pointer when `result_ok` is set is undefined.
8219 pub err: *mut crate::lightning::util::errors::APIError,
8222 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8223 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8225 pub struct CResult__u832APIErrorZ {
8226 /// The contents of this CResult__u832APIErrorZ, accessible via either
8227 /// `err` or `result` depending on the state of `result_ok`.
8228 pub contents: CResult__u832APIErrorZPtr,
8229 /// Whether this CResult__u832APIErrorZ represents a success state.
8230 pub result_ok: bool,
8233 /// Creates a new CResult__u832APIErrorZ in the success state.
8234 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8235 CResult__u832APIErrorZ {
8236 contents: CResult__u832APIErrorZPtr {
8237 result: Box::into_raw(Box::new(o)),
8243 /// Creates a new CResult__u832APIErrorZ in the error state.
8244 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8245 CResult__u832APIErrorZ {
8246 contents: CResult__u832APIErrorZPtr {
8247 err: Box::into_raw(Box::new(e)),
8252 /// Checks if the given object is currently in the success state
8254 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8258 /// Frees any resources used by the CResult__u832APIErrorZ.
8259 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8260 impl Drop for CResult__u832APIErrorZ {
8261 fn drop(&mut self) {
8263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8264 let _ = unsafe { Box::from_raw(self.contents.result) };
8267 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8268 let _ = unsafe { Box::from_raw(self.contents.err) };
8273 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8274 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8275 let contents = if o.result_ok {
8276 let result = unsafe { o.contents.result };
8277 unsafe { o.contents.result = core::ptr::null_mut() };
8278 CResult__u832APIErrorZPtr { result }
8280 let err = unsafe { o.contents.err };
8281 unsafe { o.contents.err = core::ptr::null_mut(); }
8282 CResult__u832APIErrorZPtr { err }
8286 result_ok: o.result_ok,
8290 impl Clone for CResult__u832APIErrorZ {
8291 fn clone(&self) -> Self {
8293 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8294 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8297 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8298 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8304 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8305 /// but with all dynamically-allocated buffers duplicated in new buffers.
8306 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8308 /// The contents of CResult_PaymentIdPaymentSendFailureZ
8309 pub union CResult_PaymentIdPaymentSendFailureZPtr {
8310 /// A pointer to the contents in the success state.
8311 /// Reading from this pointer when `result_ok` is not set is undefined.
8312 pub result: *mut crate::c_types::ThirtyTwoBytes,
8313 /// A pointer to the contents in the error state.
8314 /// Reading from this pointer when `result_ok` is set is undefined.
8315 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8318 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
8319 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8321 pub struct CResult_PaymentIdPaymentSendFailureZ {
8322 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
8323 /// `err` or `result` depending on the state of `result_ok`.
8324 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
8325 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
8326 pub result_ok: bool,
8329 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
8330 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
8331 CResult_PaymentIdPaymentSendFailureZ {
8332 contents: CResult_PaymentIdPaymentSendFailureZPtr {
8333 result: Box::into_raw(Box::new(o)),
8339 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
8340 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
8341 CResult_PaymentIdPaymentSendFailureZ {
8342 contents: CResult_PaymentIdPaymentSendFailureZPtr {
8343 err: Box::into_raw(Box::new(e)),
8348 /// Checks if the given object is currently in the success state
8350 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
8354 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
8355 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
8356 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
8357 fn drop(&mut self) {
8359 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8360 let _ = unsafe { Box::from_raw(self.contents.result) };
8363 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8364 let _ = unsafe { Box::from_raw(self.contents.err) };
8369 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
8370 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8371 let contents = if o.result_ok {
8372 let result = unsafe { o.contents.result };
8373 unsafe { o.contents.result = core::ptr::null_mut() };
8374 CResult_PaymentIdPaymentSendFailureZPtr { result }
8376 let err = unsafe { o.contents.err };
8377 unsafe { o.contents.err = core::ptr::null_mut(); }
8378 CResult_PaymentIdPaymentSendFailureZPtr { err }
8382 result_ok: o.result_ok,
8386 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
8387 fn clone(&self) -> Self {
8389 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
8390 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8393 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
8394 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8400 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
8401 /// but with all dynamically-allocated buffers duplicated in new buffers.
8402 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
8404 /// The contents of CResult_NonePaymentSendFailureZ
8405 pub union CResult_NonePaymentSendFailureZPtr {
8406 /// Note that this value is always NULL, as there are no contents in the OK variant
8407 pub result: *mut core::ffi::c_void,
8408 /// A pointer to the contents in the error state.
8409 /// Reading from this pointer when `result_ok` is set is undefined.
8410 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8413 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8414 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8416 pub struct CResult_NonePaymentSendFailureZ {
8417 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8418 /// `err` or `result` depending on the state of `result_ok`.
8419 pub contents: CResult_NonePaymentSendFailureZPtr,
8420 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8421 pub result_ok: bool,
8424 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8425 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8426 CResult_NonePaymentSendFailureZ {
8427 contents: CResult_NonePaymentSendFailureZPtr {
8428 result: core::ptr::null_mut(),
8434 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8435 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8436 CResult_NonePaymentSendFailureZ {
8437 contents: CResult_NonePaymentSendFailureZPtr {
8438 err: Box::into_raw(Box::new(e)),
8443 /// Checks if the given object is currently in the success state
8445 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8449 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8450 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8451 impl Drop for CResult_NonePaymentSendFailureZ {
8452 fn drop(&mut self) {
8455 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8456 let _ = unsafe { Box::from_raw(self.contents.err) };
8461 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8462 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8463 let contents = if o.result_ok {
8464 let _ = unsafe { Box::from_raw(o.contents.result) };
8465 o.contents.result = core::ptr::null_mut();
8466 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8468 let err = unsafe { o.contents.err };
8469 unsafe { o.contents.err = core::ptr::null_mut(); }
8470 CResult_NonePaymentSendFailureZPtr { err }
8474 result_ok: o.result_ok,
8478 impl Clone for CResult_NonePaymentSendFailureZ {
8479 fn clone(&self) -> Self {
8481 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8482 result: core::ptr::null_mut()
8485 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8486 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8492 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8493 /// but with all dynamically-allocated buffers duplicated in new buffers.
8494 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8496 /// A tuple of 2 elements. See the individual fields for the types contained.
8497 pub struct C2Tuple_PaymentHashPaymentIdZ {
8498 /// The element at position 0
8499 pub a: crate::c_types::ThirtyTwoBytes,
8500 /// The element at position 1
8501 pub b: crate::c_types::ThirtyTwoBytes,
8503 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8504 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8511 impl C2Tuple_PaymentHashPaymentIdZ {
8512 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8516 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8517 fn clone(&self) -> Self {
8519 a: Clone::clone(&self.a),
8520 b: Clone::clone(&self.b),
8525 /// Creates a new tuple which has the same data as `orig`
8526 /// but with all dynamically-allocated buffers duplicated in new buffers.
8527 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8528 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8530 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8531 C2Tuple_PaymentHashPaymentIdZ { a, b, }
8535 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8536 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8538 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8539 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8540 /// A pointer to the contents in the success state.
8541 /// Reading from this pointer when `result_ok` is not set is undefined.
8542 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8543 /// A pointer to the contents in the error state.
8544 /// Reading from this pointer when `result_ok` is set is undefined.
8545 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8548 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8549 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8551 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8552 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8553 /// `err` or `result` depending on the state of `result_ok`.
8554 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8555 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8556 pub result_ok: bool,
8559 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8560 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8561 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8562 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8563 result: Box::into_raw(Box::new(o)),
8569 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8570 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8571 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8572 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8573 err: Box::into_raw(Box::new(e)),
8578 /// Checks if the given object is currently in the success state
8580 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8584 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8585 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8586 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8587 fn drop(&mut self) {
8589 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8590 let _ = unsafe { Box::from_raw(self.contents.result) };
8593 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8594 let _ = unsafe { Box::from_raw(self.contents.err) };
8599 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8600 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8601 let contents = if o.result_ok {
8602 let result = unsafe { o.contents.result };
8603 unsafe { o.contents.result = core::ptr::null_mut() };
8604 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8606 let err = unsafe { o.contents.err };
8607 unsafe { o.contents.err = core::ptr::null_mut(); }
8608 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8612 result_ok: o.result_ok,
8616 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8617 fn clone(&self) -> Self {
8619 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8620 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8623 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8624 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8630 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8631 /// but with all dynamically-allocated buffers duplicated in new buffers.
8632 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8634 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8635 /// This corresponds to std::vector in C++
8636 pub struct CVec_ThirtyTwoBytesZ {
8637 /// The elements in the array.
8638 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8639 pub data: *mut crate::c_types::ThirtyTwoBytes,
8640 /// The number of elements pointed to by `data`.
8643 impl CVec_ThirtyTwoBytesZ {
8644 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8645 if self.datalen == 0 { return Vec::new(); }
8646 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8647 self.data = core::ptr::null_mut();
8651 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8652 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8655 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8656 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8657 let datalen = v.len();
8658 let data = Box::into_raw(v.into_boxed_slice());
8659 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8663 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8664 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8665 impl Drop for CVec_ThirtyTwoBytesZ {
8666 fn drop(&mut self) {
8667 if self.datalen == 0 { return; }
8668 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8671 impl Clone for CVec_ThirtyTwoBytesZ {
8672 fn clone(&self) -> Self {
8673 let mut res = Vec::new();
8674 if self.datalen == 0 { return Self::from(res); }
8675 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8680 /// A tuple of 2 elements. See the individual fields for the types contained.
8681 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8682 /// The element at position 0
8683 pub a: crate::c_types::ThirtyTwoBytes,
8684 /// The element at position 1
8685 pub b: crate::c_types::ThirtyTwoBytes,
8687 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8688 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8695 impl C2Tuple_PaymentHashPaymentSecretZ {
8696 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8700 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8701 fn clone(&self) -> Self {
8703 a: Clone::clone(&self.a),
8704 b: Clone::clone(&self.b),
8709 /// Creates a new tuple which has the same data as `orig`
8710 /// but with all dynamically-allocated buffers duplicated in new buffers.
8711 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8712 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8714 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8715 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8719 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8720 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8722 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8723 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8724 /// A pointer to the contents in the success state.
8725 /// Reading from this pointer when `result_ok` is not set is undefined.
8726 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8727 /// Note that this value is always NULL, as there are no contents in the Err variant
8728 pub err: *mut core::ffi::c_void,
8731 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8732 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8733 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8734 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8735 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8736 /// `err` or `result` depending on the state of `result_ok`.
8737 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8738 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8739 pub result_ok: bool,
8742 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8743 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8744 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8745 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8746 result: Box::into_raw(Box::new(o)),
8752 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8753 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8754 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8755 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8756 err: core::ptr::null_mut(),
8761 /// Checks if the given object is currently in the success state
8763 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8767 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8768 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8769 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8770 fn drop(&mut self) {
8772 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8773 let _ = unsafe { Box::from_raw(self.contents.result) };
8779 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8780 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8781 let contents = if o.result_ok {
8782 let result = unsafe { o.contents.result };
8783 unsafe { o.contents.result = core::ptr::null_mut() };
8784 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8786 let _ = unsafe { Box::from_raw(o.contents.err) };
8787 o.contents.err = core::ptr::null_mut();
8788 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8792 result_ok: o.result_ok,
8796 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8797 fn clone(&self) -> Self {
8799 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8800 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8803 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8804 err: core::ptr::null_mut()
8810 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8811 /// but with all dynamically-allocated buffers duplicated in new buffers.
8812 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8814 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8815 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8816 /// A pointer to the contents in the success state.
8817 /// Reading from this pointer when `result_ok` is not set is undefined.
8818 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8819 /// A pointer to the contents in the error state.
8820 /// Reading from this pointer when `result_ok` is set is undefined.
8821 pub err: *mut crate::lightning::util::errors::APIError,
8824 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8825 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8826 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8827 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8828 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8829 /// `err` or `result` depending on the state of `result_ok`.
8830 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8831 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8832 pub result_ok: bool,
8835 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8836 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8837 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8838 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8839 result: Box::into_raw(Box::new(o)),
8845 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8846 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8847 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8848 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8849 err: Box::into_raw(Box::new(e)),
8854 /// Checks if the given object is currently in the success state
8856 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8860 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8861 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8862 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8863 fn drop(&mut self) {
8865 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8866 let _ = unsafe { Box::from_raw(self.contents.result) };
8869 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8870 let _ = unsafe { Box::from_raw(self.contents.err) };
8875 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8876 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8877 let contents = if o.result_ok {
8878 let result = unsafe { o.contents.result };
8879 unsafe { o.contents.result = core::ptr::null_mut() };
8880 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8882 let err = unsafe { o.contents.err };
8883 unsafe { o.contents.err = core::ptr::null_mut(); }
8884 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8888 result_ok: o.result_ok,
8892 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8893 fn clone(&self) -> Self {
8895 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8896 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8899 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8900 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8906 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8907 /// but with all dynamically-allocated buffers duplicated in new buffers.
8908 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8910 /// The contents of CResult_PaymentSecretNoneZ
8911 pub union CResult_PaymentSecretNoneZPtr {
8912 /// A pointer to the contents in the success state.
8913 /// Reading from this pointer when `result_ok` is not set is undefined.
8914 pub result: *mut crate::c_types::ThirtyTwoBytes,
8915 /// Note that this value is always NULL, as there are no contents in the Err variant
8916 pub err: *mut core::ffi::c_void,
8919 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8920 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8921 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8922 pub struct CResult_PaymentSecretNoneZ {
8923 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8924 /// `err` or `result` depending on the state of `result_ok`.
8925 pub contents: CResult_PaymentSecretNoneZPtr,
8926 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8927 pub result_ok: bool,
8930 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8931 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8932 CResult_PaymentSecretNoneZ {
8933 contents: CResult_PaymentSecretNoneZPtr {
8934 result: Box::into_raw(Box::new(o)),
8940 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8941 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8942 CResult_PaymentSecretNoneZ {
8943 contents: CResult_PaymentSecretNoneZPtr {
8944 err: core::ptr::null_mut(),
8949 /// Checks if the given object is currently in the success state
8951 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8955 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8956 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8957 impl Drop for CResult_PaymentSecretNoneZ {
8958 fn drop(&mut self) {
8960 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8961 let _ = unsafe { Box::from_raw(self.contents.result) };
8967 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8968 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8969 let contents = if o.result_ok {
8970 let result = unsafe { o.contents.result };
8971 unsafe { o.contents.result = core::ptr::null_mut() };
8972 CResult_PaymentSecretNoneZPtr { result }
8974 let _ = unsafe { Box::from_raw(o.contents.err) };
8975 o.contents.err = core::ptr::null_mut();
8976 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8980 result_ok: o.result_ok,
8984 impl Clone for CResult_PaymentSecretNoneZ {
8985 fn clone(&self) -> Self {
8987 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8988 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8991 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8992 err: core::ptr::null_mut()
8998 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8999 /// but with all dynamically-allocated buffers duplicated in new buffers.
9000 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9002 /// The contents of CResult_PaymentSecretAPIErrorZ
9003 pub union CResult_PaymentSecretAPIErrorZPtr {
9004 /// A pointer to the contents in the success state.
9005 /// Reading from this pointer when `result_ok` is not set is undefined.
9006 pub result: *mut crate::c_types::ThirtyTwoBytes,
9007 /// A pointer to the contents in the error state.
9008 /// Reading from this pointer when `result_ok` is set is undefined.
9009 pub err: *mut crate::lightning::util::errors::APIError,
9012 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9013 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9015 pub struct CResult_PaymentSecretAPIErrorZ {
9016 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9017 /// `err` or `result` depending on the state of `result_ok`.
9018 pub contents: CResult_PaymentSecretAPIErrorZPtr,
9019 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9020 pub result_ok: bool,
9023 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9024 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9025 CResult_PaymentSecretAPIErrorZ {
9026 contents: CResult_PaymentSecretAPIErrorZPtr {
9027 result: Box::into_raw(Box::new(o)),
9033 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9034 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9035 CResult_PaymentSecretAPIErrorZ {
9036 contents: CResult_PaymentSecretAPIErrorZPtr {
9037 err: Box::into_raw(Box::new(e)),
9042 /// Checks if the given object is currently in the success state
9044 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9048 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9049 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9050 impl Drop for CResult_PaymentSecretAPIErrorZ {
9051 fn drop(&mut self) {
9053 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9054 let _ = unsafe { Box::from_raw(self.contents.result) };
9057 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9058 let _ = unsafe { Box::from_raw(self.contents.err) };
9063 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9064 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9065 let contents = if o.result_ok {
9066 let result = unsafe { o.contents.result };
9067 unsafe { o.contents.result = core::ptr::null_mut() };
9068 CResult_PaymentSecretAPIErrorZPtr { result }
9070 let err = unsafe { o.contents.err };
9071 unsafe { o.contents.err = core::ptr::null_mut(); }
9072 CResult_PaymentSecretAPIErrorZPtr { err }
9076 result_ok: o.result_ok,
9080 impl Clone for CResult_PaymentSecretAPIErrorZ {
9081 fn clone(&self) -> Self {
9083 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9084 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9087 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9088 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9094 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9095 /// but with all dynamically-allocated buffers duplicated in new buffers.
9096 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9098 /// The contents of CResult_PaymentPreimageAPIErrorZ
9099 pub union CResult_PaymentPreimageAPIErrorZPtr {
9100 /// A pointer to the contents in the success state.
9101 /// Reading from this pointer when `result_ok` is not set is undefined.
9102 pub result: *mut crate::c_types::ThirtyTwoBytes,
9103 /// A pointer to the contents in the error state.
9104 /// Reading from this pointer when `result_ok` is set is undefined.
9105 pub err: *mut crate::lightning::util::errors::APIError,
9108 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9109 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9110 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9111 pub struct CResult_PaymentPreimageAPIErrorZ {
9112 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9113 /// `err` or `result` depending on the state of `result_ok`.
9114 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9115 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9116 pub result_ok: bool,
9119 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9120 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9121 CResult_PaymentPreimageAPIErrorZ {
9122 contents: CResult_PaymentPreimageAPIErrorZPtr {
9123 result: Box::into_raw(Box::new(o)),
9129 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9130 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9131 CResult_PaymentPreimageAPIErrorZ {
9132 contents: CResult_PaymentPreimageAPIErrorZPtr {
9133 err: Box::into_raw(Box::new(e)),
9138 /// Checks if the given object is currently in the success state
9140 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9144 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9145 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9146 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9147 fn drop(&mut self) {
9149 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9150 let _ = unsafe { Box::from_raw(self.contents.result) };
9153 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9154 let _ = unsafe { Box::from_raw(self.contents.err) };
9159 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9160 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9161 let contents = if o.result_ok {
9162 let result = unsafe { o.contents.result };
9163 unsafe { o.contents.result = core::ptr::null_mut() };
9164 CResult_PaymentPreimageAPIErrorZPtr { result }
9166 let err = unsafe { o.contents.err };
9167 unsafe { o.contents.err = core::ptr::null_mut(); }
9168 CResult_PaymentPreimageAPIErrorZPtr { err }
9172 result_ok: o.result_ok,
9176 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9177 fn clone(&self) -> Self {
9179 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9180 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9183 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9184 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9190 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9191 /// but with all dynamically-allocated buffers duplicated in new buffers.
9192 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9194 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9195 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9196 /// A pointer to the contents in the success state.
9197 /// Reading from this pointer when `result_ok` is not set is undefined.
9198 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9199 /// A pointer to the contents in the error state.
9200 /// Reading from this pointer when `result_ok` is set is undefined.
9201 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9204 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9205 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9207 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9208 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9209 /// `err` or `result` depending on the state of `result_ok`.
9210 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9211 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9212 pub result_ok: bool,
9215 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9216 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9217 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9218 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9219 result: Box::into_raw(Box::new(o)),
9225 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9226 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9227 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9228 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9229 err: Box::into_raw(Box::new(e)),
9234 /// Checks if the given object is currently in the success state
9236 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9240 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9241 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9242 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9243 fn drop(&mut self) {
9245 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9246 let _ = unsafe { Box::from_raw(self.contents.result) };
9249 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9250 let _ = unsafe { Box::from_raw(self.contents.err) };
9255 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9256 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9257 let contents = if o.result_ok {
9258 let result = unsafe { o.contents.result };
9259 unsafe { o.contents.result = core::ptr::null_mut() };
9260 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9262 let err = unsafe { o.contents.err };
9263 unsafe { o.contents.err = core::ptr::null_mut(); }
9264 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9268 result_ok: o.result_ok,
9272 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9273 fn clone(&self) -> Self {
9275 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9276 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9279 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9280 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9286 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9287 /// but with all dynamically-allocated buffers duplicated in new buffers.
9288 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9290 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9291 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9292 /// A pointer to the contents in the success state.
9293 /// Reading from this pointer when `result_ok` is not set is undefined.
9294 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9295 /// A pointer to the contents in the error state.
9296 /// Reading from this pointer when `result_ok` is set is undefined.
9297 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9300 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9301 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9303 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9304 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9305 /// `err` or `result` depending on the state of `result_ok`.
9306 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9307 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9308 pub result_ok: bool,
9311 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9312 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9313 CResult_ChannelCounterpartyDecodeErrorZ {
9314 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9315 result: Box::into_raw(Box::new(o)),
9321 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9322 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9323 CResult_ChannelCounterpartyDecodeErrorZ {
9324 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9325 err: Box::into_raw(Box::new(e)),
9330 /// Checks if the given object is currently in the success state
9332 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9336 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9337 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9338 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9339 fn drop(&mut self) {
9341 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9342 let _ = unsafe { Box::from_raw(self.contents.result) };
9345 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9346 let _ = unsafe { Box::from_raw(self.contents.err) };
9351 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9352 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9353 let contents = if o.result_ok {
9354 let result = unsafe { o.contents.result };
9355 unsafe { o.contents.result = core::ptr::null_mut() };
9356 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9358 let err = unsafe { o.contents.err };
9359 unsafe { o.contents.err = core::ptr::null_mut(); }
9360 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9364 result_ok: o.result_ok,
9368 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9369 fn clone(&self) -> Self {
9371 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9372 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9375 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9376 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9382 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9383 /// but with all dynamically-allocated buffers duplicated in new buffers.
9384 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9386 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9387 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9388 /// A pointer to the contents in the success state.
9389 /// Reading from this pointer when `result_ok` is not set is undefined.
9390 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9391 /// A pointer to the contents in the error state.
9392 /// Reading from this pointer when `result_ok` is set is undefined.
9393 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9396 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9397 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9399 pub struct CResult_ChannelDetailsDecodeErrorZ {
9400 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9401 /// `err` or `result` depending on the state of `result_ok`.
9402 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9403 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9404 pub result_ok: bool,
9407 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9408 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9409 CResult_ChannelDetailsDecodeErrorZ {
9410 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9411 result: Box::into_raw(Box::new(o)),
9417 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9418 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9419 CResult_ChannelDetailsDecodeErrorZ {
9420 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9421 err: Box::into_raw(Box::new(e)),
9426 /// Checks if the given object is currently in the success state
9428 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9432 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9433 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9434 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9435 fn drop(&mut self) {
9437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9438 let _ = unsafe { Box::from_raw(self.contents.result) };
9441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9442 let _ = unsafe { Box::from_raw(self.contents.err) };
9447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9448 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9449 let contents = if o.result_ok {
9450 let result = unsafe { o.contents.result };
9451 unsafe { o.contents.result = core::ptr::null_mut() };
9452 CResult_ChannelDetailsDecodeErrorZPtr { result }
9454 let err = unsafe { o.contents.err };
9455 unsafe { o.contents.err = core::ptr::null_mut(); }
9456 CResult_ChannelDetailsDecodeErrorZPtr { err }
9460 result_ok: o.result_ok,
9464 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9465 fn clone(&self) -> Self {
9467 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9468 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9471 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9472 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9478 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9479 /// but with all dynamically-allocated buffers duplicated in new buffers.
9480 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9482 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9483 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9484 /// A pointer to the contents in the success state.
9485 /// Reading from this pointer when `result_ok` is not set is undefined.
9486 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9487 /// A pointer to the contents in the error state.
9488 /// Reading from this pointer when `result_ok` is set is undefined.
9489 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9492 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9493 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9495 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9496 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9497 /// `err` or `result` depending on the state of `result_ok`.
9498 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9499 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9500 pub result_ok: bool,
9503 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9504 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9505 CResult_PhantomRouteHintsDecodeErrorZ {
9506 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9507 result: Box::into_raw(Box::new(o)),
9513 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9514 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9515 CResult_PhantomRouteHintsDecodeErrorZ {
9516 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9517 err: Box::into_raw(Box::new(e)),
9522 /// Checks if the given object is currently in the success state
9524 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9528 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9529 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9530 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9531 fn drop(&mut self) {
9533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9534 let _ = unsafe { Box::from_raw(self.contents.result) };
9537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9538 let _ = unsafe { Box::from_raw(self.contents.err) };
9543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9544 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9545 let contents = if o.result_ok {
9546 let result = unsafe { o.contents.result };
9547 unsafe { o.contents.result = core::ptr::null_mut() };
9548 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9550 let err = unsafe { o.contents.err };
9551 unsafe { o.contents.err = core::ptr::null_mut(); }
9552 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9556 result_ok: o.result_ok,
9560 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9561 fn clone(&self) -> Self {
9563 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9564 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9567 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9568 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9574 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9575 /// but with all dynamically-allocated buffers duplicated in new buffers.
9576 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9578 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9579 /// This corresponds to std::vector in C++
9580 pub struct CVec_ChannelMonitorZ {
9581 /// The elements in the array.
9582 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9583 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9584 /// The number of elements pointed to by `data`.
9587 impl CVec_ChannelMonitorZ {
9588 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9589 if self.datalen == 0 { return Vec::new(); }
9590 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9591 self.data = core::ptr::null_mut();
9595 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9596 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9599 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9600 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9601 let datalen = v.len();
9602 let data = Box::into_raw(v.into_boxed_slice());
9603 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9607 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9608 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9609 impl Drop for CVec_ChannelMonitorZ {
9610 fn drop(&mut self) {
9611 if self.datalen == 0 { return; }
9612 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9616 /// A tuple of 2 elements. See the individual fields for the types contained.
9617 pub struct C2Tuple_BlockHashChannelManagerZ {
9618 /// The element at position 0
9619 pub a: crate::c_types::ThirtyTwoBytes,
9620 /// The element at position 1
9621 pub b: crate::lightning::ln::channelmanager::ChannelManager,
9623 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9624 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9631 impl C2Tuple_BlockHashChannelManagerZ {
9632 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9636 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9638 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9639 C2Tuple_BlockHashChannelManagerZ { a, b, }
9643 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9644 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9646 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9647 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9648 /// A pointer to the contents in the success state.
9649 /// Reading from this pointer when `result_ok` is not set is undefined.
9650 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9651 /// A pointer to the contents in the error state.
9652 /// Reading from this pointer when `result_ok` is set is undefined.
9653 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9656 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9657 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9658 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9659 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9660 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9661 /// `err` or `result` depending on the state of `result_ok`.
9662 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9663 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9664 pub result_ok: bool,
9667 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9668 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9669 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9670 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9671 result: Box::into_raw(Box::new(o)),
9677 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9678 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9679 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9680 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9681 err: Box::into_raw(Box::new(e)),
9686 /// Checks if the given object is currently in the success state
9688 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9692 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9693 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9694 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9695 fn drop(&mut self) {
9697 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9698 let _ = unsafe { Box::from_raw(self.contents.result) };
9701 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9702 let _ = unsafe { Box::from_raw(self.contents.err) };
9707 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9708 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9709 let contents = if o.result_ok {
9710 let result = unsafe { o.contents.result };
9711 unsafe { o.contents.result = core::ptr::null_mut() };
9712 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9714 let err = unsafe { o.contents.err };
9715 unsafe { o.contents.err = core::ptr::null_mut(); }
9716 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9720 result_ok: o.result_ok,
9725 /// The contents of CResult_ChannelConfigDecodeErrorZ
9726 pub union CResult_ChannelConfigDecodeErrorZPtr {
9727 /// A pointer to the contents in the success state.
9728 /// Reading from this pointer when `result_ok` is not set is undefined.
9729 pub result: *mut crate::lightning::util::config::ChannelConfig,
9730 /// A pointer to the contents in the error state.
9731 /// Reading from this pointer when `result_ok` is set is undefined.
9732 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9735 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9736 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9738 pub struct CResult_ChannelConfigDecodeErrorZ {
9739 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9740 /// `err` or `result` depending on the state of `result_ok`.
9741 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9742 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9743 pub result_ok: bool,
9746 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9747 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9748 CResult_ChannelConfigDecodeErrorZ {
9749 contents: CResult_ChannelConfigDecodeErrorZPtr {
9750 result: Box::into_raw(Box::new(o)),
9756 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9757 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9758 CResult_ChannelConfigDecodeErrorZ {
9759 contents: CResult_ChannelConfigDecodeErrorZPtr {
9760 err: Box::into_raw(Box::new(e)),
9765 /// Checks if the given object is currently in the success state
9767 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9771 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9772 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9773 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9774 fn drop(&mut self) {
9776 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9777 let _ = unsafe { Box::from_raw(self.contents.result) };
9780 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9781 let _ = unsafe { Box::from_raw(self.contents.err) };
9786 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9787 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9788 let contents = if o.result_ok {
9789 let result = unsafe { o.contents.result };
9790 unsafe { o.contents.result = core::ptr::null_mut() };
9791 CResult_ChannelConfigDecodeErrorZPtr { result }
9793 let err = unsafe { o.contents.err };
9794 unsafe { o.contents.err = core::ptr::null_mut(); }
9795 CResult_ChannelConfigDecodeErrorZPtr { err }
9799 result_ok: o.result_ok,
9803 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9804 fn clone(&self) -> Self {
9806 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9807 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9810 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9811 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9817 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9818 /// but with all dynamically-allocated buffers duplicated in new buffers.
9819 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9821 /// The contents of CResult_OutPointDecodeErrorZ
9822 pub union CResult_OutPointDecodeErrorZPtr {
9823 /// A pointer to the contents in the success state.
9824 /// Reading from this pointer when `result_ok` is not set is undefined.
9825 pub result: *mut crate::lightning::chain::transaction::OutPoint,
9826 /// A pointer to the contents in the error state.
9827 /// Reading from this pointer when `result_ok` is set is undefined.
9828 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9831 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9832 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9834 pub struct CResult_OutPointDecodeErrorZ {
9835 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9836 /// `err` or `result` depending on the state of `result_ok`.
9837 pub contents: CResult_OutPointDecodeErrorZPtr,
9838 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9839 pub result_ok: bool,
9842 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9843 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9844 CResult_OutPointDecodeErrorZ {
9845 contents: CResult_OutPointDecodeErrorZPtr {
9846 result: Box::into_raw(Box::new(o)),
9852 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9853 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9854 CResult_OutPointDecodeErrorZ {
9855 contents: CResult_OutPointDecodeErrorZPtr {
9856 err: Box::into_raw(Box::new(e)),
9861 /// Checks if the given object is currently in the success state
9863 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9867 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9868 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9869 impl Drop for CResult_OutPointDecodeErrorZ {
9870 fn drop(&mut self) {
9872 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9873 let _ = unsafe { Box::from_raw(self.contents.result) };
9876 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9877 let _ = unsafe { Box::from_raw(self.contents.err) };
9882 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9883 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9884 let contents = if o.result_ok {
9885 let result = unsafe { o.contents.result };
9886 unsafe { o.contents.result = core::ptr::null_mut() };
9887 CResult_OutPointDecodeErrorZPtr { result }
9889 let err = unsafe { o.contents.err };
9890 unsafe { o.contents.err = core::ptr::null_mut(); }
9891 CResult_OutPointDecodeErrorZPtr { err }
9895 result_ok: o.result_ok,
9899 impl Clone for CResult_OutPointDecodeErrorZ {
9900 fn clone(&self) -> Self {
9902 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9903 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9906 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9907 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9913 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9914 /// but with all dynamically-allocated buffers duplicated in new buffers.
9915 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9917 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9918 pub enum COption_TypeZ {
9919 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9920 Some(crate::lightning::ln::wire::Type),
9921 /// When we're in this state, this COption_TypeZ contains nothing
9924 impl COption_TypeZ {
9925 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9926 if let Self::None = self { false } else { true }
9928 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9931 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9932 if let Self::Some(v) = self { v } else { unreachable!() }
9936 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9937 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9938 COption_TypeZ::Some(o)
9941 /// Constructs a new COption_TypeZ containing nothing
9942 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9946 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9947 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9949 /// The contents of CResult_COption_TypeZDecodeErrorZ
9950 pub union CResult_COption_TypeZDecodeErrorZPtr {
9951 /// A pointer to the contents in the success state.
9952 /// Reading from this pointer when `result_ok` is not set is undefined.
9953 pub result: *mut crate::c_types::derived::COption_TypeZ,
9954 /// A pointer to the contents in the error state.
9955 /// Reading from this pointer when `result_ok` is set is undefined.
9956 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9959 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9960 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9961 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9962 pub struct CResult_COption_TypeZDecodeErrorZ {
9963 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9964 /// `err` or `result` depending on the state of `result_ok`.
9965 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9966 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9967 pub result_ok: bool,
9970 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9971 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9972 CResult_COption_TypeZDecodeErrorZ {
9973 contents: CResult_COption_TypeZDecodeErrorZPtr {
9974 result: Box::into_raw(Box::new(o)),
9980 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9981 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9982 CResult_COption_TypeZDecodeErrorZ {
9983 contents: CResult_COption_TypeZDecodeErrorZPtr {
9984 err: Box::into_raw(Box::new(e)),
9989 /// Checks if the given object is currently in the success state
9991 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9995 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9996 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9997 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9998 fn drop(&mut self) {
10000 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10001 let _ = unsafe { Box::from_raw(self.contents.result) };
10004 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10005 let _ = unsafe { Box::from_raw(self.contents.err) };
10010 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10011 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10012 let contents = if o.result_ok {
10013 let result = unsafe { o.contents.result };
10014 unsafe { o.contents.result = core::ptr::null_mut() };
10015 CResult_COption_TypeZDecodeErrorZPtr { result }
10017 let err = unsafe { o.contents.err };
10018 unsafe { o.contents.err = core::ptr::null_mut(); }
10019 CResult_COption_TypeZDecodeErrorZPtr { err }
10023 result_ok: o.result_ok,
10028 /// The contents of CResult_PaymentIdPaymentErrorZ
10029 pub union CResult_PaymentIdPaymentErrorZPtr {
10030 /// A pointer to the contents in the success state.
10031 /// Reading from this pointer when `result_ok` is not set is undefined.
10032 pub result: *mut crate::c_types::ThirtyTwoBytes,
10033 /// A pointer to the contents in the error state.
10034 /// Reading from this pointer when `result_ok` is set is undefined.
10035 pub err: *mut crate::lightning_invoice::payment::PaymentError,
10038 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
10039 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
10040 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10041 pub struct CResult_PaymentIdPaymentErrorZ {
10042 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
10043 /// `err` or `result` depending on the state of `result_ok`.
10044 pub contents: CResult_PaymentIdPaymentErrorZPtr,
10045 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
10046 pub result_ok: bool,
10049 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
10050 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
10051 CResult_PaymentIdPaymentErrorZ {
10052 contents: CResult_PaymentIdPaymentErrorZPtr {
10053 result: Box::into_raw(Box::new(o)),
10059 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
10060 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
10061 CResult_PaymentIdPaymentErrorZ {
10062 contents: CResult_PaymentIdPaymentErrorZPtr {
10063 err: Box::into_raw(Box::new(e)),
10068 /// Checks if the given object is currently in the success state
10070 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
10074 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
10075 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
10076 impl Drop for CResult_PaymentIdPaymentErrorZ {
10077 fn drop(&mut self) {
10078 if self.result_ok {
10079 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10080 let _ = unsafe { Box::from_raw(self.contents.result) };
10083 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10084 let _ = unsafe { Box::from_raw(self.contents.err) };
10089 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
10090 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
10091 let contents = if o.result_ok {
10092 let result = unsafe { o.contents.result };
10093 unsafe { o.contents.result = core::ptr::null_mut() };
10094 CResult_PaymentIdPaymentErrorZPtr { result }
10096 let err = unsafe { o.contents.err };
10097 unsafe { o.contents.err = core::ptr::null_mut(); }
10098 CResult_PaymentIdPaymentErrorZPtr { err }
10102 result_ok: o.result_ok,
10106 impl Clone for CResult_PaymentIdPaymentErrorZ {
10107 fn clone(&self) -> Self {
10108 if self.result_ok {
10109 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
10110 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10113 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
10114 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10120 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
10121 /// but with all dynamically-allocated buffers duplicated in new buffers.
10122 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
10124 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
10125 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
10126 /// A pointer to the contents in the success state.
10127 /// Reading from this pointer when `result_ok` is not set is undefined.
10128 pub result: *mut crate::lightning_invoice::payment::InFlightHtlcs,
10129 /// A pointer to the contents in the error state.
10130 /// Reading from this pointer when `result_ok` is set is undefined.
10131 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10134 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
10135 /// containing a crate::lightning_invoice::payment::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
10136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10137 pub struct CResult_InFlightHtlcsDecodeErrorZ {
10138 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
10139 /// `err` or `result` depending on the state of `result_ok`.
10140 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
10141 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
10142 pub result_ok: bool,
10145 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
10146 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning_invoice::payment::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
10147 CResult_InFlightHtlcsDecodeErrorZ {
10148 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
10149 result: Box::into_raw(Box::new(o)),
10155 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
10156 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
10157 CResult_InFlightHtlcsDecodeErrorZ {
10158 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
10159 err: Box::into_raw(Box::new(e)),
10164 /// Checks if the given object is currently in the success state
10166 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
10170 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
10171 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
10172 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
10173 fn drop(&mut self) {
10174 if self.result_ok {
10175 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10176 let _ = unsafe { Box::from_raw(self.contents.result) };
10179 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10180 let _ = unsafe { Box::from_raw(self.contents.err) };
10185 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::payment::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
10186 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::payment::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
10187 let contents = if o.result_ok {
10188 let result = unsafe { o.contents.result };
10189 unsafe { o.contents.result = core::ptr::null_mut() };
10190 CResult_InFlightHtlcsDecodeErrorZPtr { result }
10192 let err = unsafe { o.contents.err };
10193 unsafe { o.contents.err = core::ptr::null_mut(); }
10194 CResult_InFlightHtlcsDecodeErrorZPtr { err }
10198 result_ok: o.result_ok,
10203 /// The contents of CResult_SiPrefixParseErrorZ
10204 pub union CResult_SiPrefixParseErrorZPtr {
10205 /// A pointer to the contents in the success state.
10206 /// Reading from this pointer when `result_ok` is not set is undefined.
10207 pub result: *mut crate::lightning_invoice::SiPrefix,
10208 /// A pointer to the contents in the error state.
10209 /// Reading from this pointer when `result_ok` is set is undefined.
10210 pub err: *mut crate::lightning_invoice::ParseError,
10213 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
10214 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
10215 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10216 pub struct CResult_SiPrefixParseErrorZ {
10217 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
10218 /// `err` or `result` depending on the state of `result_ok`.
10219 pub contents: CResult_SiPrefixParseErrorZPtr,
10220 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
10221 pub result_ok: bool,
10224 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
10225 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
10226 CResult_SiPrefixParseErrorZ {
10227 contents: CResult_SiPrefixParseErrorZPtr {
10228 result: Box::into_raw(Box::new(o)),
10234 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
10235 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
10236 CResult_SiPrefixParseErrorZ {
10237 contents: CResult_SiPrefixParseErrorZPtr {
10238 err: Box::into_raw(Box::new(e)),
10243 /// Checks if the given object is currently in the success state
10245 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
10249 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
10250 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
10251 impl Drop for CResult_SiPrefixParseErrorZ {
10252 fn drop(&mut self) {
10253 if self.result_ok {
10254 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10255 let _ = unsafe { Box::from_raw(self.contents.result) };
10258 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10259 let _ = unsafe { Box::from_raw(self.contents.err) };
10264 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
10265 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
10266 let contents = if o.result_ok {
10267 let result = unsafe { o.contents.result };
10268 unsafe { o.contents.result = core::ptr::null_mut() };
10269 CResult_SiPrefixParseErrorZPtr { result }
10271 let err = unsafe { o.contents.err };
10272 unsafe { o.contents.err = core::ptr::null_mut(); }
10273 CResult_SiPrefixParseErrorZPtr { err }
10277 result_ok: o.result_ok,
10281 impl Clone for CResult_SiPrefixParseErrorZ {
10282 fn clone(&self) -> Self {
10283 if self.result_ok {
10284 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
10285 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
10288 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
10289 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
10295 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
10296 /// but with all dynamically-allocated buffers duplicated in new buffers.
10297 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
10299 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
10300 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
10301 /// A pointer to the contents in the success state.
10302 /// Reading from this pointer when `result_ok` is not set is undefined.
10303 pub result: *mut crate::lightning_invoice::Invoice,
10304 /// A pointer to the contents in the error state.
10305 /// Reading from this pointer when `result_ok` is set is undefined.
10306 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
10309 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
10310 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
10311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10312 pub struct CResult_InvoiceParseOrSemanticErrorZ {
10313 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
10314 /// `err` or `result` depending on the state of `result_ok`.
10315 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
10316 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
10317 pub result_ok: bool,
10320 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
10321 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
10322 CResult_InvoiceParseOrSemanticErrorZ {
10323 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10324 result: Box::into_raw(Box::new(o)),
10330 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
10331 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
10332 CResult_InvoiceParseOrSemanticErrorZ {
10333 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10334 err: Box::into_raw(Box::new(e)),
10339 /// Checks if the given object is currently in the success state
10341 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
10345 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
10346 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
10347 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
10348 fn drop(&mut self) {
10349 if self.result_ok {
10350 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10351 let _ = unsafe { Box::from_raw(self.contents.result) };
10354 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10355 let _ = unsafe { Box::from_raw(self.contents.err) };
10360 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
10361 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
10362 let contents = if o.result_ok {
10363 let result = unsafe { o.contents.result };
10364 unsafe { o.contents.result = core::ptr::null_mut() };
10365 CResult_InvoiceParseOrSemanticErrorZPtr { result }
10367 let err = unsafe { o.contents.err };
10368 unsafe { o.contents.err = core::ptr::null_mut(); }
10369 CResult_InvoiceParseOrSemanticErrorZPtr { err }
10373 result_ok: o.result_ok,
10377 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
10378 fn clone(&self) -> Self {
10379 if self.result_ok {
10380 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10381 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10384 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10385 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
10391 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
10392 /// but with all dynamically-allocated buffers duplicated in new buffers.
10393 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
10395 /// The contents of CResult_SignedRawInvoiceParseErrorZ
10396 pub union CResult_SignedRawInvoiceParseErrorZPtr {
10397 /// A pointer to the contents in the success state.
10398 /// Reading from this pointer when `result_ok` is not set is undefined.
10399 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
10400 /// A pointer to the contents in the error state.
10401 /// Reading from this pointer when `result_ok` is set is undefined.
10402 pub err: *mut crate::lightning_invoice::ParseError,
10405 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
10406 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
10407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10408 pub struct CResult_SignedRawInvoiceParseErrorZ {
10409 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
10410 /// `err` or `result` depending on the state of `result_ok`.
10411 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
10412 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
10413 pub result_ok: bool,
10416 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
10417 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
10418 CResult_SignedRawInvoiceParseErrorZ {
10419 contents: CResult_SignedRawInvoiceParseErrorZPtr {
10420 result: Box::into_raw(Box::new(o)),
10426 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
10427 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
10428 CResult_SignedRawInvoiceParseErrorZ {
10429 contents: CResult_SignedRawInvoiceParseErrorZPtr {
10430 err: Box::into_raw(Box::new(e)),
10435 /// Checks if the given object is currently in the success state
10437 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
10441 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
10442 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
10443 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
10444 fn drop(&mut self) {
10445 if self.result_ok {
10446 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10447 let _ = unsafe { Box::from_raw(self.contents.result) };
10450 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10451 let _ = unsafe { Box::from_raw(self.contents.err) };
10456 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
10457 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
10458 let contents = if o.result_ok {
10459 let result = unsafe { o.contents.result };
10460 unsafe { o.contents.result = core::ptr::null_mut() };
10461 CResult_SignedRawInvoiceParseErrorZPtr { result }
10463 let err = unsafe { o.contents.err };
10464 unsafe { o.contents.err = core::ptr::null_mut(); }
10465 CResult_SignedRawInvoiceParseErrorZPtr { err }
10469 result_ok: o.result_ok,
10473 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
10474 fn clone(&self) -> Self {
10475 if self.result_ok {
10476 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
10477 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
10480 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
10481 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
10487 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
10488 /// but with all dynamically-allocated buffers duplicated in new buffers.
10489 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
10491 /// A tuple of 3 elements. See the individual fields for the types contained.
10492 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10493 /// The element at position 0
10494 pub a: crate::lightning_invoice::RawInvoice,
10495 /// The element at position 1
10496 pub b: crate::c_types::ThirtyTwoBytes,
10497 /// The element at position 2
10498 pub c: crate::lightning_invoice::InvoiceSignature,
10500 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10501 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
10509 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10510 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
10511 (self.a, self.b, self.c)
10514 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10515 fn clone(&self) -> Self {
10517 a: Clone::clone(&self.a),
10518 b: Clone::clone(&self.b),
10519 c: Clone::clone(&self.c),
10524 /// Creates a new tuple which has the same data as `orig`
10525 /// but with all dynamically-allocated buffers duplicated in new buffers.
10526 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
10527 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10529 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 {
10530 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
10534 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10535 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
10537 /// The contents of CResult_PayeePubKeyErrorZ
10538 pub union CResult_PayeePubKeyErrorZPtr {
10539 /// A pointer to the contents in the success state.
10540 /// Reading from this pointer when `result_ok` is not set is undefined.
10541 pub result: *mut crate::lightning_invoice::PayeePubKey,
10542 /// A pointer to the contents in the error state.
10543 /// Reading from this pointer when `result_ok` is set is undefined.
10544 pub err: *mut crate::c_types::Secp256k1Error,
10547 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
10548 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
10549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10550 pub struct CResult_PayeePubKeyErrorZ {
10551 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
10552 /// `err` or `result` depending on the state of `result_ok`.
10553 pub contents: CResult_PayeePubKeyErrorZPtr,
10554 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
10555 pub result_ok: bool,
10558 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
10559 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
10560 CResult_PayeePubKeyErrorZ {
10561 contents: CResult_PayeePubKeyErrorZPtr {
10562 result: Box::into_raw(Box::new(o)),
10568 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
10569 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
10570 CResult_PayeePubKeyErrorZ {
10571 contents: CResult_PayeePubKeyErrorZPtr {
10572 err: Box::into_raw(Box::new(e)),
10577 /// Checks if the given object is currently in the success state
10579 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
10583 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
10584 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
10585 impl Drop for CResult_PayeePubKeyErrorZ {
10586 fn drop(&mut self) {
10587 if self.result_ok {
10588 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10589 let _ = unsafe { Box::from_raw(self.contents.result) };
10592 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10593 let _ = unsafe { Box::from_raw(self.contents.err) };
10598 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
10599 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
10600 let contents = if o.result_ok {
10601 let result = unsafe { o.contents.result };
10602 unsafe { o.contents.result = core::ptr::null_mut() };
10603 CResult_PayeePubKeyErrorZPtr { result }
10605 let err = unsafe { o.contents.err };
10606 unsafe { o.contents.err = core::ptr::null_mut(); }
10607 CResult_PayeePubKeyErrorZPtr { err }
10611 result_ok: o.result_ok,
10615 impl Clone for CResult_PayeePubKeyErrorZ {
10616 fn clone(&self) -> Self {
10617 if self.result_ok {
10618 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
10619 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
10622 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
10623 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10629 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10630 /// but with all dynamically-allocated buffers duplicated in new buffers.
10631 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
10633 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
10634 /// This corresponds to std::vector in C++
10635 pub struct CVec_PrivateRouteZ {
10636 /// The elements in the array.
10637 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10638 pub data: *mut crate::lightning_invoice::PrivateRoute,
10639 /// The number of elements pointed to by `data`.
10642 impl CVec_PrivateRouteZ {
10643 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
10644 if self.datalen == 0 { return Vec::new(); }
10645 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10646 self.data = core::ptr::null_mut();
10650 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
10651 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10654 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
10655 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
10656 let datalen = v.len();
10657 let data = Box::into_raw(v.into_boxed_slice());
10658 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10662 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10663 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
10664 impl Drop for CVec_PrivateRouteZ {
10665 fn drop(&mut self) {
10666 if self.datalen == 0 { return; }
10667 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10670 impl Clone for CVec_PrivateRouteZ {
10671 fn clone(&self) -> Self {
10672 let mut res = Vec::new();
10673 if self.datalen == 0 { return Self::from(res); }
10674 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10679 /// The contents of CResult_PositiveTimestampCreationErrorZ
10680 pub union CResult_PositiveTimestampCreationErrorZPtr {
10681 /// A pointer to the contents in the success state.
10682 /// Reading from this pointer when `result_ok` is not set is undefined.
10683 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
10684 /// A pointer to the contents in the error state.
10685 /// Reading from this pointer when `result_ok` is set is undefined.
10686 pub err: *mut crate::lightning_invoice::CreationError,
10689 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
10690 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
10691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10692 pub struct CResult_PositiveTimestampCreationErrorZ {
10693 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
10694 /// `err` or `result` depending on the state of `result_ok`.
10695 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
10696 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
10697 pub result_ok: bool,
10700 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10701 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
10702 CResult_PositiveTimestampCreationErrorZ {
10703 contents: CResult_PositiveTimestampCreationErrorZPtr {
10704 result: Box::into_raw(Box::new(o)),
10710 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10711 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
10712 CResult_PositiveTimestampCreationErrorZ {
10713 contents: CResult_PositiveTimestampCreationErrorZPtr {
10714 err: Box::into_raw(Box::new(e)),
10719 /// Checks if the given object is currently in the success state
10721 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
10725 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10726 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
10727 impl Drop for CResult_PositiveTimestampCreationErrorZ {
10728 fn drop(&mut self) {
10729 if self.result_ok {
10730 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10731 let _ = unsafe { Box::from_raw(self.contents.result) };
10734 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10735 let _ = unsafe { Box::from_raw(self.contents.err) };
10740 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
10741 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
10742 let contents = if o.result_ok {
10743 let result = unsafe { o.contents.result };
10744 unsafe { o.contents.result = core::ptr::null_mut() };
10745 CResult_PositiveTimestampCreationErrorZPtr { result }
10747 let err = unsafe { o.contents.err };
10748 unsafe { o.contents.err = core::ptr::null_mut(); }
10749 CResult_PositiveTimestampCreationErrorZPtr { err }
10753 result_ok: o.result_ok,
10757 impl Clone for CResult_PositiveTimestampCreationErrorZ {
10758 fn clone(&self) -> Self {
10759 if self.result_ok {
10760 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
10761 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
10764 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
10765 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10771 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10772 /// but with all dynamically-allocated buffers duplicated in new buffers.
10773 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
10775 /// The contents of CResult_NoneSemanticErrorZ
10776 pub union CResult_NoneSemanticErrorZPtr {
10777 /// Note that this value is always NULL, as there are no contents in the OK variant
10778 pub result: *mut core::ffi::c_void,
10779 /// A pointer to the contents in the error state.
10780 /// Reading from this pointer when `result_ok` is set is undefined.
10781 pub err: *mut crate::lightning_invoice::SemanticError,
10784 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10785 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10787 pub struct CResult_NoneSemanticErrorZ {
10788 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10789 /// `err` or `result` depending on the state of `result_ok`.
10790 pub contents: CResult_NoneSemanticErrorZPtr,
10791 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10792 pub result_ok: bool,
10795 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10796 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10797 CResult_NoneSemanticErrorZ {
10798 contents: CResult_NoneSemanticErrorZPtr {
10799 result: core::ptr::null_mut(),
10805 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10806 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10807 CResult_NoneSemanticErrorZ {
10808 contents: CResult_NoneSemanticErrorZPtr {
10809 err: Box::into_raw(Box::new(e)),
10814 /// Checks if the given object is currently in the success state
10816 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10820 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10821 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10822 impl Drop for CResult_NoneSemanticErrorZ {
10823 fn drop(&mut self) {
10824 if self.result_ok {
10826 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10827 let _ = unsafe { Box::from_raw(self.contents.err) };
10832 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10833 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10834 let contents = if o.result_ok {
10835 let _ = unsafe { Box::from_raw(o.contents.result) };
10836 o.contents.result = core::ptr::null_mut();
10837 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10839 let err = unsafe { o.contents.err };
10840 unsafe { o.contents.err = core::ptr::null_mut(); }
10841 CResult_NoneSemanticErrorZPtr { err }
10845 result_ok: o.result_ok,
10849 impl Clone for CResult_NoneSemanticErrorZ {
10850 fn clone(&self) -> Self {
10851 if self.result_ok {
10852 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10853 result: core::ptr::null_mut()
10856 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10857 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10863 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10864 /// but with all dynamically-allocated buffers duplicated in new buffers.
10865 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10867 /// The contents of CResult_InvoiceSemanticErrorZ
10868 pub union CResult_InvoiceSemanticErrorZPtr {
10869 /// A pointer to the contents in the success state.
10870 /// Reading from this pointer when `result_ok` is not set is undefined.
10871 pub result: *mut crate::lightning_invoice::Invoice,
10872 /// A pointer to the contents in the error state.
10873 /// Reading from this pointer when `result_ok` is set is undefined.
10874 pub err: *mut crate::lightning_invoice::SemanticError,
10877 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10878 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10879 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10880 pub struct CResult_InvoiceSemanticErrorZ {
10881 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10882 /// `err` or `result` depending on the state of `result_ok`.
10883 pub contents: CResult_InvoiceSemanticErrorZPtr,
10884 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10885 pub result_ok: bool,
10888 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10889 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10890 CResult_InvoiceSemanticErrorZ {
10891 contents: CResult_InvoiceSemanticErrorZPtr {
10892 result: Box::into_raw(Box::new(o)),
10898 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10899 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10900 CResult_InvoiceSemanticErrorZ {
10901 contents: CResult_InvoiceSemanticErrorZPtr {
10902 err: Box::into_raw(Box::new(e)),
10907 /// Checks if the given object is currently in the success state
10909 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10913 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10914 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10915 impl Drop for CResult_InvoiceSemanticErrorZ {
10916 fn drop(&mut self) {
10917 if self.result_ok {
10918 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10919 let _ = unsafe { Box::from_raw(self.contents.result) };
10922 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10923 let _ = unsafe { Box::from_raw(self.contents.err) };
10928 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10929 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10930 let contents = if o.result_ok {
10931 let result = unsafe { o.contents.result };
10932 unsafe { o.contents.result = core::ptr::null_mut() };
10933 CResult_InvoiceSemanticErrorZPtr { result }
10935 let err = unsafe { o.contents.err };
10936 unsafe { o.contents.err = core::ptr::null_mut(); }
10937 CResult_InvoiceSemanticErrorZPtr { err }
10941 result_ok: o.result_ok,
10945 impl Clone for CResult_InvoiceSemanticErrorZ {
10946 fn clone(&self) -> Self {
10947 if self.result_ok {
10948 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10949 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10952 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10953 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10959 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10960 /// but with all dynamically-allocated buffers duplicated in new buffers.
10961 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10963 /// The contents of CResult_DescriptionCreationErrorZ
10964 pub union CResult_DescriptionCreationErrorZPtr {
10965 /// A pointer to the contents in the success state.
10966 /// Reading from this pointer when `result_ok` is not set is undefined.
10967 pub result: *mut crate::lightning_invoice::Description,
10968 /// A pointer to the contents in the error state.
10969 /// Reading from this pointer when `result_ok` is set is undefined.
10970 pub err: *mut crate::lightning_invoice::CreationError,
10973 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10974 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10976 pub struct CResult_DescriptionCreationErrorZ {
10977 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10978 /// `err` or `result` depending on the state of `result_ok`.
10979 pub contents: CResult_DescriptionCreationErrorZPtr,
10980 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10981 pub result_ok: bool,
10984 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10985 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10986 CResult_DescriptionCreationErrorZ {
10987 contents: CResult_DescriptionCreationErrorZPtr {
10988 result: Box::into_raw(Box::new(o)),
10994 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10995 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10996 CResult_DescriptionCreationErrorZ {
10997 contents: CResult_DescriptionCreationErrorZPtr {
10998 err: Box::into_raw(Box::new(e)),
11003 /// Checks if the given object is currently in the success state
11005 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
11009 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
11010 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
11011 impl Drop for CResult_DescriptionCreationErrorZ {
11012 fn drop(&mut self) {
11013 if self.result_ok {
11014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11015 let _ = unsafe { Box::from_raw(self.contents.result) };
11018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11019 let _ = unsafe { Box::from_raw(self.contents.err) };
11024 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
11025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
11026 let contents = if o.result_ok {
11027 let result = unsafe { o.contents.result };
11028 unsafe { o.contents.result = core::ptr::null_mut() };
11029 CResult_DescriptionCreationErrorZPtr { result }
11031 let err = unsafe { o.contents.err };
11032 unsafe { o.contents.err = core::ptr::null_mut(); }
11033 CResult_DescriptionCreationErrorZPtr { err }
11037 result_ok: o.result_ok,
11041 impl Clone for CResult_DescriptionCreationErrorZ {
11042 fn clone(&self) -> Self {
11043 if self.result_ok {
11044 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
11045 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
11048 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
11049 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
11055 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
11056 /// but with all dynamically-allocated buffers duplicated in new buffers.
11057 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
11059 /// The contents of CResult_PrivateRouteCreationErrorZ
11060 pub union CResult_PrivateRouteCreationErrorZPtr {
11061 /// A pointer to the contents in the success state.
11062 /// Reading from this pointer when `result_ok` is not set is undefined.
11063 pub result: *mut crate::lightning_invoice::PrivateRoute,
11064 /// A pointer to the contents in the error state.
11065 /// Reading from this pointer when `result_ok` is set is undefined.
11066 pub err: *mut crate::lightning_invoice::CreationError,
11069 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
11070 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
11071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11072 pub struct CResult_PrivateRouteCreationErrorZ {
11073 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
11074 /// `err` or `result` depending on the state of `result_ok`.
11075 pub contents: CResult_PrivateRouteCreationErrorZPtr,
11076 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
11077 pub result_ok: bool,
11080 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
11081 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
11082 CResult_PrivateRouteCreationErrorZ {
11083 contents: CResult_PrivateRouteCreationErrorZPtr {
11084 result: Box::into_raw(Box::new(o)),
11090 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
11091 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
11092 CResult_PrivateRouteCreationErrorZ {
11093 contents: CResult_PrivateRouteCreationErrorZPtr {
11094 err: Box::into_raw(Box::new(e)),
11099 /// Checks if the given object is currently in the success state
11101 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
11105 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
11106 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
11107 impl Drop for CResult_PrivateRouteCreationErrorZ {
11108 fn drop(&mut self) {
11109 if self.result_ok {
11110 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11111 let _ = unsafe { Box::from_raw(self.contents.result) };
11114 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11115 let _ = unsafe { Box::from_raw(self.contents.err) };
11120 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
11121 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
11122 let contents = if o.result_ok {
11123 let result = unsafe { o.contents.result };
11124 unsafe { o.contents.result = core::ptr::null_mut() };
11125 CResult_PrivateRouteCreationErrorZPtr { result }
11127 let err = unsafe { o.contents.err };
11128 unsafe { o.contents.err = core::ptr::null_mut(); }
11129 CResult_PrivateRouteCreationErrorZPtr { err }
11133 result_ok: o.result_ok,
11137 impl Clone for CResult_PrivateRouteCreationErrorZ {
11138 fn clone(&self) -> Self {
11139 if self.result_ok {
11140 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
11141 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
11144 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
11145 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
11151 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
11152 /// but with all dynamically-allocated buffers duplicated in new buffers.
11153 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
11155 /// The contents of CResult_StringErrorZ
11156 pub union CResult_StringErrorZPtr {
11157 /// A pointer to the contents in the success state.
11158 /// Reading from this pointer when `result_ok` is not set is undefined.
11159 pub result: *mut crate::c_types::Str,
11160 /// A pointer to the contents in the error state.
11161 /// Reading from this pointer when `result_ok` is set is undefined.
11162 pub err: *mut crate::c_types::Secp256k1Error,
11165 /// A CResult_StringErrorZ represents the result of a fallible operation,
11166 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
11167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11168 pub struct CResult_StringErrorZ {
11169 /// The contents of this CResult_StringErrorZ, accessible via either
11170 /// `err` or `result` depending on the state of `result_ok`.
11171 pub contents: CResult_StringErrorZPtr,
11172 /// Whether this CResult_StringErrorZ represents a success state.
11173 pub result_ok: bool,
11176 /// Creates a new CResult_StringErrorZ in the success state.
11177 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
11178 CResult_StringErrorZ {
11179 contents: CResult_StringErrorZPtr {
11180 result: Box::into_raw(Box::new(o)),
11186 /// Creates a new CResult_StringErrorZ in the error state.
11187 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
11188 CResult_StringErrorZ {
11189 contents: CResult_StringErrorZPtr {
11190 err: Box::into_raw(Box::new(e)),
11195 /// Checks if the given object is currently in the success state
11197 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
11201 /// Frees any resources used by the CResult_StringErrorZ.
11202 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
11203 impl Drop for CResult_StringErrorZ {
11204 fn drop(&mut self) {
11205 if self.result_ok {
11206 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11207 let _ = unsafe { Box::from_raw(self.contents.result) };
11210 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11211 let _ = unsafe { Box::from_raw(self.contents.err) };
11216 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
11217 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
11218 let contents = if o.result_ok {
11219 let result = unsafe { o.contents.result };
11220 unsafe { o.contents.result = core::ptr::null_mut() };
11221 CResult_StringErrorZPtr { result }
11223 let err = unsafe { o.contents.err };
11224 unsafe { o.contents.err = core::ptr::null_mut(); }
11225 CResult_StringErrorZPtr { err }
11229 result_ok: o.result_ok,
11233 impl Clone for CResult_StringErrorZ {
11234 fn clone(&self) -> Self {
11235 if self.result_ok {
11236 Self { result_ok: true, contents: CResult_StringErrorZPtr {
11237 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
11240 Self { result_ok: false, contents: CResult_StringErrorZPtr {
11241 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
11247 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
11248 /// but with all dynamically-allocated buffers duplicated in new buffers.
11249 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
11251 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
11252 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11253 /// A pointer to the contents in the success state.
11254 /// Reading from this pointer when `result_ok` is not set is undefined.
11255 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
11256 /// A pointer to the contents in the error state.
11257 /// Reading from this pointer when `result_ok` is set is undefined.
11258 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11261 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
11262 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11264 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
11265 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
11266 /// `err` or `result` depending on the state of `result_ok`.
11267 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
11268 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
11269 pub result_ok: bool,
11272 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11273 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11274 CResult_ChannelMonitorUpdateDecodeErrorZ {
11275 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11276 result: Box::into_raw(Box::new(o)),
11282 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11283 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11284 CResult_ChannelMonitorUpdateDecodeErrorZ {
11285 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11286 err: Box::into_raw(Box::new(e)),
11291 /// Checks if the given object is currently in the success state
11293 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
11297 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11298 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
11299 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
11300 fn drop(&mut self) {
11301 if self.result_ok {
11302 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11303 let _ = unsafe { Box::from_raw(self.contents.result) };
11306 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11307 let _ = unsafe { Box::from_raw(self.contents.err) };
11312 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
11313 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11314 let contents = if o.result_ok {
11315 let result = unsafe { o.contents.result };
11316 unsafe { o.contents.result = core::ptr::null_mut() };
11317 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
11319 let err = unsafe { o.contents.err };
11320 unsafe { o.contents.err = core::ptr::null_mut(); }
11321 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
11325 result_ok: o.result_ok,
11329 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
11330 fn clone(&self) -> Self {
11331 if self.result_ok {
11332 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11333 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
11336 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11337 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11343 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11344 /// but with all dynamically-allocated buffers duplicated in new buffers.
11345 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
11348 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
11349 pub enum COption_MonitorEventZ {
11350 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
11351 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
11352 /// When we're in this state, this COption_MonitorEventZ contains nothing
11355 impl COption_MonitorEventZ {
11356 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11357 if let Self::None = self { false } else { true }
11359 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11362 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
11363 if let Self::Some(v) = self { v } else { unreachable!() }
11367 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
11368 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
11369 COption_MonitorEventZ::Some(o)
11372 /// Constructs a new COption_MonitorEventZ containing nothing
11373 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
11374 COption_MonitorEventZ::None
11377 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11378 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11380 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11381 /// but with all dynamically-allocated buffers duplicated in new buffers.
11382 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11384 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11385 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11386 /// A pointer to the contents in the success state.
11387 /// Reading from this pointer when `result_ok` is not set is undefined.
11388 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11389 /// A pointer to the contents in the error state.
11390 /// Reading from this pointer when `result_ok` is set is undefined.
11391 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11394 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11395 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11397 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11398 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11399 /// `err` or `result` depending on the state of `result_ok`.
11400 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11401 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11402 pub result_ok: bool,
11405 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11406 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11407 CResult_COption_MonitorEventZDecodeErrorZ {
11408 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11409 result: Box::into_raw(Box::new(o)),
11415 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11416 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11417 CResult_COption_MonitorEventZDecodeErrorZ {
11418 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11419 err: Box::into_raw(Box::new(e)),
11424 /// Checks if the given object is currently in the success state
11426 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11430 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11431 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11432 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11433 fn drop(&mut self) {
11434 if self.result_ok {
11435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11436 let _ = unsafe { Box::from_raw(self.contents.result) };
11439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11440 let _ = unsafe { Box::from_raw(self.contents.err) };
11445 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11446 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11447 let contents = if o.result_ok {
11448 let result = unsafe { o.contents.result };
11449 unsafe { o.contents.result = core::ptr::null_mut() };
11450 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11452 let err = unsafe { o.contents.err };
11453 unsafe { o.contents.err = core::ptr::null_mut(); }
11454 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11458 result_ok: o.result_ok,
11462 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11463 fn clone(&self) -> Self {
11464 if self.result_ok {
11465 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11466 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11469 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11470 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11476 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11477 /// but with all dynamically-allocated buffers duplicated in new buffers.
11478 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11480 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11481 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11482 /// A pointer to the contents in the success state.
11483 /// Reading from this pointer when `result_ok` is not set is undefined.
11484 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11485 /// A pointer to the contents in the error state.
11486 /// Reading from this pointer when `result_ok` is set is undefined.
11487 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11490 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11491 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11492 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11493 pub struct CResult_HTLCUpdateDecodeErrorZ {
11494 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11495 /// `err` or `result` depending on the state of `result_ok`.
11496 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11497 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11498 pub result_ok: bool,
11501 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11502 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11503 CResult_HTLCUpdateDecodeErrorZ {
11504 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11505 result: Box::into_raw(Box::new(o)),
11511 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11512 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11513 CResult_HTLCUpdateDecodeErrorZ {
11514 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11515 err: Box::into_raw(Box::new(e)),
11520 /// Checks if the given object is currently in the success state
11522 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11526 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11527 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11528 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11529 fn drop(&mut self) {
11530 if self.result_ok {
11531 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11532 let _ = unsafe { Box::from_raw(self.contents.result) };
11535 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11536 let _ = unsafe { Box::from_raw(self.contents.err) };
11541 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11542 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11543 let contents = if o.result_ok {
11544 let result = unsafe { o.contents.result };
11545 unsafe { o.contents.result = core::ptr::null_mut() };
11546 CResult_HTLCUpdateDecodeErrorZPtr { result }
11548 let err = unsafe { o.contents.err };
11549 unsafe { o.contents.err = core::ptr::null_mut(); }
11550 CResult_HTLCUpdateDecodeErrorZPtr { err }
11554 result_ok: o.result_ok,
11558 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11559 fn clone(&self) -> Self {
11560 if self.result_ok {
11561 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11562 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11565 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11566 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11572 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11573 /// but with all dynamically-allocated buffers duplicated in new buffers.
11574 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11576 /// A tuple of 2 elements. See the individual fields for the types contained.
11577 pub struct C2Tuple_OutPointScriptZ {
11578 /// The element at position 0
11579 pub a: crate::lightning::chain::transaction::OutPoint,
11580 /// The element at position 1
11581 pub b: crate::c_types::derived::CVec_u8Z,
11583 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11584 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11591 impl C2Tuple_OutPointScriptZ {
11592 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11596 impl Clone for C2Tuple_OutPointScriptZ {
11597 fn clone(&self) -> Self {
11599 a: Clone::clone(&self.a),
11600 b: Clone::clone(&self.b),
11605 /// Creates a new tuple which has the same data as `orig`
11606 /// but with all dynamically-allocated buffers duplicated in new buffers.
11607 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11608 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11610 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11611 C2Tuple_OutPointScriptZ { a, b, }
11615 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11616 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11618 /// A tuple of 2 elements. See the individual fields for the types contained.
11619 pub struct C2Tuple_u32ScriptZ {
11620 /// The element at position 0
11622 /// The element at position 1
11623 pub b: crate::c_types::derived::CVec_u8Z,
11625 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11626 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11633 impl C2Tuple_u32ScriptZ {
11634 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11638 impl Clone for C2Tuple_u32ScriptZ {
11639 fn clone(&self) -> Self {
11641 a: Clone::clone(&self.a),
11642 b: Clone::clone(&self.b),
11647 /// Creates a new tuple which has the same data as `orig`
11648 /// but with all dynamically-allocated buffers duplicated in new buffers.
11649 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11650 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11652 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11653 C2Tuple_u32ScriptZ { a, b, }
11657 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11658 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11660 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11661 /// This corresponds to std::vector in C++
11662 pub struct CVec_C2Tuple_u32ScriptZZ {
11663 /// The elements in the array.
11664 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11665 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11666 /// The number of elements pointed to by `data`.
11669 impl CVec_C2Tuple_u32ScriptZZ {
11670 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11671 if self.datalen == 0 { return Vec::new(); }
11672 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11673 self.data = core::ptr::null_mut();
11677 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11678 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11681 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11682 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11683 let datalen = v.len();
11684 let data = Box::into_raw(v.into_boxed_slice());
11685 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11689 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11690 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11691 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11692 fn drop(&mut self) {
11693 if self.datalen == 0 { return; }
11694 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11697 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11698 fn clone(&self) -> Self {
11699 let mut res = Vec::new();
11700 if self.datalen == 0 { return Self::from(res); }
11701 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11706 /// A tuple of 2 elements. See the individual fields for the types contained.
11707 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11708 /// The element at position 0
11709 pub a: crate::c_types::ThirtyTwoBytes,
11710 /// The element at position 1
11711 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11713 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11714 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11721 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11722 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11726 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11727 fn clone(&self) -> Self {
11729 a: Clone::clone(&self.a),
11730 b: Clone::clone(&self.b),
11735 /// Creates a new tuple which has the same data as `orig`
11736 /// but with all dynamically-allocated buffers duplicated in new buffers.
11737 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11738 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11740 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 {
11741 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11745 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11746 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11748 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11749 /// This corresponds to std::vector in C++
11750 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11751 /// The elements in the array.
11752 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11753 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11754 /// The number of elements pointed to by `data`.
11757 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11758 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11759 if self.datalen == 0 { return Vec::new(); }
11760 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11761 self.data = core::ptr::null_mut();
11765 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11766 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11769 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11770 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11771 let datalen = v.len();
11772 let data = Box::into_raw(v.into_boxed_slice());
11773 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11777 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11778 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11779 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11780 fn drop(&mut self) {
11781 if self.datalen == 0 { return; }
11782 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11785 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11786 fn clone(&self) -> Self {
11787 let mut res = Vec::new();
11788 if self.datalen == 0 { return Self::from(res); }
11789 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11794 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11795 /// This corresponds to std::vector in C++
11796 pub struct CVec_EventZ {
11797 /// The elements in the array.
11798 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11799 pub data: *mut crate::lightning::util::events::Event,
11800 /// The number of elements pointed to by `data`.
11804 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11805 if self.datalen == 0 { return Vec::new(); }
11806 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11807 self.data = core::ptr::null_mut();
11811 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11812 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11815 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11816 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11817 let datalen = v.len();
11818 let data = Box::into_raw(v.into_boxed_slice());
11819 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11823 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11824 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11825 impl Drop for CVec_EventZ {
11826 fn drop(&mut self) {
11827 if self.datalen == 0 { return; }
11828 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11831 impl Clone for CVec_EventZ {
11832 fn clone(&self) -> Self {
11833 let mut res = Vec::new();
11834 if self.datalen == 0 { return Self::from(res); }
11835 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11840 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11841 /// This corresponds to std::vector in C++
11842 pub struct CVec_TransactionZ {
11843 /// The elements in the array.
11844 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11845 pub data: *mut crate::c_types::Transaction,
11846 /// The number of elements pointed to by `data`.
11849 impl CVec_TransactionZ {
11850 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11851 if self.datalen == 0 { return Vec::new(); }
11852 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11853 self.data = core::ptr::null_mut();
11857 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11858 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11861 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11862 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11863 let datalen = v.len();
11864 let data = Box::into_raw(v.into_boxed_slice());
11865 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11869 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11870 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11871 impl Drop for CVec_TransactionZ {
11872 fn drop(&mut self) {
11873 if self.datalen == 0 { return; }
11874 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11877 impl Clone for CVec_TransactionZ {
11878 fn clone(&self) -> Self {
11879 let mut res = Vec::new();
11880 if self.datalen == 0 { return Self::from(res); }
11881 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11886 /// A tuple of 2 elements. See the individual fields for the types contained.
11887 pub struct C2Tuple_u32TxOutZ {
11888 /// The element at position 0
11890 /// The element at position 1
11891 pub b: crate::c_types::TxOut,
11893 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11894 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11901 impl C2Tuple_u32TxOutZ {
11902 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11906 impl Clone for C2Tuple_u32TxOutZ {
11907 fn clone(&self) -> Self {
11909 a: Clone::clone(&self.a),
11910 b: Clone::clone(&self.b),
11915 /// Creates a new tuple which has the same data as `orig`
11916 /// but with all dynamically-allocated buffers duplicated in new buffers.
11917 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11918 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11920 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11921 C2Tuple_u32TxOutZ { a, b, }
11925 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11926 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11928 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11929 /// This corresponds to std::vector in C++
11930 pub struct CVec_C2Tuple_u32TxOutZZ {
11931 /// The elements in the array.
11932 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11933 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11934 /// The number of elements pointed to by `data`.
11937 impl CVec_C2Tuple_u32TxOutZZ {
11938 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11939 if self.datalen == 0 { return Vec::new(); }
11940 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11941 self.data = core::ptr::null_mut();
11945 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11946 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11949 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11950 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11951 let datalen = v.len();
11952 let data = Box::into_raw(v.into_boxed_slice());
11953 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11957 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11958 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11959 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11960 fn drop(&mut self) {
11961 if self.datalen == 0 { return; }
11962 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11965 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11966 fn clone(&self) -> Self {
11967 let mut res = Vec::new();
11968 if self.datalen == 0 { return Self::from(res); }
11969 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11974 /// A tuple of 2 elements. See the individual fields for the types contained.
11975 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11976 /// The element at position 0
11977 pub a: crate::c_types::ThirtyTwoBytes,
11978 /// The element at position 1
11979 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11981 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11982 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11989 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11990 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11994 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11995 fn clone(&self) -> Self {
11997 a: Clone::clone(&self.a),
11998 b: Clone::clone(&self.b),
12003 /// Creates a new tuple which has the same data as `orig`
12004 /// but with all dynamically-allocated buffers duplicated in new buffers.
12005 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12006 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12008 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 {
12009 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
12013 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12014 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
12016 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12017 /// This corresponds to std::vector in C++
12018 pub struct CVec_TransactionOutputsZ {
12019 /// The elements in the array.
12020 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12021 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
12022 /// The number of elements pointed to by `data`.
12025 impl CVec_TransactionOutputsZ {
12026 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
12027 if self.datalen == 0 { return Vec::new(); }
12028 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12029 self.data = core::ptr::null_mut();
12033 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
12034 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12037 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12038 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12039 let datalen = v.len();
12040 let data = Box::into_raw(v.into_boxed_slice());
12041 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12045 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12046 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12047 impl Drop for CVec_TransactionOutputsZ {
12048 fn drop(&mut self) {
12049 if self.datalen == 0 { return; }
12050 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12053 impl Clone for CVec_TransactionOutputsZ {
12054 fn clone(&self) -> Self {
12055 let mut res = Vec::new();
12056 if self.datalen == 0 { return Self::from(res); }
12057 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12062 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12063 /// This corresponds to std::vector in C++
12064 pub struct CVec_BalanceZ {
12065 /// The elements in the array.
12066 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12067 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12068 /// The number of elements pointed to by `data`.
12071 impl CVec_BalanceZ {
12072 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12073 if self.datalen == 0 { return Vec::new(); }
12074 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12075 self.data = core::ptr::null_mut();
12079 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12080 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12083 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12084 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12085 let datalen = v.len();
12086 let data = Box::into_raw(v.into_boxed_slice());
12087 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12091 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12092 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12093 impl Drop for CVec_BalanceZ {
12094 fn drop(&mut self) {
12095 if self.datalen == 0 { return; }
12096 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12099 impl Clone for CVec_BalanceZ {
12100 fn clone(&self) -> Self {
12101 let mut res = Vec::new();
12102 if self.datalen == 0 { return Self::from(res); }
12103 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12108 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
12109 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12110 /// A pointer to the contents in the success state.
12111 /// Reading from this pointer when `result_ok` is not set is undefined.
12112 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
12113 /// A pointer to the contents in the error state.
12114 /// Reading from this pointer when `result_ok` is set is undefined.
12115 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12118 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12119 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12120 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12121 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12122 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
12123 /// `err` or `result` depending on the state of `result_ok`.
12124 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
12125 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
12126 pub result_ok: bool,
12129 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12130 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12131 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12132 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12133 result: Box::into_raw(Box::new(o)),
12139 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12140 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12141 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12142 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12143 err: Box::into_raw(Box::new(e)),
12148 /// Checks if the given object is currently in the success state
12150 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
12154 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12155 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
12156 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12157 fn drop(&mut self) {
12158 if self.result_ok {
12159 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12160 let _ = unsafe { Box::from_raw(self.contents.result) };
12163 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12164 let _ = unsafe { Box::from_raw(self.contents.err) };
12169 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12170 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12171 let contents = if o.result_ok {
12172 let result = unsafe { o.contents.result };
12173 unsafe { o.contents.result = core::ptr::null_mut() };
12174 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
12176 let err = unsafe { o.contents.err };
12177 unsafe { o.contents.err = core::ptr::null_mut(); }
12178 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
12182 result_ok: o.result_ok,
12187 /// A tuple of 2 elements. See the individual fields for the types contained.
12188 pub struct C2Tuple_PublicKeyTypeZ {
12189 /// The element at position 0
12190 pub a: crate::c_types::PublicKey,
12191 /// The element at position 1
12192 pub b: crate::lightning::ln::wire::Type,
12194 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12195 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12202 impl C2Tuple_PublicKeyTypeZ {
12203 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
12207 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12209 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
12210 C2Tuple_PublicKeyTypeZ { a, b, }
12214 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12215 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
12217 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
12218 /// This corresponds to std::vector in C++
12219 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
12220 /// The elements in the array.
12221 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12222 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
12223 /// The number of elements pointed to by `data`.
12226 impl CVec_C2Tuple_PublicKeyTypeZZ {
12227 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
12228 if self.datalen == 0 { return Vec::new(); }
12229 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12230 self.data = core::ptr::null_mut();
12234 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
12235 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12238 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
12239 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
12240 let datalen = v.len();
12241 let data = Box::into_raw(v.into_boxed_slice());
12242 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12246 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12247 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
12248 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
12249 fn drop(&mut self) {
12250 if self.datalen == 0 { return; }
12251 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12255 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
12256 pub enum COption_CustomOnionMessageContentsZ {
12257 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
12258 Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
12259 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
12262 impl COption_CustomOnionMessageContentsZ {
12263 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12264 if let Self::None = self { false } else { true }
12266 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12269 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
12270 if let Self::Some(v) = self { v } else { unreachable!() }
12274 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
12275 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
12276 COption_CustomOnionMessageContentsZ::Some(o)
12279 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
12280 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
12281 COption_CustomOnionMessageContentsZ::None
12284 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
12285 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
12287 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
12288 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12289 /// A pointer to the contents in the success state.
12290 /// Reading from this pointer when `result_ok` is not set is undefined.
12291 pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
12292 /// A pointer to the contents in the error state.
12293 /// Reading from this pointer when `result_ok` is set is undefined.
12294 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12297 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12298 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12299 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12300 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12301 /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
12302 /// `err` or `result` depending on the state of `result_ok`.
12303 pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
12304 /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
12305 pub result_ok: bool,
12308 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
12309 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12310 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12311 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12312 result: Box::into_raw(Box::new(o)),
12318 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
12319 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12320 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12321 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12322 err: Box::into_raw(Box::new(e)),
12327 /// Checks if the given object is currently in the success state
12329 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
12333 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
12334 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
12335 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12336 fn drop(&mut self) {
12337 if self.result_ok {
12338 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12339 let _ = unsafe { Box::from_raw(self.contents.result) };
12342 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12343 let _ = unsafe { Box::from_raw(self.contents.err) };
12348 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12349 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12350 let contents = if o.result_ok {
12351 let result = unsafe { o.contents.result };
12352 unsafe { o.contents.result = core::ptr::null_mut() };
12353 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
12355 let err = unsafe { o.contents.err };
12356 unsafe { o.contents.err = core::ptr::null_mut(); }
12357 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
12361 result_ok: o.result_ok,
12367 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
12368 pub enum COption_NetAddressZ {
12369 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
12370 Some(crate::lightning::ln::msgs::NetAddress),
12371 /// When we're in this state, this COption_NetAddressZ contains nothing
12374 impl COption_NetAddressZ {
12375 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12376 if let Self::None = self { false } else { true }
12378 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12381 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
12382 if let Self::Some(v) = self { v } else { unreachable!() }
12386 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
12387 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
12388 COption_NetAddressZ::Some(o)
12391 /// Constructs a new COption_NetAddressZ containing nothing
12392 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
12393 COption_NetAddressZ::None
12396 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
12397 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
12399 /// Creates a new COption_NetAddressZ which has the same data as `orig`
12400 /// but with all dynamically-allocated buffers duplicated in new buffers.
12401 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
12403 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12404 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12405 /// A pointer to the contents in the success state.
12406 /// Reading from this pointer when `result_ok` is not set is undefined.
12407 pub result: *mut crate::c_types::derived::CVec_u8Z,
12408 /// A pointer to the contents in the error state.
12409 /// Reading from this pointer when `result_ok` is set is undefined.
12410 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12413 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12414 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12416 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12417 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12418 /// `err` or `result` depending on the state of `result_ok`.
12419 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12420 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12421 pub result_ok: bool,
12424 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12425 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12426 CResult_CVec_u8ZPeerHandleErrorZ {
12427 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12428 result: Box::into_raw(Box::new(o)),
12434 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12435 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12436 CResult_CVec_u8ZPeerHandleErrorZ {
12437 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12438 err: Box::into_raw(Box::new(e)),
12443 /// Checks if the given object is currently in the success state
12445 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12449 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12450 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12451 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12452 fn drop(&mut self) {
12453 if self.result_ok {
12454 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12455 let _ = unsafe { Box::from_raw(self.contents.result) };
12458 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12459 let _ = unsafe { Box::from_raw(self.contents.err) };
12464 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12465 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12466 let contents = if o.result_ok {
12467 let result = unsafe { o.contents.result };
12468 unsafe { o.contents.result = core::ptr::null_mut() };
12469 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12471 let err = unsafe { o.contents.err };
12472 unsafe { o.contents.err = core::ptr::null_mut(); }
12473 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12477 result_ok: o.result_ok,
12481 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12482 fn clone(&self) -> Self {
12483 if self.result_ok {
12484 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12485 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12488 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12489 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12495 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12496 /// but with all dynamically-allocated buffers duplicated in new buffers.
12497 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12499 /// The contents of CResult_NonePeerHandleErrorZ
12500 pub union CResult_NonePeerHandleErrorZPtr {
12501 /// Note that this value is always NULL, as there are no contents in the OK variant
12502 pub result: *mut core::ffi::c_void,
12503 /// A pointer to the contents in the error state.
12504 /// Reading from this pointer when `result_ok` is set is undefined.
12505 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12508 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12509 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12510 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12511 pub struct CResult_NonePeerHandleErrorZ {
12512 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12513 /// `err` or `result` depending on the state of `result_ok`.
12514 pub contents: CResult_NonePeerHandleErrorZPtr,
12515 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12516 pub result_ok: bool,
12519 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12520 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12521 CResult_NonePeerHandleErrorZ {
12522 contents: CResult_NonePeerHandleErrorZPtr {
12523 result: core::ptr::null_mut(),
12529 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12530 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12531 CResult_NonePeerHandleErrorZ {
12532 contents: CResult_NonePeerHandleErrorZPtr {
12533 err: Box::into_raw(Box::new(e)),
12538 /// Checks if the given object is currently in the success state
12540 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12544 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12545 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12546 impl Drop for CResult_NonePeerHandleErrorZ {
12547 fn drop(&mut self) {
12548 if self.result_ok {
12550 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12551 let _ = unsafe { Box::from_raw(self.contents.err) };
12556 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12557 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12558 let contents = if o.result_ok {
12559 let _ = unsafe { Box::from_raw(o.contents.result) };
12560 o.contents.result = core::ptr::null_mut();
12561 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12563 let err = unsafe { o.contents.err };
12564 unsafe { o.contents.err = core::ptr::null_mut(); }
12565 CResult_NonePeerHandleErrorZPtr { err }
12569 result_ok: o.result_ok,
12573 impl Clone for CResult_NonePeerHandleErrorZ {
12574 fn clone(&self) -> Self {
12575 if self.result_ok {
12576 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12577 result: core::ptr::null_mut()
12580 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12581 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12587 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12588 /// but with all dynamically-allocated buffers duplicated in new buffers.
12589 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12591 /// The contents of CResult_boolPeerHandleErrorZ
12592 pub union CResult_boolPeerHandleErrorZPtr {
12593 /// A pointer to the contents in the success state.
12594 /// Reading from this pointer when `result_ok` is not set is undefined.
12595 pub result: *mut bool,
12596 /// A pointer to the contents in the error state.
12597 /// Reading from this pointer when `result_ok` is set is undefined.
12598 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12601 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12602 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12604 pub struct CResult_boolPeerHandleErrorZ {
12605 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12606 /// `err` or `result` depending on the state of `result_ok`.
12607 pub contents: CResult_boolPeerHandleErrorZPtr,
12608 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12609 pub result_ok: bool,
12612 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12613 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12614 CResult_boolPeerHandleErrorZ {
12615 contents: CResult_boolPeerHandleErrorZPtr {
12616 result: Box::into_raw(Box::new(o)),
12622 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12623 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12624 CResult_boolPeerHandleErrorZ {
12625 contents: CResult_boolPeerHandleErrorZPtr {
12626 err: Box::into_raw(Box::new(e)),
12631 /// Checks if the given object is currently in the success state
12633 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12637 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12638 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12639 impl Drop for CResult_boolPeerHandleErrorZ {
12640 fn drop(&mut self) {
12641 if self.result_ok {
12642 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12643 let _ = unsafe { Box::from_raw(self.contents.result) };
12646 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12647 let _ = unsafe { Box::from_raw(self.contents.err) };
12652 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12653 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12654 let contents = if o.result_ok {
12655 let result = unsafe { o.contents.result };
12656 unsafe { o.contents.result = core::ptr::null_mut() };
12657 CResult_boolPeerHandleErrorZPtr { result }
12659 let err = unsafe { o.contents.err };
12660 unsafe { o.contents.err = core::ptr::null_mut(); }
12661 CResult_boolPeerHandleErrorZPtr { err }
12665 result_ok: o.result_ok,
12669 impl Clone for CResult_boolPeerHandleErrorZ {
12670 fn clone(&self) -> Self {
12671 if self.result_ok {
12672 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12673 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12676 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12677 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12683 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12684 /// but with all dynamically-allocated buffers duplicated in new buffers.
12685 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12687 /// The contents of CResult_NoneSendErrorZ
12688 pub union CResult_NoneSendErrorZPtr {
12689 /// Note that this value is always NULL, as there are no contents in the OK variant
12690 pub result: *mut core::ffi::c_void,
12691 /// A pointer to the contents in the error state.
12692 /// Reading from this pointer when `result_ok` is set is undefined.
12693 pub err: *mut crate::lightning::onion_message::messenger::SendError,
12696 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12697 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12698 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12699 pub struct CResult_NoneSendErrorZ {
12700 /// The contents of this CResult_NoneSendErrorZ, accessible via either
12701 /// `err` or `result` depending on the state of `result_ok`.
12702 pub contents: CResult_NoneSendErrorZPtr,
12703 /// Whether this CResult_NoneSendErrorZ represents a success state.
12704 pub result_ok: bool,
12707 /// Creates a new CResult_NoneSendErrorZ in the success state.
12708 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12709 CResult_NoneSendErrorZ {
12710 contents: CResult_NoneSendErrorZPtr {
12711 result: core::ptr::null_mut(),
12717 /// Creates a new CResult_NoneSendErrorZ in the error state.
12718 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12719 CResult_NoneSendErrorZ {
12720 contents: CResult_NoneSendErrorZPtr {
12721 err: Box::into_raw(Box::new(e)),
12726 /// Checks if the given object is currently in the success state
12728 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12732 /// Frees any resources used by the CResult_NoneSendErrorZ.
12733 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12734 impl Drop for CResult_NoneSendErrorZ {
12735 fn drop(&mut self) {
12736 if self.result_ok {
12738 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12739 let _ = unsafe { Box::from_raw(self.contents.err) };
12744 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12745 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12746 let contents = if o.result_ok {
12747 let _ = unsafe { Box::from_raw(o.contents.result) };
12748 o.contents.result = core::ptr::null_mut();
12749 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12751 let err = unsafe { o.contents.err };
12752 unsafe { o.contents.err = core::ptr::null_mut(); }
12753 CResult_NoneSendErrorZPtr { err }
12757 result_ok: o.result_ok,
12762 /// The contents of CResult_u32GraphSyncErrorZ
12763 pub union CResult_u32GraphSyncErrorZPtr {
12764 /// A pointer to the contents in the success state.
12765 /// Reading from this pointer when `result_ok` is not set is undefined.
12766 pub result: *mut u32,
12767 /// A pointer to the contents in the error state.
12768 /// Reading from this pointer when `result_ok` is set is undefined.
12769 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12772 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12773 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12775 pub struct CResult_u32GraphSyncErrorZ {
12776 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12777 /// `err` or `result` depending on the state of `result_ok`.
12778 pub contents: CResult_u32GraphSyncErrorZPtr,
12779 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12780 pub result_ok: bool,
12783 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12784 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12785 CResult_u32GraphSyncErrorZ {
12786 contents: CResult_u32GraphSyncErrorZPtr {
12787 result: Box::into_raw(Box::new(o)),
12793 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12794 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12795 CResult_u32GraphSyncErrorZ {
12796 contents: CResult_u32GraphSyncErrorZPtr {
12797 err: Box::into_raw(Box::new(e)),
12802 /// Checks if the given object is currently in the success state
12804 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12808 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12809 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12810 impl Drop for CResult_u32GraphSyncErrorZ {
12811 fn drop(&mut self) {
12812 if self.result_ok {
12813 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12814 let _ = unsafe { Box::from_raw(self.contents.result) };
12817 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12818 let _ = unsafe { Box::from_raw(self.contents.err) };
12823 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12824 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12825 let contents = if o.result_ok {
12826 let result = unsafe { o.contents.result };
12827 unsafe { o.contents.result = core::ptr::null_mut() };
12828 CResult_u32GraphSyncErrorZPtr { result }
12830 let err = unsafe { o.contents.err };
12831 unsafe { o.contents.err = core::ptr::null_mut(); }
12832 CResult_u32GraphSyncErrorZPtr { err }
12836 result_ok: o.result_ok,
12841 /// The contents of CResult_NetAddressDecodeErrorZ
12842 pub union CResult_NetAddressDecodeErrorZPtr {
12843 /// A pointer to the contents in the success state.
12844 /// Reading from this pointer when `result_ok` is not set is undefined.
12845 pub result: *mut crate::lightning::ln::msgs::NetAddress,
12846 /// A pointer to the contents in the error state.
12847 /// Reading from this pointer when `result_ok` is set is undefined.
12848 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12851 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
12852 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12854 pub struct CResult_NetAddressDecodeErrorZ {
12855 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
12856 /// `err` or `result` depending on the state of `result_ok`.
12857 pub contents: CResult_NetAddressDecodeErrorZPtr,
12858 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
12859 pub result_ok: bool,
12862 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12863 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
12864 CResult_NetAddressDecodeErrorZ {
12865 contents: CResult_NetAddressDecodeErrorZPtr {
12866 result: Box::into_raw(Box::new(o)),
12872 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12873 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
12874 CResult_NetAddressDecodeErrorZ {
12875 contents: CResult_NetAddressDecodeErrorZPtr {
12876 err: Box::into_raw(Box::new(e)),
12881 /// Checks if the given object is currently in the success state
12883 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
12887 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12888 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
12889 impl Drop for CResult_NetAddressDecodeErrorZ {
12890 fn drop(&mut self) {
12891 if self.result_ok {
12892 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12893 let _ = unsafe { Box::from_raw(self.contents.result) };
12896 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12897 let _ = unsafe { Box::from_raw(self.contents.err) };
12902 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
12903 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12904 let contents = if o.result_ok {
12905 let result = unsafe { o.contents.result };
12906 unsafe { o.contents.result = core::ptr::null_mut() };
12907 CResult_NetAddressDecodeErrorZPtr { result }
12909 let err = unsafe { o.contents.err };
12910 unsafe { o.contents.err = core::ptr::null_mut(); }
12911 CResult_NetAddressDecodeErrorZPtr { err }
12915 result_ok: o.result_ok,
12919 impl Clone for CResult_NetAddressDecodeErrorZ {
12920 fn clone(&self) -> Self {
12921 if self.result_ok {
12922 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
12923 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
12926 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
12927 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12933 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12934 /// but with all dynamically-allocated buffers duplicated in new buffers.
12935 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12937 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12938 /// This corresponds to std::vector in C++
12939 pub struct CVec_UpdateAddHTLCZ {
12940 /// The elements in the array.
12941 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12942 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12943 /// The number of elements pointed to by `data`.
12946 impl CVec_UpdateAddHTLCZ {
12947 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12948 if self.datalen == 0 { return Vec::new(); }
12949 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12950 self.data = core::ptr::null_mut();
12954 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12955 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12958 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12959 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12960 let datalen = v.len();
12961 let data = Box::into_raw(v.into_boxed_slice());
12962 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12966 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12967 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12968 impl Drop for CVec_UpdateAddHTLCZ {
12969 fn drop(&mut self) {
12970 if self.datalen == 0 { return; }
12971 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12974 impl Clone for CVec_UpdateAddHTLCZ {
12975 fn clone(&self) -> Self {
12976 let mut res = Vec::new();
12977 if self.datalen == 0 { return Self::from(res); }
12978 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12983 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12984 /// This corresponds to std::vector in C++
12985 pub struct CVec_UpdateFulfillHTLCZ {
12986 /// The elements in the array.
12987 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12988 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12989 /// The number of elements pointed to by `data`.
12992 impl CVec_UpdateFulfillHTLCZ {
12993 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12994 if self.datalen == 0 { return Vec::new(); }
12995 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12996 self.data = core::ptr::null_mut();
13000 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13001 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13004 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13005 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13006 let datalen = v.len();
13007 let data = Box::into_raw(v.into_boxed_slice());
13008 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13012 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13013 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13014 impl Drop for CVec_UpdateFulfillHTLCZ {
13015 fn drop(&mut self) {
13016 if self.datalen == 0 { return; }
13017 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13020 impl Clone for CVec_UpdateFulfillHTLCZ {
13021 fn clone(&self) -> Self {
13022 let mut res = Vec::new();
13023 if self.datalen == 0 { return Self::from(res); }
13024 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13029 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13030 /// This corresponds to std::vector in C++
13031 pub struct CVec_UpdateFailHTLCZ {
13032 /// The elements in the array.
13033 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13034 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13035 /// The number of elements pointed to by `data`.
13038 impl CVec_UpdateFailHTLCZ {
13039 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13040 if self.datalen == 0 { return Vec::new(); }
13041 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13042 self.data = core::ptr::null_mut();
13046 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13047 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13050 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13051 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13052 let datalen = v.len();
13053 let data = Box::into_raw(v.into_boxed_slice());
13054 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13059 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13060 impl Drop for CVec_UpdateFailHTLCZ {
13061 fn drop(&mut self) {
13062 if self.datalen == 0 { return; }
13063 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13066 impl Clone for CVec_UpdateFailHTLCZ {
13067 fn clone(&self) -> Self {
13068 let mut res = Vec::new();
13069 if self.datalen == 0 { return Self::from(res); }
13070 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13075 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13076 /// This corresponds to std::vector in C++
13077 pub struct CVec_UpdateFailMalformedHTLCZ {
13078 /// The elements in the array.
13079 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13080 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13081 /// The number of elements pointed to by `data`.
13084 impl CVec_UpdateFailMalformedHTLCZ {
13085 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13086 if self.datalen == 0 { return Vec::new(); }
13087 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13088 self.data = core::ptr::null_mut();
13092 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13093 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13096 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13097 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13098 let datalen = v.len();
13099 let data = Box::into_raw(v.into_boxed_slice());
13100 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13104 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13105 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13106 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13107 fn drop(&mut self) {
13108 if self.datalen == 0 { return; }
13109 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13112 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13113 fn clone(&self) -> Self {
13114 let mut res = Vec::new();
13115 if self.datalen == 0 { return Self::from(res); }
13116 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13121 /// The contents of CResult_AcceptChannelDecodeErrorZ
13122 pub union CResult_AcceptChannelDecodeErrorZPtr {
13123 /// A pointer to the contents in the success state.
13124 /// Reading from this pointer when `result_ok` is not set is undefined.
13125 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13126 /// A pointer to the contents in the error state.
13127 /// Reading from this pointer when `result_ok` is set is undefined.
13128 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13131 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13132 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13133 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13134 pub struct CResult_AcceptChannelDecodeErrorZ {
13135 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13136 /// `err` or `result` depending on the state of `result_ok`.
13137 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13138 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13139 pub result_ok: bool,
13142 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13143 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13144 CResult_AcceptChannelDecodeErrorZ {
13145 contents: CResult_AcceptChannelDecodeErrorZPtr {
13146 result: Box::into_raw(Box::new(o)),
13152 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13153 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13154 CResult_AcceptChannelDecodeErrorZ {
13155 contents: CResult_AcceptChannelDecodeErrorZPtr {
13156 err: Box::into_raw(Box::new(e)),
13161 /// Checks if the given object is currently in the success state
13163 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13167 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13168 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13169 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13170 fn drop(&mut self) {
13171 if self.result_ok {
13172 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13173 let _ = unsafe { Box::from_raw(self.contents.result) };
13176 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13177 let _ = unsafe { Box::from_raw(self.contents.err) };
13182 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13183 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13184 let contents = if o.result_ok {
13185 let result = unsafe { o.contents.result };
13186 unsafe { o.contents.result = core::ptr::null_mut() };
13187 CResult_AcceptChannelDecodeErrorZPtr { result }
13189 let err = unsafe { o.contents.err };
13190 unsafe { o.contents.err = core::ptr::null_mut(); }
13191 CResult_AcceptChannelDecodeErrorZPtr { err }
13195 result_ok: o.result_ok,
13199 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13200 fn clone(&self) -> Self {
13201 if self.result_ok {
13202 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13203 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13206 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13207 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13213 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13214 /// but with all dynamically-allocated buffers duplicated in new buffers.
13215 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13217 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13218 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13219 /// A pointer to the contents in the success state.
13220 /// Reading from this pointer when `result_ok` is not set is undefined.
13221 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13222 /// A pointer to the contents in the error state.
13223 /// Reading from this pointer when `result_ok` is set is undefined.
13224 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13227 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13228 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13229 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13230 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13231 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13232 /// `err` or `result` depending on the state of `result_ok`.
13233 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13234 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13235 pub result_ok: bool,
13238 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13239 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13240 CResult_AnnouncementSignaturesDecodeErrorZ {
13241 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13242 result: Box::into_raw(Box::new(o)),
13248 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13249 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13250 CResult_AnnouncementSignaturesDecodeErrorZ {
13251 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13252 err: Box::into_raw(Box::new(e)),
13257 /// Checks if the given object is currently in the success state
13259 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13263 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13264 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13265 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13266 fn drop(&mut self) {
13267 if self.result_ok {
13268 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13269 let _ = unsafe { Box::from_raw(self.contents.result) };
13272 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13273 let _ = unsafe { Box::from_raw(self.contents.err) };
13278 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13279 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13280 let contents = if o.result_ok {
13281 let result = unsafe { o.contents.result };
13282 unsafe { o.contents.result = core::ptr::null_mut() };
13283 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13285 let err = unsafe { o.contents.err };
13286 unsafe { o.contents.err = core::ptr::null_mut(); }
13287 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13291 result_ok: o.result_ok,
13295 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13296 fn clone(&self) -> Self {
13297 if self.result_ok {
13298 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13299 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13302 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13303 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13309 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13310 /// but with all dynamically-allocated buffers duplicated in new buffers.
13311 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13313 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13314 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13315 /// A pointer to the contents in the success state.
13316 /// Reading from this pointer when `result_ok` is not set is undefined.
13317 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13318 /// A pointer to the contents in the error state.
13319 /// Reading from this pointer when `result_ok` is set is undefined.
13320 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13323 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13324 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13326 pub struct CResult_ChannelReestablishDecodeErrorZ {
13327 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13328 /// `err` or `result` depending on the state of `result_ok`.
13329 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13330 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13331 pub result_ok: bool,
13334 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13335 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13336 CResult_ChannelReestablishDecodeErrorZ {
13337 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13338 result: Box::into_raw(Box::new(o)),
13344 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13345 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13346 CResult_ChannelReestablishDecodeErrorZ {
13347 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13348 err: Box::into_raw(Box::new(e)),
13353 /// Checks if the given object is currently in the success state
13355 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13359 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13360 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13361 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13362 fn drop(&mut self) {
13363 if self.result_ok {
13364 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13365 let _ = unsafe { Box::from_raw(self.contents.result) };
13368 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13369 let _ = unsafe { Box::from_raw(self.contents.err) };
13374 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
13375 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
13376 let contents = if o.result_ok {
13377 let result = unsafe { o.contents.result };
13378 unsafe { o.contents.result = core::ptr::null_mut() };
13379 CResult_ChannelReestablishDecodeErrorZPtr { result }
13381 let err = unsafe { o.contents.err };
13382 unsafe { o.contents.err = core::ptr::null_mut(); }
13383 CResult_ChannelReestablishDecodeErrorZPtr { err }
13387 result_ok: o.result_ok,
13391 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
13392 fn clone(&self) -> Self {
13393 if self.result_ok {
13394 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13395 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
13398 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13399 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13405 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13406 /// but with all dynamically-allocated buffers duplicated in new buffers.
13407 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
13409 /// The contents of CResult_ClosingSignedDecodeErrorZ
13410 pub union CResult_ClosingSignedDecodeErrorZPtr {
13411 /// A pointer to the contents in the success state.
13412 /// Reading from this pointer when `result_ok` is not set is undefined.
13413 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
13414 /// A pointer to the contents in the error state.
13415 /// Reading from this pointer when `result_ok` is set is undefined.
13416 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13419 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
13420 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13422 pub struct CResult_ClosingSignedDecodeErrorZ {
13423 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
13424 /// `err` or `result` depending on the state of `result_ok`.
13425 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
13426 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
13427 pub result_ok: bool,
13430 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13431 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
13432 CResult_ClosingSignedDecodeErrorZ {
13433 contents: CResult_ClosingSignedDecodeErrorZPtr {
13434 result: Box::into_raw(Box::new(o)),
13440 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13441 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
13442 CResult_ClosingSignedDecodeErrorZ {
13443 contents: CResult_ClosingSignedDecodeErrorZPtr {
13444 err: Box::into_raw(Box::new(e)),
13449 /// Checks if the given object is currently in the success state
13451 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
13455 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13456 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
13457 impl Drop for CResult_ClosingSignedDecodeErrorZ {
13458 fn drop(&mut self) {
13459 if self.result_ok {
13460 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13461 let _ = unsafe { Box::from_raw(self.contents.result) };
13464 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13465 let _ = unsafe { Box::from_raw(self.contents.err) };
13470 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
13471 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13472 let contents = if o.result_ok {
13473 let result = unsafe { o.contents.result };
13474 unsafe { o.contents.result = core::ptr::null_mut() };
13475 CResult_ClosingSignedDecodeErrorZPtr { result }
13477 let err = unsafe { o.contents.err };
13478 unsafe { o.contents.err = core::ptr::null_mut(); }
13479 CResult_ClosingSignedDecodeErrorZPtr { err }
13483 result_ok: o.result_ok,
13487 impl Clone for CResult_ClosingSignedDecodeErrorZ {
13488 fn clone(&self) -> Self {
13489 if self.result_ok {
13490 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
13491 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
13494 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
13495 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13501 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13502 /// but with all dynamically-allocated buffers duplicated in new buffers.
13503 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
13505 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
13506 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13507 /// A pointer to the contents in the success state.
13508 /// Reading from this pointer when `result_ok` is not set is undefined.
13509 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
13510 /// A pointer to the contents in the error state.
13511 /// Reading from this pointer when `result_ok` is set is undefined.
13512 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13515 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
13516 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13518 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
13519 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
13520 /// `err` or `result` depending on the state of `result_ok`.
13521 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
13522 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
13523 pub result_ok: bool,
13526 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13527 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13528 CResult_ClosingSignedFeeRangeDecodeErrorZ {
13529 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13530 result: Box::into_raw(Box::new(o)),
13536 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13537 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13538 CResult_ClosingSignedFeeRangeDecodeErrorZ {
13539 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13540 err: Box::into_raw(Box::new(e)),
13545 /// Checks if the given object is currently in the success state
13547 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
13551 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13552 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
13553 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13554 fn drop(&mut self) {
13555 if self.result_ok {
13556 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13557 let _ = unsafe { Box::from_raw(self.contents.result) };
13560 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13561 let _ = unsafe { Box::from_raw(self.contents.err) };
13566 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13567 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13568 let contents = if o.result_ok {
13569 let result = unsafe { o.contents.result };
13570 unsafe { o.contents.result = core::ptr::null_mut() };
13571 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13573 let err = unsafe { o.contents.err };
13574 unsafe { o.contents.err = core::ptr::null_mut(); }
13575 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13579 result_ok: o.result_ok,
13583 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13584 fn clone(&self) -> Self {
13585 if self.result_ok {
13586 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13587 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13590 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13591 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13597 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13598 /// but with all dynamically-allocated buffers duplicated in new buffers.
13599 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13601 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13602 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13603 /// A pointer to the contents in the success state.
13604 /// Reading from this pointer when `result_ok` is not set is undefined.
13605 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13606 /// A pointer to the contents in the error state.
13607 /// Reading from this pointer when `result_ok` is set is undefined.
13608 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13611 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13612 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13613 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13614 pub struct CResult_CommitmentSignedDecodeErrorZ {
13615 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13616 /// `err` or `result` depending on the state of `result_ok`.
13617 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13618 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13619 pub result_ok: bool,
13622 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13623 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13624 CResult_CommitmentSignedDecodeErrorZ {
13625 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13626 result: Box::into_raw(Box::new(o)),
13632 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13633 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13634 CResult_CommitmentSignedDecodeErrorZ {
13635 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13636 err: Box::into_raw(Box::new(e)),
13641 /// Checks if the given object is currently in the success state
13643 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13647 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13648 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13649 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13650 fn drop(&mut self) {
13651 if self.result_ok {
13652 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13653 let _ = unsafe { Box::from_raw(self.contents.result) };
13656 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13657 let _ = unsafe { Box::from_raw(self.contents.err) };
13662 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13663 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13664 let contents = if o.result_ok {
13665 let result = unsafe { o.contents.result };
13666 unsafe { o.contents.result = core::ptr::null_mut() };
13667 CResult_CommitmentSignedDecodeErrorZPtr { result }
13669 let err = unsafe { o.contents.err };
13670 unsafe { o.contents.err = core::ptr::null_mut(); }
13671 CResult_CommitmentSignedDecodeErrorZPtr { err }
13675 result_ok: o.result_ok,
13679 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13680 fn clone(&self) -> Self {
13681 if self.result_ok {
13682 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13683 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13686 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13687 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13693 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13694 /// but with all dynamically-allocated buffers duplicated in new buffers.
13695 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13697 /// The contents of CResult_FundingCreatedDecodeErrorZ
13698 pub union CResult_FundingCreatedDecodeErrorZPtr {
13699 /// A pointer to the contents in the success state.
13700 /// Reading from this pointer when `result_ok` is not set is undefined.
13701 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13702 /// A pointer to the contents in the error state.
13703 /// Reading from this pointer when `result_ok` is set is undefined.
13704 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13707 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13708 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13709 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13710 pub struct CResult_FundingCreatedDecodeErrorZ {
13711 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13712 /// `err` or `result` depending on the state of `result_ok`.
13713 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13714 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13715 pub result_ok: bool,
13718 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13719 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13720 CResult_FundingCreatedDecodeErrorZ {
13721 contents: CResult_FundingCreatedDecodeErrorZPtr {
13722 result: Box::into_raw(Box::new(o)),
13728 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13729 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13730 CResult_FundingCreatedDecodeErrorZ {
13731 contents: CResult_FundingCreatedDecodeErrorZPtr {
13732 err: Box::into_raw(Box::new(e)),
13737 /// Checks if the given object is currently in the success state
13739 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13743 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13744 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13745 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13746 fn drop(&mut self) {
13747 if self.result_ok {
13748 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13749 let _ = unsafe { Box::from_raw(self.contents.result) };
13752 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13753 let _ = unsafe { Box::from_raw(self.contents.err) };
13758 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13759 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13760 let contents = if o.result_ok {
13761 let result = unsafe { o.contents.result };
13762 unsafe { o.contents.result = core::ptr::null_mut() };
13763 CResult_FundingCreatedDecodeErrorZPtr { result }
13765 let err = unsafe { o.contents.err };
13766 unsafe { o.contents.err = core::ptr::null_mut(); }
13767 CResult_FundingCreatedDecodeErrorZPtr { err }
13771 result_ok: o.result_ok,
13775 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13776 fn clone(&self) -> Self {
13777 if self.result_ok {
13778 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13779 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13782 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13783 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13789 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13790 /// but with all dynamically-allocated buffers duplicated in new buffers.
13791 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13793 /// The contents of CResult_FundingSignedDecodeErrorZ
13794 pub union CResult_FundingSignedDecodeErrorZPtr {
13795 /// A pointer to the contents in the success state.
13796 /// Reading from this pointer when `result_ok` is not set is undefined.
13797 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13798 /// A pointer to the contents in the error state.
13799 /// Reading from this pointer when `result_ok` is set is undefined.
13800 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13803 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13804 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13806 pub struct CResult_FundingSignedDecodeErrorZ {
13807 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13808 /// `err` or `result` depending on the state of `result_ok`.
13809 pub contents: CResult_FundingSignedDecodeErrorZPtr,
13810 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13811 pub result_ok: bool,
13814 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13815 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13816 CResult_FundingSignedDecodeErrorZ {
13817 contents: CResult_FundingSignedDecodeErrorZPtr {
13818 result: Box::into_raw(Box::new(o)),
13824 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13825 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13826 CResult_FundingSignedDecodeErrorZ {
13827 contents: CResult_FundingSignedDecodeErrorZPtr {
13828 err: Box::into_raw(Box::new(e)),
13833 /// Checks if the given object is currently in the success state
13835 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13839 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13840 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13841 impl Drop for CResult_FundingSignedDecodeErrorZ {
13842 fn drop(&mut self) {
13843 if self.result_ok {
13844 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13845 let _ = unsafe { Box::from_raw(self.contents.result) };
13848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13849 let _ = unsafe { Box::from_raw(self.contents.err) };
13854 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13855 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13856 let contents = if o.result_ok {
13857 let result = unsafe { o.contents.result };
13858 unsafe { o.contents.result = core::ptr::null_mut() };
13859 CResult_FundingSignedDecodeErrorZPtr { result }
13861 let err = unsafe { o.contents.err };
13862 unsafe { o.contents.err = core::ptr::null_mut(); }
13863 CResult_FundingSignedDecodeErrorZPtr { err }
13867 result_ok: o.result_ok,
13871 impl Clone for CResult_FundingSignedDecodeErrorZ {
13872 fn clone(&self) -> Self {
13873 if self.result_ok {
13874 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13875 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13878 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13879 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13885 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13886 /// but with all dynamically-allocated buffers duplicated in new buffers.
13887 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13889 /// The contents of CResult_ChannelReadyDecodeErrorZ
13890 pub union CResult_ChannelReadyDecodeErrorZPtr {
13891 /// A pointer to the contents in the success state.
13892 /// Reading from this pointer when `result_ok` is not set is undefined.
13893 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13894 /// A pointer to the contents in the error state.
13895 /// Reading from this pointer when `result_ok` is set is undefined.
13896 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13899 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13900 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13902 pub struct CResult_ChannelReadyDecodeErrorZ {
13903 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13904 /// `err` or `result` depending on the state of `result_ok`.
13905 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13906 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13907 pub result_ok: bool,
13910 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13911 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13912 CResult_ChannelReadyDecodeErrorZ {
13913 contents: CResult_ChannelReadyDecodeErrorZPtr {
13914 result: Box::into_raw(Box::new(o)),
13920 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13921 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13922 CResult_ChannelReadyDecodeErrorZ {
13923 contents: CResult_ChannelReadyDecodeErrorZPtr {
13924 err: Box::into_raw(Box::new(e)),
13929 /// Checks if the given object is currently in the success state
13931 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13935 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13936 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13937 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13938 fn drop(&mut self) {
13939 if self.result_ok {
13940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13941 let _ = unsafe { Box::from_raw(self.contents.result) };
13944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13945 let _ = unsafe { Box::from_raw(self.contents.err) };
13950 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13952 let contents = if o.result_ok {
13953 let result = unsafe { o.contents.result };
13954 unsafe { o.contents.result = core::ptr::null_mut() };
13955 CResult_ChannelReadyDecodeErrorZPtr { result }
13957 let err = unsafe { o.contents.err };
13958 unsafe { o.contents.err = core::ptr::null_mut(); }
13959 CResult_ChannelReadyDecodeErrorZPtr { err }
13963 result_ok: o.result_ok,
13967 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13968 fn clone(&self) -> Self {
13969 if self.result_ok {
13970 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13971 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13974 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13981 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13982 /// but with all dynamically-allocated buffers duplicated in new buffers.
13983 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13985 /// The contents of CResult_InitDecodeErrorZ
13986 pub union CResult_InitDecodeErrorZPtr {
13987 /// A pointer to the contents in the success state.
13988 /// Reading from this pointer when `result_ok` is not set is undefined.
13989 pub result: *mut crate::lightning::ln::msgs::Init,
13990 /// A pointer to the contents in the error state.
13991 /// Reading from this pointer when `result_ok` is set is undefined.
13992 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13995 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13996 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13997 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13998 pub struct CResult_InitDecodeErrorZ {
13999 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
14000 /// `err` or `result` depending on the state of `result_ok`.
14001 pub contents: CResult_InitDecodeErrorZPtr,
14002 /// Whether this CResult_InitDecodeErrorZ represents a success state.
14003 pub result_ok: bool,
14006 /// Creates a new CResult_InitDecodeErrorZ in the success state.
14007 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
14008 CResult_InitDecodeErrorZ {
14009 contents: CResult_InitDecodeErrorZPtr {
14010 result: Box::into_raw(Box::new(o)),
14016 /// Creates a new CResult_InitDecodeErrorZ in the error state.
14017 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
14018 CResult_InitDecodeErrorZ {
14019 contents: CResult_InitDecodeErrorZPtr {
14020 err: Box::into_raw(Box::new(e)),
14025 /// Checks if the given object is currently in the success state
14027 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
14031 /// Frees any resources used by the CResult_InitDecodeErrorZ.
14032 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
14033 impl Drop for CResult_InitDecodeErrorZ {
14034 fn drop(&mut self) {
14035 if self.result_ok {
14036 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14037 let _ = unsafe { Box::from_raw(self.contents.result) };
14040 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14041 let _ = unsafe { Box::from_raw(self.contents.err) };
14046 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
14047 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
14048 let contents = if o.result_ok {
14049 let result = unsafe { o.contents.result };
14050 unsafe { o.contents.result = core::ptr::null_mut() };
14051 CResult_InitDecodeErrorZPtr { result }
14053 let err = unsafe { o.contents.err };
14054 unsafe { o.contents.err = core::ptr::null_mut(); }
14055 CResult_InitDecodeErrorZPtr { err }
14059 result_ok: o.result_ok,
14063 impl Clone for CResult_InitDecodeErrorZ {
14064 fn clone(&self) -> Self {
14065 if self.result_ok {
14066 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
14067 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
14070 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
14071 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14077 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14078 /// but with all dynamically-allocated buffers duplicated in new buffers.
14079 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
14081 /// The contents of CResult_OpenChannelDecodeErrorZ
14082 pub union CResult_OpenChannelDecodeErrorZPtr {
14083 /// A pointer to the contents in the success state.
14084 /// Reading from this pointer when `result_ok` is not set is undefined.
14085 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
14086 /// A pointer to the contents in the error state.
14087 /// Reading from this pointer when `result_ok` is set is undefined.
14088 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14091 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
14092 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14094 pub struct CResult_OpenChannelDecodeErrorZ {
14095 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
14096 /// `err` or `result` depending on the state of `result_ok`.
14097 pub contents: CResult_OpenChannelDecodeErrorZPtr,
14098 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
14099 pub result_ok: bool,
14102 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14103 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
14104 CResult_OpenChannelDecodeErrorZ {
14105 contents: CResult_OpenChannelDecodeErrorZPtr {
14106 result: Box::into_raw(Box::new(o)),
14112 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14113 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14114 CResult_OpenChannelDecodeErrorZ {
14115 contents: CResult_OpenChannelDecodeErrorZPtr {
14116 err: Box::into_raw(Box::new(e)),
14121 /// Checks if the given object is currently in the success state
14123 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14127 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14128 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14129 impl Drop for CResult_OpenChannelDecodeErrorZ {
14130 fn drop(&mut self) {
14131 if self.result_ok {
14132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14133 let _ = unsafe { Box::from_raw(self.contents.result) };
14136 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14137 let _ = unsafe { Box::from_raw(self.contents.err) };
14142 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14143 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14144 let contents = if o.result_ok {
14145 let result = unsafe { o.contents.result };
14146 unsafe { o.contents.result = core::ptr::null_mut() };
14147 CResult_OpenChannelDecodeErrorZPtr { result }
14149 let err = unsafe { o.contents.err };
14150 unsafe { o.contents.err = core::ptr::null_mut(); }
14151 CResult_OpenChannelDecodeErrorZPtr { err }
14155 result_ok: o.result_ok,
14159 impl Clone for CResult_OpenChannelDecodeErrorZ {
14160 fn clone(&self) -> Self {
14161 if self.result_ok {
14162 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14163 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14166 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14167 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14173 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14174 /// but with all dynamically-allocated buffers duplicated in new buffers.
14175 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14177 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14178 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14179 /// A pointer to the contents in the success state.
14180 /// Reading from this pointer when `result_ok` is not set is undefined.
14181 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14182 /// A pointer to the contents in the error state.
14183 /// Reading from this pointer when `result_ok` is set is undefined.
14184 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14187 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14188 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14190 pub struct CResult_RevokeAndACKDecodeErrorZ {
14191 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14192 /// `err` or `result` depending on the state of `result_ok`.
14193 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14194 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14195 pub result_ok: bool,
14198 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14199 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14200 CResult_RevokeAndACKDecodeErrorZ {
14201 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14202 result: Box::into_raw(Box::new(o)),
14208 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14209 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14210 CResult_RevokeAndACKDecodeErrorZ {
14211 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14212 err: Box::into_raw(Box::new(e)),
14217 /// Checks if the given object is currently in the success state
14219 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14223 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14224 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14225 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14226 fn drop(&mut self) {
14227 if self.result_ok {
14228 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14229 let _ = unsafe { Box::from_raw(self.contents.result) };
14232 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14233 let _ = unsafe { Box::from_raw(self.contents.err) };
14238 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14239 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14240 let contents = if o.result_ok {
14241 let result = unsafe { o.contents.result };
14242 unsafe { o.contents.result = core::ptr::null_mut() };
14243 CResult_RevokeAndACKDecodeErrorZPtr { result }
14245 let err = unsafe { o.contents.err };
14246 unsafe { o.contents.err = core::ptr::null_mut(); }
14247 CResult_RevokeAndACKDecodeErrorZPtr { err }
14251 result_ok: o.result_ok,
14255 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14256 fn clone(&self) -> Self {
14257 if self.result_ok {
14258 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14259 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14262 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14263 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14269 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14270 /// but with all dynamically-allocated buffers duplicated in new buffers.
14271 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14273 /// The contents of CResult_ShutdownDecodeErrorZ
14274 pub union CResult_ShutdownDecodeErrorZPtr {
14275 /// A pointer to the contents in the success state.
14276 /// Reading from this pointer when `result_ok` is not set is undefined.
14277 pub result: *mut crate::lightning::ln::msgs::Shutdown,
14278 /// A pointer to the contents in the error state.
14279 /// Reading from this pointer when `result_ok` is set is undefined.
14280 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14283 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14284 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14286 pub struct CResult_ShutdownDecodeErrorZ {
14287 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14288 /// `err` or `result` depending on the state of `result_ok`.
14289 pub contents: CResult_ShutdownDecodeErrorZPtr,
14290 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14291 pub result_ok: bool,
14294 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14295 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14296 CResult_ShutdownDecodeErrorZ {
14297 contents: CResult_ShutdownDecodeErrorZPtr {
14298 result: Box::into_raw(Box::new(o)),
14304 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14305 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14306 CResult_ShutdownDecodeErrorZ {
14307 contents: CResult_ShutdownDecodeErrorZPtr {
14308 err: Box::into_raw(Box::new(e)),
14313 /// Checks if the given object is currently in the success state
14315 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14319 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14320 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14321 impl Drop for CResult_ShutdownDecodeErrorZ {
14322 fn drop(&mut self) {
14323 if self.result_ok {
14324 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14325 let _ = unsafe { Box::from_raw(self.contents.result) };
14328 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14329 let _ = unsafe { Box::from_raw(self.contents.err) };
14334 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14335 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14336 let contents = if o.result_ok {
14337 let result = unsafe { o.contents.result };
14338 unsafe { o.contents.result = core::ptr::null_mut() };
14339 CResult_ShutdownDecodeErrorZPtr { result }
14341 let err = unsafe { o.contents.err };
14342 unsafe { o.contents.err = core::ptr::null_mut(); }
14343 CResult_ShutdownDecodeErrorZPtr { err }
14347 result_ok: o.result_ok,
14351 impl Clone for CResult_ShutdownDecodeErrorZ {
14352 fn clone(&self) -> Self {
14353 if self.result_ok {
14354 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14355 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14358 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14359 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14365 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14366 /// but with all dynamically-allocated buffers duplicated in new buffers.
14367 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
14369 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
14370 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
14371 /// A pointer to the contents in the success state.
14372 /// Reading from this pointer when `result_ok` is not set is undefined.
14373 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14374 /// A pointer to the contents in the error state.
14375 /// Reading from this pointer when `result_ok` is set is undefined.
14376 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14379 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
14380 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14382 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
14383 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
14384 /// `err` or `result` depending on the state of `result_ok`.
14385 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
14386 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
14387 pub result_ok: bool,
14390 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14391 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
14392 CResult_UpdateFailHTLCDecodeErrorZ {
14393 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14394 result: Box::into_raw(Box::new(o)),
14400 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14401 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
14402 CResult_UpdateFailHTLCDecodeErrorZ {
14403 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14404 err: Box::into_raw(Box::new(e)),
14409 /// Checks if the given object is currently in the success state
14411 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
14415 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14416 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
14417 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
14418 fn drop(&mut self) {
14419 if self.result_ok {
14420 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14421 let _ = unsafe { Box::from_raw(self.contents.result) };
14424 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14425 let _ = unsafe { Box::from_raw(self.contents.err) };
14430 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
14431 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14432 let contents = if o.result_ok {
14433 let result = unsafe { o.contents.result };
14434 unsafe { o.contents.result = core::ptr::null_mut() };
14435 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
14437 let err = unsafe { o.contents.err };
14438 unsafe { o.contents.err = core::ptr::null_mut(); }
14439 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
14443 result_ok: o.result_ok,
14447 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
14448 fn clone(&self) -> Self {
14449 if self.result_ok {
14450 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14451 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
14454 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14455 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14461 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14462 /// but with all dynamically-allocated buffers duplicated in new buffers.
14463 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
14465 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
14466 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14467 /// A pointer to the contents in the success state.
14468 /// Reading from this pointer when `result_ok` is not set is undefined.
14469 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14470 /// A pointer to the contents in the error state.
14471 /// Reading from this pointer when `result_ok` is set is undefined.
14472 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14475 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
14476 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14478 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14479 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
14480 /// `err` or `result` depending on the state of `result_ok`.
14481 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
14482 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
14483 pub result_ok: bool,
14486 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14487 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14488 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14489 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14490 result: Box::into_raw(Box::new(o)),
14496 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14497 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14498 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14499 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14500 err: Box::into_raw(Box::new(e)),
14505 /// Checks if the given object is currently in the success state
14507 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
14511 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14512 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
14513 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14514 fn drop(&mut self) {
14515 if self.result_ok {
14516 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14517 let _ = unsafe { Box::from_raw(self.contents.result) };
14520 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14521 let _ = unsafe { Box::from_raw(self.contents.err) };
14526 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14527 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14528 let contents = if o.result_ok {
14529 let result = unsafe { o.contents.result };
14530 unsafe { o.contents.result = core::ptr::null_mut() };
14531 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
14533 let err = unsafe { o.contents.err };
14534 unsafe { o.contents.err = core::ptr::null_mut(); }
14535 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
14539 result_ok: o.result_ok,
14543 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14544 fn clone(&self) -> Self {
14545 if self.result_ok {
14546 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14547 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
14550 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14551 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14557 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14558 /// but with all dynamically-allocated buffers duplicated in new buffers.
14559 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
14561 /// The contents of CResult_UpdateFeeDecodeErrorZ
14562 pub union CResult_UpdateFeeDecodeErrorZPtr {
14563 /// A pointer to the contents in the success state.
14564 /// Reading from this pointer when `result_ok` is not set is undefined.
14565 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14566 /// A pointer to the contents in the error state.
14567 /// Reading from this pointer when `result_ok` is set is undefined.
14568 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14571 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14572 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14574 pub struct CResult_UpdateFeeDecodeErrorZ {
14575 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14576 /// `err` or `result` depending on the state of `result_ok`.
14577 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14578 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14579 pub result_ok: bool,
14582 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14583 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14584 CResult_UpdateFeeDecodeErrorZ {
14585 contents: CResult_UpdateFeeDecodeErrorZPtr {
14586 result: Box::into_raw(Box::new(o)),
14592 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14593 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14594 CResult_UpdateFeeDecodeErrorZ {
14595 contents: CResult_UpdateFeeDecodeErrorZPtr {
14596 err: Box::into_raw(Box::new(e)),
14601 /// Checks if the given object is currently in the success state
14603 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14607 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14608 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14609 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14610 fn drop(&mut self) {
14611 if self.result_ok {
14612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14613 let _ = unsafe { Box::from_raw(self.contents.result) };
14616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14617 let _ = unsafe { Box::from_raw(self.contents.err) };
14622 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14623 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14624 let contents = if o.result_ok {
14625 let result = unsafe { o.contents.result };
14626 unsafe { o.contents.result = core::ptr::null_mut() };
14627 CResult_UpdateFeeDecodeErrorZPtr { result }
14629 let err = unsafe { o.contents.err };
14630 unsafe { o.contents.err = core::ptr::null_mut(); }
14631 CResult_UpdateFeeDecodeErrorZPtr { err }
14635 result_ok: o.result_ok,
14639 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14640 fn clone(&self) -> Self {
14641 if self.result_ok {
14642 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14643 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14646 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14647 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14653 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14654 /// but with all dynamically-allocated buffers duplicated in new buffers.
14655 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14657 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14658 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14659 /// A pointer to the contents in the success state.
14660 /// Reading from this pointer when `result_ok` is not set is undefined.
14661 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14662 /// A pointer to the contents in the error state.
14663 /// Reading from this pointer when `result_ok` is set is undefined.
14664 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14667 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14668 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14670 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14671 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14672 /// `err` or `result` depending on the state of `result_ok`.
14673 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14674 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14675 pub result_ok: bool,
14678 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14679 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14680 CResult_UpdateFulfillHTLCDecodeErrorZ {
14681 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14682 result: Box::into_raw(Box::new(o)),
14688 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14689 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14690 CResult_UpdateFulfillHTLCDecodeErrorZ {
14691 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14692 err: Box::into_raw(Box::new(e)),
14697 /// Checks if the given object is currently in the success state
14699 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14703 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14704 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14705 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14706 fn drop(&mut self) {
14707 if self.result_ok {
14708 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14709 let _ = unsafe { Box::from_raw(self.contents.result) };
14712 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14713 let _ = unsafe { Box::from_raw(self.contents.err) };
14718 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14719 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14720 let contents = if o.result_ok {
14721 let result = unsafe { o.contents.result };
14722 unsafe { o.contents.result = core::ptr::null_mut() };
14723 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14725 let err = unsafe { o.contents.err };
14726 unsafe { o.contents.err = core::ptr::null_mut(); }
14727 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14731 result_ok: o.result_ok,
14735 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14736 fn clone(&self) -> Self {
14737 if self.result_ok {
14738 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14739 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14742 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14743 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14749 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14750 /// but with all dynamically-allocated buffers duplicated in new buffers.
14751 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14753 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14754 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14755 /// A pointer to the contents in the success state.
14756 /// Reading from this pointer when `result_ok` is not set is undefined.
14757 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14758 /// A pointer to the contents in the error state.
14759 /// Reading from this pointer when `result_ok` is set is undefined.
14760 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14763 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14764 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14765 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14766 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14767 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14768 /// `err` or `result` depending on the state of `result_ok`.
14769 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14770 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14771 pub result_ok: bool,
14774 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14775 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14776 CResult_UpdateAddHTLCDecodeErrorZ {
14777 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14778 result: Box::into_raw(Box::new(o)),
14784 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14785 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14786 CResult_UpdateAddHTLCDecodeErrorZ {
14787 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14788 err: Box::into_raw(Box::new(e)),
14793 /// Checks if the given object is currently in the success state
14795 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14799 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14800 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14801 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14802 fn drop(&mut self) {
14803 if self.result_ok {
14804 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14805 let _ = unsafe { Box::from_raw(self.contents.result) };
14808 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14809 let _ = unsafe { Box::from_raw(self.contents.err) };
14814 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14815 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14816 let contents = if o.result_ok {
14817 let result = unsafe { o.contents.result };
14818 unsafe { o.contents.result = core::ptr::null_mut() };
14819 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14821 let err = unsafe { o.contents.err };
14822 unsafe { o.contents.err = core::ptr::null_mut(); }
14823 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14827 result_ok: o.result_ok,
14831 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14832 fn clone(&self) -> Self {
14833 if self.result_ok {
14834 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14835 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14838 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14839 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14845 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14846 /// but with all dynamically-allocated buffers duplicated in new buffers.
14847 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14849 /// The contents of CResult_OnionMessageDecodeErrorZ
14850 pub union CResult_OnionMessageDecodeErrorZPtr {
14851 /// A pointer to the contents in the success state.
14852 /// Reading from this pointer when `result_ok` is not set is undefined.
14853 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
14854 /// A pointer to the contents in the error state.
14855 /// Reading from this pointer when `result_ok` is set is undefined.
14856 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14859 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
14860 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14861 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14862 pub struct CResult_OnionMessageDecodeErrorZ {
14863 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
14864 /// `err` or `result` depending on the state of `result_ok`.
14865 pub contents: CResult_OnionMessageDecodeErrorZPtr,
14866 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
14867 pub result_ok: bool,
14870 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
14871 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
14872 CResult_OnionMessageDecodeErrorZ {
14873 contents: CResult_OnionMessageDecodeErrorZPtr {
14874 result: Box::into_raw(Box::new(o)),
14880 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
14881 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
14882 CResult_OnionMessageDecodeErrorZ {
14883 contents: CResult_OnionMessageDecodeErrorZPtr {
14884 err: Box::into_raw(Box::new(e)),
14889 /// Checks if the given object is currently in the success state
14891 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
14895 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
14896 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
14897 impl Drop for CResult_OnionMessageDecodeErrorZ {
14898 fn drop(&mut self) {
14899 if self.result_ok {
14900 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14901 let _ = unsafe { Box::from_raw(self.contents.result) };
14904 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14905 let _ = unsafe { Box::from_raw(self.contents.err) };
14910 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
14911 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14912 let contents = if o.result_ok {
14913 let result = unsafe { o.contents.result };
14914 unsafe { o.contents.result = core::ptr::null_mut() };
14915 CResult_OnionMessageDecodeErrorZPtr { result }
14917 let err = unsafe { o.contents.err };
14918 unsafe { o.contents.err = core::ptr::null_mut(); }
14919 CResult_OnionMessageDecodeErrorZPtr { err }
14923 result_ok: o.result_ok,
14927 impl Clone for CResult_OnionMessageDecodeErrorZ {
14928 fn clone(&self) -> Self {
14929 if self.result_ok {
14930 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
14931 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
14934 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
14935 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14941 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
14942 /// but with all dynamically-allocated buffers duplicated in new buffers.
14943 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
14945 /// The contents of CResult_PingDecodeErrorZ
14946 pub union CResult_PingDecodeErrorZPtr {
14947 /// A pointer to the contents in the success state.
14948 /// Reading from this pointer when `result_ok` is not set is undefined.
14949 pub result: *mut crate::lightning::ln::msgs::Ping,
14950 /// A pointer to the contents in the error state.
14951 /// Reading from this pointer when `result_ok` is set is undefined.
14952 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14955 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
14956 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
14957 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14958 pub struct CResult_PingDecodeErrorZ {
14959 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
14960 /// `err` or `result` depending on the state of `result_ok`.
14961 pub contents: CResult_PingDecodeErrorZPtr,
14962 /// Whether this CResult_PingDecodeErrorZ represents a success state.
14963 pub result_ok: bool,
14966 /// Creates a new CResult_PingDecodeErrorZ in the success state.
14967 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
14968 CResult_PingDecodeErrorZ {
14969 contents: CResult_PingDecodeErrorZPtr {
14970 result: Box::into_raw(Box::new(o)),
14976 /// Creates a new CResult_PingDecodeErrorZ in the error state.
14977 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
14978 CResult_PingDecodeErrorZ {
14979 contents: CResult_PingDecodeErrorZPtr {
14980 err: Box::into_raw(Box::new(e)),
14985 /// Checks if the given object is currently in the success state
14987 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
14991 /// Frees any resources used by the CResult_PingDecodeErrorZ.
14992 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
14993 impl Drop for CResult_PingDecodeErrorZ {
14994 fn drop(&mut self) {
14995 if self.result_ok {
14996 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14997 let _ = unsafe { Box::from_raw(self.contents.result) };
15000 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15001 let _ = unsafe { Box::from_raw(self.contents.err) };
15006 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
15007 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
15008 let contents = if o.result_ok {
15009 let result = unsafe { o.contents.result };
15010 unsafe { o.contents.result = core::ptr::null_mut() };
15011 CResult_PingDecodeErrorZPtr { result }
15013 let err = unsafe { o.contents.err };
15014 unsafe { o.contents.err = core::ptr::null_mut(); }
15015 CResult_PingDecodeErrorZPtr { err }
15019 result_ok: o.result_ok,
15023 impl Clone for CResult_PingDecodeErrorZ {
15024 fn clone(&self) -> Self {
15025 if self.result_ok {
15026 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
15027 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
15030 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
15031 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15037 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15038 /// but with all dynamically-allocated buffers duplicated in new buffers.
15039 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
15041 /// The contents of CResult_PongDecodeErrorZ
15042 pub union CResult_PongDecodeErrorZPtr {
15043 /// A pointer to the contents in the success state.
15044 /// Reading from this pointer when `result_ok` is not set is undefined.
15045 pub result: *mut crate::lightning::ln::msgs::Pong,
15046 /// A pointer to the contents in the error state.
15047 /// Reading from this pointer when `result_ok` is set is undefined.
15048 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15051 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15052 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15054 pub struct CResult_PongDecodeErrorZ {
15055 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
15056 /// `err` or `result` depending on the state of `result_ok`.
15057 pub contents: CResult_PongDecodeErrorZPtr,
15058 /// Whether this CResult_PongDecodeErrorZ represents a success state.
15059 pub result_ok: bool,
15062 /// Creates a new CResult_PongDecodeErrorZ in the success state.
15063 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
15064 CResult_PongDecodeErrorZ {
15065 contents: CResult_PongDecodeErrorZPtr {
15066 result: Box::into_raw(Box::new(o)),
15072 /// Creates a new CResult_PongDecodeErrorZ in the error state.
15073 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
15074 CResult_PongDecodeErrorZ {
15075 contents: CResult_PongDecodeErrorZPtr {
15076 err: Box::into_raw(Box::new(e)),
15081 /// Checks if the given object is currently in the success state
15083 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
15087 /// Frees any resources used by the CResult_PongDecodeErrorZ.
15088 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
15089 impl Drop for CResult_PongDecodeErrorZ {
15090 fn drop(&mut self) {
15091 if self.result_ok {
15092 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15093 let _ = unsafe { Box::from_raw(self.contents.result) };
15096 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15097 let _ = unsafe { Box::from_raw(self.contents.err) };
15102 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
15103 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
15104 let contents = if o.result_ok {
15105 let result = unsafe { o.contents.result };
15106 unsafe { o.contents.result = core::ptr::null_mut() };
15107 CResult_PongDecodeErrorZPtr { result }
15109 let err = unsafe { o.contents.err };
15110 unsafe { o.contents.err = core::ptr::null_mut(); }
15111 CResult_PongDecodeErrorZPtr { err }
15115 result_ok: o.result_ok,
15119 impl Clone for CResult_PongDecodeErrorZ {
15120 fn clone(&self) -> Self {
15121 if self.result_ok {
15122 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15123 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15126 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15127 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15133 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15134 /// but with all dynamically-allocated buffers duplicated in new buffers.
15135 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15137 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15138 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15139 /// A pointer to the contents in the success state.
15140 /// Reading from this pointer when `result_ok` is not set is undefined.
15141 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15142 /// A pointer to the contents in the error state.
15143 /// Reading from this pointer when `result_ok` is set is undefined.
15144 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15147 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15148 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15150 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15151 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15152 /// `err` or `result` depending on the state of `result_ok`.
15153 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15154 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15155 pub result_ok: bool,
15158 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15159 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15160 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15161 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15162 result: Box::into_raw(Box::new(o)),
15168 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15169 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15170 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15171 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15172 err: Box::into_raw(Box::new(e)),
15177 /// Checks if the given object is currently in the success state
15179 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15183 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15184 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15185 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15186 fn drop(&mut self) {
15187 if self.result_ok {
15188 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15189 let _ = unsafe { Box::from_raw(self.contents.result) };
15192 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15193 let _ = unsafe { Box::from_raw(self.contents.err) };
15198 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15199 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15200 let contents = if o.result_ok {
15201 let result = unsafe { o.contents.result };
15202 unsafe { o.contents.result = core::ptr::null_mut() };
15203 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15205 let err = unsafe { o.contents.err };
15206 unsafe { o.contents.err = core::ptr::null_mut(); }
15207 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15211 result_ok: o.result_ok,
15215 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15216 fn clone(&self) -> Self {
15217 if self.result_ok {
15218 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15219 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15222 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15223 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15229 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15230 /// but with all dynamically-allocated buffers duplicated in new buffers.
15231 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15233 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15234 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15235 /// A pointer to the contents in the success state.
15236 /// Reading from this pointer when `result_ok` is not set is undefined.
15237 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15238 /// A pointer to the contents in the error state.
15239 /// Reading from this pointer when `result_ok` is set is undefined.
15240 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15243 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15244 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15245 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15246 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15247 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15248 /// `err` or `result` depending on the state of `result_ok`.
15249 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15250 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15251 pub result_ok: bool,
15254 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15255 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15256 CResult_ChannelAnnouncementDecodeErrorZ {
15257 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15258 result: Box::into_raw(Box::new(o)),
15264 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15265 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15266 CResult_ChannelAnnouncementDecodeErrorZ {
15267 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15268 err: Box::into_raw(Box::new(e)),
15273 /// Checks if the given object is currently in the success state
15275 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15279 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15280 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15281 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15282 fn drop(&mut self) {
15283 if self.result_ok {
15284 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15285 let _ = unsafe { Box::from_raw(self.contents.result) };
15288 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15289 let _ = unsafe { Box::from_raw(self.contents.err) };
15294 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15295 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15296 let contents = if o.result_ok {
15297 let result = unsafe { o.contents.result };
15298 unsafe { o.contents.result = core::ptr::null_mut() };
15299 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15301 let err = unsafe { o.contents.err };
15302 unsafe { o.contents.err = core::ptr::null_mut(); }
15303 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15307 result_ok: o.result_ok,
15311 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15312 fn clone(&self) -> Self {
15313 if self.result_ok {
15314 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15315 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15318 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15319 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15325 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15326 /// but with all dynamically-allocated buffers duplicated in new buffers.
15327 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15329 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15330 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15331 /// A pointer to the contents in the success state.
15332 /// Reading from this pointer when `result_ok` is not set is undefined.
15333 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15334 /// A pointer to the contents in the error state.
15335 /// Reading from this pointer when `result_ok` is set is undefined.
15336 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15339 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15340 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15341 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15342 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15343 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15344 /// `err` or `result` depending on the state of `result_ok`.
15345 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15346 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15347 pub result_ok: bool,
15350 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15351 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15352 CResult_UnsignedChannelUpdateDecodeErrorZ {
15353 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15354 result: Box::into_raw(Box::new(o)),
15360 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15361 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15362 CResult_UnsignedChannelUpdateDecodeErrorZ {
15363 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15364 err: Box::into_raw(Box::new(e)),
15369 /// Checks if the given object is currently in the success state
15371 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
15375 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15376 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
15377 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
15378 fn drop(&mut self) {
15379 if self.result_ok {
15380 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15381 let _ = unsafe { Box::from_raw(self.contents.result) };
15384 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15385 let _ = unsafe { Box::from_raw(self.contents.err) };
15390 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
15391 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15392 let contents = if o.result_ok {
15393 let result = unsafe { o.contents.result };
15394 unsafe { o.contents.result = core::ptr::null_mut() };
15395 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
15397 let err = unsafe { o.contents.err };
15398 unsafe { o.contents.err = core::ptr::null_mut(); }
15399 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
15403 result_ok: o.result_ok,
15407 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
15408 fn clone(&self) -> Self {
15409 if self.result_ok {
15410 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15411 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
15414 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15415 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15421 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15422 /// but with all dynamically-allocated buffers duplicated in new buffers.
15423 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15425 /// The contents of CResult_ChannelUpdateDecodeErrorZ
15426 pub union CResult_ChannelUpdateDecodeErrorZPtr {
15427 /// A pointer to the contents in the success state.
15428 /// Reading from this pointer when `result_ok` is not set is undefined.
15429 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
15430 /// A pointer to the contents in the error state.
15431 /// Reading from this pointer when `result_ok` is set is undefined.
15432 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15435 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15436 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15437 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15438 pub struct CResult_ChannelUpdateDecodeErrorZ {
15439 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
15440 /// `err` or `result` depending on the state of `result_ok`.
15441 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
15442 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
15443 pub result_ok: bool,
15446 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15447 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
15448 CResult_ChannelUpdateDecodeErrorZ {
15449 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15450 result: Box::into_raw(Box::new(o)),
15456 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15457 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
15458 CResult_ChannelUpdateDecodeErrorZ {
15459 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15460 err: Box::into_raw(Box::new(e)),
15465 /// Checks if the given object is currently in the success state
15467 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
15471 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15472 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
15473 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
15474 fn drop(&mut self) {
15475 if self.result_ok {
15476 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15477 let _ = unsafe { Box::from_raw(self.contents.result) };
15480 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15481 let _ = unsafe { Box::from_raw(self.contents.err) };
15486 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
15487 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15488 let contents = if o.result_ok {
15489 let result = unsafe { o.contents.result };
15490 unsafe { o.contents.result = core::ptr::null_mut() };
15491 CResult_ChannelUpdateDecodeErrorZPtr { result }
15493 let err = unsafe { o.contents.err };
15494 unsafe { o.contents.err = core::ptr::null_mut(); }
15495 CResult_ChannelUpdateDecodeErrorZPtr { err }
15499 result_ok: o.result_ok,
15503 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
15504 fn clone(&self) -> Self {
15505 if self.result_ok {
15506 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15507 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
15510 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15511 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15517 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15518 /// but with all dynamically-allocated buffers duplicated in new buffers.
15519 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15521 /// The contents of CResult_ErrorMessageDecodeErrorZ
15522 pub union CResult_ErrorMessageDecodeErrorZPtr {
15523 /// A pointer to the contents in the success state.
15524 /// Reading from this pointer when `result_ok` is not set is undefined.
15525 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
15526 /// A pointer to the contents in the error state.
15527 /// Reading from this pointer when `result_ok` is set is undefined.
15528 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15531 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
15532 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15533 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15534 pub struct CResult_ErrorMessageDecodeErrorZ {
15535 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
15536 /// `err` or `result` depending on the state of `result_ok`.
15537 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
15538 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
15539 pub result_ok: bool,
15542 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15543 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
15544 CResult_ErrorMessageDecodeErrorZ {
15545 contents: CResult_ErrorMessageDecodeErrorZPtr {
15546 result: Box::into_raw(Box::new(o)),
15552 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15553 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
15554 CResult_ErrorMessageDecodeErrorZ {
15555 contents: CResult_ErrorMessageDecodeErrorZPtr {
15556 err: Box::into_raw(Box::new(e)),
15561 /// Checks if the given object is currently in the success state
15563 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
15567 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15568 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
15569 impl Drop for CResult_ErrorMessageDecodeErrorZ {
15570 fn drop(&mut self) {
15571 if self.result_ok {
15572 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15573 let _ = unsafe { Box::from_raw(self.contents.result) };
15576 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15577 let _ = unsafe { Box::from_raw(self.contents.err) };
15582 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
15583 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15584 let contents = if o.result_ok {
15585 let result = unsafe { o.contents.result };
15586 unsafe { o.contents.result = core::ptr::null_mut() };
15587 CResult_ErrorMessageDecodeErrorZPtr { result }
15589 let err = unsafe { o.contents.err };
15590 unsafe { o.contents.err = core::ptr::null_mut(); }
15591 CResult_ErrorMessageDecodeErrorZPtr { err }
15595 result_ok: o.result_ok,
15599 impl Clone for CResult_ErrorMessageDecodeErrorZ {
15600 fn clone(&self) -> Self {
15601 if self.result_ok {
15602 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
15603 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
15606 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
15607 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15613 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15614 /// but with all dynamically-allocated buffers duplicated in new buffers.
15615 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
15617 /// The contents of CResult_WarningMessageDecodeErrorZ
15618 pub union CResult_WarningMessageDecodeErrorZPtr {
15619 /// A pointer to the contents in the success state.
15620 /// Reading from this pointer when `result_ok` is not set is undefined.
15621 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
15622 /// A pointer to the contents in the error state.
15623 /// Reading from this pointer when `result_ok` is set is undefined.
15624 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15627 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
15628 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15629 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15630 pub struct CResult_WarningMessageDecodeErrorZ {
15631 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
15632 /// `err` or `result` depending on the state of `result_ok`.
15633 pub contents: CResult_WarningMessageDecodeErrorZPtr,
15634 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
15635 pub result_ok: bool,
15638 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
15639 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
15640 CResult_WarningMessageDecodeErrorZ {
15641 contents: CResult_WarningMessageDecodeErrorZPtr {
15642 result: Box::into_raw(Box::new(o)),
15648 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
15649 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
15650 CResult_WarningMessageDecodeErrorZ {
15651 contents: CResult_WarningMessageDecodeErrorZPtr {
15652 err: Box::into_raw(Box::new(e)),
15657 /// Checks if the given object is currently in the success state
15659 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15663 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15664 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15665 impl Drop for CResult_WarningMessageDecodeErrorZ {
15666 fn drop(&mut self) {
15667 if self.result_ok {
15668 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15669 let _ = unsafe { Box::from_raw(self.contents.result) };
15672 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15673 let _ = unsafe { Box::from_raw(self.contents.err) };
15678 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15679 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15680 let contents = if o.result_ok {
15681 let result = unsafe { o.contents.result };
15682 unsafe { o.contents.result = core::ptr::null_mut() };
15683 CResult_WarningMessageDecodeErrorZPtr { result }
15685 let err = unsafe { o.contents.err };
15686 unsafe { o.contents.err = core::ptr::null_mut(); }
15687 CResult_WarningMessageDecodeErrorZPtr { err }
15691 result_ok: o.result_ok,
15695 impl Clone for CResult_WarningMessageDecodeErrorZ {
15696 fn clone(&self) -> Self {
15697 if self.result_ok {
15698 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15699 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15702 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15703 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15709 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15710 /// but with all dynamically-allocated buffers duplicated in new buffers.
15711 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15713 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15714 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15715 /// A pointer to the contents in the success state.
15716 /// Reading from this pointer when `result_ok` is not set is undefined.
15717 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15718 /// A pointer to the contents in the error state.
15719 /// Reading from this pointer when `result_ok` is set is undefined.
15720 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15723 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15724 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15726 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15727 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15728 /// `err` or `result` depending on the state of `result_ok`.
15729 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15730 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15731 pub result_ok: bool,
15734 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15735 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15736 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15737 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15738 result: Box::into_raw(Box::new(o)),
15744 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15745 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15746 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15747 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15748 err: Box::into_raw(Box::new(e)),
15753 /// Checks if the given object is currently in the success state
15755 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
15759 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15760 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
15761 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15762 fn drop(&mut self) {
15763 if self.result_ok {
15764 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15765 let _ = unsafe { Box::from_raw(self.contents.result) };
15768 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15769 let _ = unsafe { Box::from_raw(self.contents.err) };
15774 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15775 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15776 let contents = if o.result_ok {
15777 let result = unsafe { o.contents.result };
15778 unsafe { o.contents.result = core::ptr::null_mut() };
15779 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
15781 let err = unsafe { o.contents.err };
15782 unsafe { o.contents.err = core::ptr::null_mut(); }
15783 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
15787 result_ok: o.result_ok,
15791 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15792 fn clone(&self) -> Self {
15793 if self.result_ok {
15794 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15795 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15798 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15799 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15805 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15806 /// but with all dynamically-allocated buffers duplicated in new buffers.
15807 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15809 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15810 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15811 /// A pointer to the contents in the success state.
15812 /// Reading from this pointer when `result_ok` is not set is undefined.
15813 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15814 /// A pointer to the contents in the error state.
15815 /// Reading from this pointer when `result_ok` is set is undefined.
15816 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15819 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15820 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15821 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15822 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15823 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15824 /// `err` or `result` depending on the state of `result_ok`.
15825 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15826 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15827 pub result_ok: bool,
15830 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15831 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15832 CResult_NodeAnnouncementDecodeErrorZ {
15833 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15834 result: Box::into_raw(Box::new(o)),
15840 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15841 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15842 CResult_NodeAnnouncementDecodeErrorZ {
15843 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15844 err: Box::into_raw(Box::new(e)),
15849 /// Checks if the given object is currently in the success state
15851 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15855 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15856 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15857 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15858 fn drop(&mut self) {
15859 if self.result_ok {
15860 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15861 let _ = unsafe { Box::from_raw(self.contents.result) };
15864 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15865 let _ = unsafe { Box::from_raw(self.contents.err) };
15870 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15871 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15872 let contents = if o.result_ok {
15873 let result = unsafe { o.contents.result };
15874 unsafe { o.contents.result = core::ptr::null_mut() };
15875 CResult_NodeAnnouncementDecodeErrorZPtr { result }
15877 let err = unsafe { o.contents.err };
15878 unsafe { o.contents.err = core::ptr::null_mut(); }
15879 CResult_NodeAnnouncementDecodeErrorZPtr { err }
15883 result_ok: o.result_ok,
15887 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15888 fn clone(&self) -> Self {
15889 if self.result_ok {
15890 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15891 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15894 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15895 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15901 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15902 /// but with all dynamically-allocated buffers duplicated in new buffers.
15903 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15905 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15906 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15907 /// A pointer to the contents in the success state.
15908 /// Reading from this pointer when `result_ok` is not set is undefined.
15909 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15910 /// A pointer to the contents in the error state.
15911 /// Reading from this pointer when `result_ok` is set is undefined.
15912 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15915 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15916 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15918 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15919 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15920 /// `err` or `result` depending on the state of `result_ok`.
15921 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15922 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15923 pub result_ok: bool,
15926 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15927 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15928 CResult_QueryShortChannelIdsDecodeErrorZ {
15929 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15930 result: Box::into_raw(Box::new(o)),
15936 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15937 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15938 CResult_QueryShortChannelIdsDecodeErrorZ {
15939 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15940 err: Box::into_raw(Box::new(e)),
15945 /// Checks if the given object is currently in the success state
15947 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
15951 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15952 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
15953 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
15954 fn drop(&mut self) {
15955 if self.result_ok {
15956 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15957 let _ = unsafe { Box::from_raw(self.contents.result) };
15960 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15961 let _ = unsafe { Box::from_raw(self.contents.err) };
15966 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
15967 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
15968 let contents = if o.result_ok {
15969 let result = unsafe { o.contents.result };
15970 unsafe { o.contents.result = core::ptr::null_mut() };
15971 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
15973 let err = unsafe { o.contents.err };
15974 unsafe { o.contents.err = core::ptr::null_mut(); }
15975 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
15979 result_ok: o.result_ok,
15983 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
15984 fn clone(&self) -> Self {
15985 if self.result_ok {
15986 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15987 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
15990 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15991 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15997 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15998 /// but with all dynamically-allocated buffers duplicated in new buffers.
15999 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
16001 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16002 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16003 /// A pointer to the contents in the success state.
16004 /// Reading from this pointer when `result_ok` is not set is undefined.
16005 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
16006 /// A pointer to the contents in the error state.
16007 /// Reading from this pointer when `result_ok` is set is undefined.
16008 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16011 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16012 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16013 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16014 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16015 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16016 /// `err` or `result` depending on the state of `result_ok`.
16017 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
16018 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16019 pub result_ok: bool,
16022 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16023 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16024 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16025 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16026 result: Box::into_raw(Box::new(o)),
16032 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16033 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16034 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16035 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16036 err: Box::into_raw(Box::new(e)),
16041 /// Checks if the given object is currently in the success state
16043 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
16047 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16048 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
16049 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16050 fn drop(&mut self) {
16051 if self.result_ok {
16052 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16053 let _ = unsafe { Box::from_raw(self.contents.result) };
16056 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16057 let _ = unsafe { Box::from_raw(self.contents.err) };
16062 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16063 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
16064 let contents = if o.result_ok {
16065 let result = unsafe { o.contents.result };
16066 unsafe { o.contents.result = core::ptr::null_mut() };
16067 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
16069 let err = unsafe { o.contents.err };
16070 unsafe { o.contents.err = core::ptr::null_mut(); }
16071 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
16075 result_ok: o.result_ok,
16079 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16080 fn clone(&self) -> Self {
16081 if self.result_ok {
16082 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16083 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
16086 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16087 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16093 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16094 /// but with all dynamically-allocated buffers duplicated in new buffers.
16095 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
16097 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
16098 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
16099 /// A pointer to the contents in the success state.
16100 /// Reading from this pointer when `result_ok` is not set is undefined.
16101 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
16102 /// A pointer to the contents in the error state.
16103 /// Reading from this pointer when `result_ok` is set is undefined.
16104 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16107 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16108 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16110 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16111 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16112 /// `err` or `result` depending on the state of `result_ok`.
16113 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16114 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16115 pub result_ok: bool,
16118 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16119 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16120 CResult_QueryChannelRangeDecodeErrorZ {
16121 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16122 result: Box::into_raw(Box::new(o)),
16128 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16129 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16130 CResult_QueryChannelRangeDecodeErrorZ {
16131 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16132 err: Box::into_raw(Box::new(e)),
16137 /// Checks if the given object is currently in the success state
16139 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16143 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16144 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16145 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16146 fn drop(&mut self) {
16147 if self.result_ok {
16148 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16149 let _ = unsafe { Box::from_raw(self.contents.result) };
16152 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16153 let _ = unsafe { Box::from_raw(self.contents.err) };
16158 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16159 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16160 let contents = if o.result_ok {
16161 let result = unsafe { o.contents.result };
16162 unsafe { o.contents.result = core::ptr::null_mut() };
16163 CResult_QueryChannelRangeDecodeErrorZPtr { result }
16165 let err = unsafe { o.contents.err };
16166 unsafe { o.contents.err = core::ptr::null_mut(); }
16167 CResult_QueryChannelRangeDecodeErrorZPtr { err }
16171 result_ok: o.result_ok,
16175 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16176 fn clone(&self) -> Self {
16177 if self.result_ok {
16178 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16179 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16182 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16183 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16189 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16190 /// but with all dynamically-allocated buffers duplicated in new buffers.
16191 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16193 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16194 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16195 /// A pointer to the contents in the success state.
16196 /// Reading from this pointer when `result_ok` is not set is undefined.
16197 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16198 /// A pointer to the contents in the error state.
16199 /// Reading from this pointer when `result_ok` is set is undefined.
16200 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16203 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16204 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16206 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16207 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16208 /// `err` or `result` depending on the state of `result_ok`.
16209 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16210 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16211 pub result_ok: bool,
16214 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16215 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16216 CResult_ReplyChannelRangeDecodeErrorZ {
16217 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16218 result: Box::into_raw(Box::new(o)),
16224 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16225 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16226 CResult_ReplyChannelRangeDecodeErrorZ {
16227 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16228 err: Box::into_raw(Box::new(e)),
16233 /// Checks if the given object is currently in the success state
16235 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16239 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16240 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16241 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16242 fn drop(&mut self) {
16243 if self.result_ok {
16244 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16245 let _ = unsafe { Box::from_raw(self.contents.result) };
16248 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16249 let _ = unsafe { Box::from_raw(self.contents.err) };
16254 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16255 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16256 let contents = if o.result_ok {
16257 let result = unsafe { o.contents.result };
16258 unsafe { o.contents.result = core::ptr::null_mut() };
16259 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16261 let err = unsafe { o.contents.err };
16262 unsafe { o.contents.err = core::ptr::null_mut(); }
16263 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16267 result_ok: o.result_ok,
16271 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16272 fn clone(&self) -> Self {
16273 if self.result_ok {
16274 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16275 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16278 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16279 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16285 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16286 /// but with all dynamically-allocated buffers duplicated in new buffers.
16287 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16289 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16290 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16291 /// A pointer to the contents in the success state.
16292 /// Reading from this pointer when `result_ok` is not set is undefined.
16293 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16294 /// A pointer to the contents in the error state.
16295 /// Reading from this pointer when `result_ok` is set is undefined.
16296 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16299 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16300 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16302 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16303 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16304 /// `err` or `result` depending on the state of `result_ok`.
16305 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16306 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16307 pub result_ok: bool,
16310 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16311 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16312 CResult_GossipTimestampFilterDecodeErrorZ {
16313 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16314 result: Box::into_raw(Box::new(o)),
16320 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16321 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16322 CResult_GossipTimestampFilterDecodeErrorZ {
16323 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16324 err: Box::into_raw(Box::new(e)),
16329 /// Checks if the given object is currently in the success state
16331 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16335 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16336 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16337 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16338 fn drop(&mut self) {
16339 if self.result_ok {
16340 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16341 let _ = unsafe { Box::from_raw(self.contents.result) };
16344 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16345 let _ = unsafe { Box::from_raw(self.contents.err) };
16350 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16351 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16352 let contents = if o.result_ok {
16353 let result = unsafe { o.contents.result };
16354 unsafe { o.contents.result = core::ptr::null_mut() };
16355 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16357 let err = unsafe { o.contents.err };
16358 unsafe { o.contents.err = core::ptr::null_mut(); }
16359 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16363 result_ok: o.result_ok,
16367 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
16368 fn clone(&self) -> Self {
16369 if self.result_ok {
16370 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16371 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
16374 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16375 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16381 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16382 /// but with all dynamically-allocated buffers duplicated in new buffers.
16383 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
16385 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16386 /// This corresponds to std::vector in C++
16387 pub struct CVec_PhantomRouteHintsZ {
16388 /// The elements in the array.
16389 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16390 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
16391 /// The number of elements pointed to by `data`.
16394 impl CVec_PhantomRouteHintsZ {
16395 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
16396 if self.datalen == 0 { return Vec::new(); }
16397 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16398 self.data = core::ptr::null_mut();
16402 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
16403 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16406 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
16407 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
16408 let datalen = v.len();
16409 let data = Box::into_raw(v.into_boxed_slice());
16410 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16414 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16415 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
16416 impl Drop for CVec_PhantomRouteHintsZ {
16417 fn drop(&mut self) {
16418 if self.datalen == 0 { return; }
16419 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16422 impl Clone for CVec_PhantomRouteHintsZ {
16423 fn clone(&self) -> Self {
16424 let mut res = Vec::new();
16425 if self.datalen == 0 { return Self::from(res); }
16426 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16431 /// The contents of CResult_InvoiceSignOrCreationErrorZ
16432 pub union CResult_InvoiceSignOrCreationErrorZPtr {
16433 /// A pointer to the contents in the success state.
16434 /// Reading from this pointer when `result_ok` is not set is undefined.
16435 pub result: *mut crate::lightning_invoice::Invoice,
16436 /// A pointer to the contents in the error state.
16437 /// Reading from this pointer when `result_ok` is set is undefined.
16438 pub err: *mut crate::lightning_invoice::SignOrCreationError,
16441 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16442 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16444 pub struct CResult_InvoiceSignOrCreationErrorZ {
16445 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
16446 /// `err` or `result` depending on the state of `result_ok`.
16447 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
16448 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
16449 pub result_ok: bool,
16452 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16453 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
16454 CResult_InvoiceSignOrCreationErrorZ {
16455 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16456 result: Box::into_raw(Box::new(o)),
16462 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16463 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
16464 CResult_InvoiceSignOrCreationErrorZ {
16465 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16466 err: Box::into_raw(Box::new(e)),
16471 /// Checks if the given object is currently in the success state
16473 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
16477 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16478 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
16479 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
16480 fn drop(&mut self) {
16481 if self.result_ok {
16482 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16483 let _ = unsafe { Box::from_raw(self.contents.result) };
16486 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16487 let _ = unsafe { Box::from_raw(self.contents.err) };
16492 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
16493 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
16494 let contents = if o.result_ok {
16495 let result = unsafe { o.contents.result };
16496 unsafe { o.contents.result = core::ptr::null_mut() };
16497 CResult_InvoiceSignOrCreationErrorZPtr { result }
16499 let err = unsafe { o.contents.err };
16500 unsafe { o.contents.err = core::ptr::null_mut(); }
16501 CResult_InvoiceSignOrCreationErrorZPtr { err }
16505 result_ok: o.result_ok,
16509 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
16510 fn clone(&self) -> Self {
16511 if self.result_ok {
16512 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16513 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
16516 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16517 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
16523 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16524 /// but with all dynamically-allocated buffers duplicated in new buffers.
16525 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
16527 /// An enum which can either contain a crate::lightning::chain::Filter or not
16528 pub enum COption_FilterZ {
16529 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
16530 Some(crate::lightning::chain::Filter),
16531 /// When we're in this state, this COption_FilterZ contains nothing
16534 impl COption_FilterZ {
16535 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
16536 if let Self::None = self { false } else { true }
16538 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
16541 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
16542 if let Self::Some(v) = self { v } else { unreachable!() }
16546 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16547 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
16548 COption_FilterZ::Some(o)
16551 /// Constructs a new COption_FilterZ containing nothing
16552 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
16553 COption_FilterZ::None
16556 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16557 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
16559 /// The contents of CResult_LockedChannelMonitorNoneZ
16560 pub union CResult_LockedChannelMonitorNoneZPtr {
16561 /// A pointer to the contents in the success state.
16562 /// Reading from this pointer when `result_ok` is not set is undefined.
16563 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
16564 /// Note that this value is always NULL, as there are no contents in the Err variant
16565 pub err: *mut core::ffi::c_void,
16568 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
16569 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
16570 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16571 pub struct CResult_LockedChannelMonitorNoneZ {
16572 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
16573 /// `err` or `result` depending on the state of `result_ok`.
16574 pub contents: CResult_LockedChannelMonitorNoneZPtr,
16575 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
16576 pub result_ok: bool,
16579 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16580 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
16581 CResult_LockedChannelMonitorNoneZ {
16582 contents: CResult_LockedChannelMonitorNoneZPtr {
16583 result: Box::into_raw(Box::new(o)),
16589 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16590 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
16591 CResult_LockedChannelMonitorNoneZ {
16592 contents: CResult_LockedChannelMonitorNoneZPtr {
16593 err: core::ptr::null_mut(),
16598 /// Checks if the given object is currently in the success state
16600 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
16604 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16605 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
16606 impl Drop for CResult_LockedChannelMonitorNoneZ {
16607 fn drop(&mut self) {
16608 if self.result_ok {
16609 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16610 let _ = unsafe { Box::from_raw(self.contents.result) };
16616 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
16617 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
16618 let contents = if o.result_ok {
16619 let result = unsafe { o.contents.result };
16620 unsafe { o.contents.result = core::ptr::null_mut() };
16621 CResult_LockedChannelMonitorNoneZPtr { result }
16623 let _ = unsafe { Box::from_raw(o.contents.err) };
16624 o.contents.err = core::ptr::null_mut();
16625 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
16629 result_ok: o.result_ok,
16634 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
16635 /// This corresponds to std::vector in C++
16636 pub struct CVec_OutPointZ {
16637 /// The elements in the array.
16638 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16639 pub data: *mut crate::lightning::chain::transaction::OutPoint,
16640 /// The number of elements pointed to by `data`.
16643 impl CVec_OutPointZ {
16644 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
16645 if self.datalen == 0 { return Vec::new(); }
16646 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16647 self.data = core::ptr::null_mut();
16651 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
16652 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16655 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
16656 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
16657 let datalen = v.len();
16658 let data = Box::into_raw(v.into_boxed_slice());
16659 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16663 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16664 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
16665 impl Drop for CVec_OutPointZ {
16666 fn drop(&mut self) {
16667 if self.datalen == 0 { return; }
16668 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16671 impl Clone for CVec_OutPointZ {
16672 fn clone(&self) -> Self {
16673 let mut res = Vec::new();
16674 if self.datalen == 0 { return Self::from(res); }
16675 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });