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 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
4040 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
4041 /// Note that this value is always NULL, as there are no contents in the OK variant
4042 pub result: *mut core::ffi::c_void,
4043 /// A pointer to the contents in the error state.
4044 /// Reading from this pointer when `result_ok` is set is undefined.
4045 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
4048 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
4049 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
4050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4051 pub struct CResult_NoneChannelMonitorUpdateErrZ {
4052 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
4053 /// `err` or `result` depending on the state of `result_ok`.
4054 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
4055 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
4056 pub result_ok: bool,
4059 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
4060 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
4061 CResult_NoneChannelMonitorUpdateErrZ {
4062 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4063 result: core::ptr::null_mut(),
4069 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
4070 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
4071 CResult_NoneChannelMonitorUpdateErrZ {
4072 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4073 err: Box::into_raw(Box::new(e)),
4078 /// Checks if the given object is currently in the success state
4080 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
4084 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
4085 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
4086 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
4087 fn drop(&mut self) {
4090 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4091 let _ = unsafe { Box::from_raw(self.contents.err) };
4096 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
4097 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
4098 let contents = if o.result_ok {
4099 let _ = unsafe { Box::from_raw(o.contents.result) };
4100 o.contents.result = core::ptr::null_mut();
4101 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
4103 let err = unsafe { o.contents.err };
4104 unsafe { o.contents.err = core::ptr::null_mut(); }
4105 CResult_NoneChannelMonitorUpdateErrZPtr { err }
4109 result_ok: o.result_ok,
4113 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
4114 fn clone(&self) -> Self {
4116 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4117 result: core::ptr::null_mut()
4120 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4121 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
4127 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
4128 /// but with all dynamically-allocated buffers duplicated in new buffers.
4129 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
4131 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4132 /// This corresponds to std::vector in C++
4133 pub struct CVec_MonitorEventZ {
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::lightning::chain::channelmonitor::MonitorEvent,
4137 /// The number of elements pointed to by `data`.
4140 impl CVec_MonitorEventZ {
4141 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
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::lightning::chain::channelmonitor::MonitorEvent] {
4149 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4152 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4153 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> 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_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4162 impl Drop for CVec_MonitorEventZ {
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_MonitorEventZ {
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 /// A tuple of 3 elements. See the individual fields for the types contained.
4178 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4179 /// The element at position 0
4180 pub a: crate::lightning::chain::transaction::OutPoint,
4181 /// The element at position 1
4182 pub b: crate::c_types::derived::CVec_MonitorEventZ,
4183 /// The element at position 2
4184 pub c: crate::c_types::PublicKey,
4186 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4187 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4195 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4196 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4197 (self.a, self.b, self.c)
4200 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4201 fn clone(&self) -> Self {
4203 a: Clone::clone(&self.a),
4204 b: Clone::clone(&self.b),
4205 c: Clone::clone(&self.c),
4210 /// Creates a new tuple which has the same data as `orig`
4211 /// but with all dynamically-allocated buffers duplicated in new buffers.
4212 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4213 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4215 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 {
4216 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4220 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4221 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4223 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4224 /// This corresponds to std::vector in C++
4225 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4226 /// The elements in the array.
4227 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4228 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4229 /// The number of elements pointed to by `data`.
4232 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4233 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4234 if self.datalen == 0 { return Vec::new(); }
4235 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4236 self.data = core::ptr::null_mut();
4240 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4241 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4244 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4245 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4246 let datalen = v.len();
4247 let data = Box::into_raw(v.into_boxed_slice());
4248 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4252 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4253 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4254 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4255 fn drop(&mut self) {
4256 if self.datalen == 0 { return; }
4257 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4260 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4261 fn clone(&self) -> Self {
4262 let mut res = Vec::new();
4263 if self.datalen == 0 { return Self::from(res); }
4264 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4269 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4270 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4271 /// A pointer to the contents in the success state.
4272 /// Reading from this pointer when `result_ok` is not set is undefined.
4273 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4274 /// A pointer to the contents in the error state.
4275 /// Reading from this pointer when `result_ok` is set is undefined.
4276 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4279 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4280 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4282 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4283 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4284 /// `err` or `result` depending on the state of `result_ok`.
4285 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4286 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4287 pub result_ok: bool,
4290 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4291 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4292 CResult_FixedPenaltyScorerDecodeErrorZ {
4293 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4294 result: Box::into_raw(Box::new(o)),
4300 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4301 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4302 CResult_FixedPenaltyScorerDecodeErrorZ {
4303 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4304 err: Box::into_raw(Box::new(e)),
4309 /// Checks if the given object is currently in the success state
4311 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4315 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4316 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4317 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4318 fn drop(&mut self) {
4320 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4321 let _ = unsafe { Box::from_raw(self.contents.result) };
4324 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4325 let _ = unsafe { Box::from_raw(self.contents.err) };
4330 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4331 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4332 let contents = if o.result_ok {
4333 let result = unsafe { o.contents.result };
4334 unsafe { o.contents.result = core::ptr::null_mut() };
4335 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4337 let err = unsafe { o.contents.err };
4338 unsafe { o.contents.err = core::ptr::null_mut(); }
4339 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4343 result_ok: o.result_ok,
4347 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4348 fn clone(&self) -> Self {
4350 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4351 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4354 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4355 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4361 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4362 /// but with all dynamically-allocated buffers duplicated in new buffers.
4363 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4365 /// A tuple of 2 elements. See the individual fields for the types contained.
4366 pub struct C2Tuple_u64u64Z {
4367 /// The element at position 0
4369 /// The element at position 1
4372 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4373 fn from (tup: (u64, u64)) -> Self {
4380 impl C2Tuple_u64u64Z {
4381 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4385 impl Clone for C2Tuple_u64u64Z {
4386 fn clone(&self) -> Self {
4388 a: Clone::clone(&self.a),
4389 b: Clone::clone(&self.b),
4394 /// Creates a new tuple which has the same data as `orig`
4395 /// but with all dynamically-allocated buffers duplicated in new buffers.
4396 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4397 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4399 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4400 C2Tuple_u64u64Z { a, b, }
4404 /// Frees any resources used by the C2Tuple_u64u64Z.
4405 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4408 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4409 pub enum COption_C2Tuple_u64u64ZZ {
4410 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4411 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4412 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4415 impl COption_C2Tuple_u64u64ZZ {
4416 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4417 if let Self::None = self { false } else { true }
4419 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4422 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4423 if let Self::Some(v) = self { v } else { unreachable!() }
4427 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4428 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4429 COption_C2Tuple_u64u64ZZ::Some(o)
4432 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4433 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4434 COption_C2Tuple_u64u64ZZ::None
4437 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4438 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4440 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4441 /// but with all dynamically-allocated buffers duplicated in new buffers.
4442 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4444 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4445 /// This corresponds to std::vector in C++
4446 pub struct CVec_NodeIdZ {
4447 /// The elements in the array.
4448 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4449 pub data: *mut crate::lightning::routing::gossip::NodeId,
4450 /// The number of elements pointed to by `data`.
4454 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4455 if self.datalen == 0 { return Vec::new(); }
4456 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4457 self.data = core::ptr::null_mut();
4461 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4462 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4465 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4466 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4467 let datalen = v.len();
4468 let data = Box::into_raw(v.into_boxed_slice());
4469 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4473 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4474 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4475 impl Drop for CVec_NodeIdZ {
4476 fn drop(&mut self) {
4477 if self.datalen == 0 { return; }
4478 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4481 impl Clone for CVec_NodeIdZ {
4482 fn clone(&self) -> Self {
4483 let mut res = Vec::new();
4484 if self.datalen == 0 { return Self::from(res); }
4485 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4490 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4491 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4492 /// A pointer to the contents in the success state.
4493 /// Reading from this pointer when `result_ok` is not set is undefined.
4494 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4495 /// A pointer to the contents in the error state.
4496 /// Reading from this pointer when `result_ok` is set is undefined.
4497 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4500 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4501 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4502 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4503 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4504 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4505 /// `err` or `result` depending on the state of `result_ok`.
4506 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4507 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4508 pub result_ok: bool,
4511 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4512 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4513 CResult_ProbabilisticScorerDecodeErrorZ {
4514 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4515 result: Box::into_raw(Box::new(o)),
4521 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4522 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4523 CResult_ProbabilisticScorerDecodeErrorZ {
4524 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4525 err: Box::into_raw(Box::new(e)),
4530 /// Checks if the given object is currently in the success state
4532 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4536 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4537 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4538 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4539 fn drop(&mut self) {
4541 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4542 let _ = unsafe { Box::from_raw(self.contents.result) };
4545 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4546 let _ = unsafe { Box::from_raw(self.contents.err) };
4551 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4552 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4553 let contents = if o.result_ok {
4554 let result = unsafe { o.contents.result };
4555 unsafe { o.contents.result = core::ptr::null_mut() };
4556 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4558 let err = unsafe { o.contents.err };
4559 unsafe { o.contents.err = core::ptr::null_mut(); }
4560 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4564 result_ok: o.result_ok,
4569 /// The contents of CResult_InitFeaturesDecodeErrorZ
4570 pub union CResult_InitFeaturesDecodeErrorZPtr {
4571 /// A pointer to the contents in the success state.
4572 /// Reading from this pointer when `result_ok` is not set is undefined.
4573 pub result: *mut crate::lightning::ln::features::InitFeatures,
4574 /// A pointer to the contents in the error state.
4575 /// Reading from this pointer when `result_ok` is set is undefined.
4576 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4579 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4580 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4582 pub struct CResult_InitFeaturesDecodeErrorZ {
4583 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4584 /// `err` or `result` depending on the state of `result_ok`.
4585 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4586 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4587 pub result_ok: bool,
4590 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4591 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4592 CResult_InitFeaturesDecodeErrorZ {
4593 contents: CResult_InitFeaturesDecodeErrorZPtr {
4594 result: Box::into_raw(Box::new(o)),
4600 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4601 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4602 CResult_InitFeaturesDecodeErrorZ {
4603 contents: CResult_InitFeaturesDecodeErrorZPtr {
4604 err: Box::into_raw(Box::new(e)),
4609 /// Checks if the given object is currently in the success state
4611 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4615 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4616 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4617 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4618 fn drop(&mut self) {
4620 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4621 let _ = unsafe { Box::from_raw(self.contents.result) };
4624 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4625 let _ = unsafe { Box::from_raw(self.contents.err) };
4630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4632 let contents = if o.result_ok {
4633 let result = unsafe { o.contents.result };
4634 unsafe { o.contents.result = core::ptr::null_mut() };
4635 CResult_InitFeaturesDecodeErrorZPtr { result }
4637 let err = unsafe { o.contents.err };
4638 unsafe { o.contents.err = core::ptr::null_mut(); }
4639 CResult_InitFeaturesDecodeErrorZPtr { err }
4643 result_ok: o.result_ok,
4647 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4648 fn clone(&self) -> Self {
4650 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4651 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4654 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4655 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4661 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4662 /// but with all dynamically-allocated buffers duplicated in new buffers.
4663 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4665 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4666 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4667 /// A pointer to the contents in the success state.
4668 /// Reading from this pointer when `result_ok` is not set is undefined.
4669 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4670 /// A pointer to the contents in the error state.
4671 /// Reading from this pointer when `result_ok` is set is undefined.
4672 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4675 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4676 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4678 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4679 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4680 /// `err` or `result` depending on the state of `result_ok`.
4681 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4682 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4683 pub result_ok: bool,
4686 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4687 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4688 CResult_ChannelFeaturesDecodeErrorZ {
4689 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4690 result: Box::into_raw(Box::new(o)),
4696 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4697 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4698 CResult_ChannelFeaturesDecodeErrorZ {
4699 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4700 err: Box::into_raw(Box::new(e)),
4705 /// Checks if the given object is currently in the success state
4707 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4711 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4712 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4713 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4714 fn drop(&mut self) {
4716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4717 let _ = unsafe { Box::from_raw(self.contents.result) };
4720 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4721 let _ = unsafe { Box::from_raw(self.contents.err) };
4726 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4727 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4728 let contents = if o.result_ok {
4729 let result = unsafe { o.contents.result };
4730 unsafe { o.contents.result = core::ptr::null_mut() };
4731 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4733 let err = unsafe { o.contents.err };
4734 unsafe { o.contents.err = core::ptr::null_mut(); }
4735 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4739 result_ok: o.result_ok,
4743 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4744 fn clone(&self) -> Self {
4746 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4747 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4750 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4751 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4757 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4758 /// but with all dynamically-allocated buffers duplicated in new buffers.
4759 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4761 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4762 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4763 /// A pointer to the contents in the success state.
4764 /// Reading from this pointer when `result_ok` is not set is undefined.
4765 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4766 /// A pointer to the contents in the error state.
4767 /// Reading from this pointer when `result_ok` is set is undefined.
4768 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4771 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4772 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4774 pub struct CResult_NodeFeaturesDecodeErrorZ {
4775 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4776 /// `err` or `result` depending on the state of `result_ok`.
4777 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4778 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4779 pub result_ok: bool,
4782 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4783 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4784 CResult_NodeFeaturesDecodeErrorZ {
4785 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4786 result: Box::into_raw(Box::new(o)),
4792 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4793 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4794 CResult_NodeFeaturesDecodeErrorZ {
4795 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4796 err: Box::into_raw(Box::new(e)),
4801 /// Checks if the given object is currently in the success state
4803 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4807 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4808 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4809 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4810 fn drop(&mut self) {
4812 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4813 let _ = unsafe { Box::from_raw(self.contents.result) };
4816 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4817 let _ = unsafe { Box::from_raw(self.contents.err) };
4822 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4823 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4824 let contents = if o.result_ok {
4825 let result = unsafe { o.contents.result };
4826 unsafe { o.contents.result = core::ptr::null_mut() };
4827 CResult_NodeFeaturesDecodeErrorZPtr { result }
4829 let err = unsafe { o.contents.err };
4830 unsafe { o.contents.err = core::ptr::null_mut(); }
4831 CResult_NodeFeaturesDecodeErrorZPtr { err }
4835 result_ok: o.result_ok,
4839 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4840 fn clone(&self) -> Self {
4842 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4843 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4846 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4847 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4853 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4854 /// but with all dynamically-allocated buffers duplicated in new buffers.
4855 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4857 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4858 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4859 /// A pointer to the contents in the success state.
4860 /// Reading from this pointer when `result_ok` is not set is undefined.
4861 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4862 /// A pointer to the contents in the error state.
4863 /// Reading from this pointer when `result_ok` is set is undefined.
4864 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4867 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4868 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4870 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4871 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4872 /// `err` or `result` depending on the state of `result_ok`.
4873 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4874 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4875 pub result_ok: bool,
4878 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4879 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4880 CResult_InvoiceFeaturesDecodeErrorZ {
4881 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4882 result: Box::into_raw(Box::new(o)),
4888 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4889 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4890 CResult_InvoiceFeaturesDecodeErrorZ {
4891 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4892 err: Box::into_raw(Box::new(e)),
4897 /// Checks if the given object is currently in the success state
4899 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4903 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4904 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4905 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4906 fn drop(&mut self) {
4908 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4909 let _ = unsafe { Box::from_raw(self.contents.result) };
4912 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4913 let _ = unsafe { Box::from_raw(self.contents.err) };
4918 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4919 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4920 let contents = if o.result_ok {
4921 let result = unsafe { o.contents.result };
4922 unsafe { o.contents.result = core::ptr::null_mut() };
4923 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4925 let err = unsafe { o.contents.err };
4926 unsafe { o.contents.err = core::ptr::null_mut(); }
4927 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4931 result_ok: o.result_ok,
4935 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4936 fn clone(&self) -> Self {
4938 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4939 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4942 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4943 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4949 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4950 /// but with all dynamically-allocated buffers duplicated in new buffers.
4951 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4953 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4954 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4955 /// A pointer to the contents in the success state.
4956 /// Reading from this pointer when `result_ok` is not set is undefined.
4957 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4958 /// A pointer to the contents in the error state.
4959 /// Reading from this pointer when `result_ok` is set is undefined.
4960 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4963 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4964 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4966 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4967 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4968 /// `err` or `result` depending on the state of `result_ok`.
4969 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4970 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4971 pub result_ok: bool,
4974 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4975 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4976 CResult_ChannelTypeFeaturesDecodeErrorZ {
4977 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4978 result: Box::into_raw(Box::new(o)),
4984 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4985 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4986 CResult_ChannelTypeFeaturesDecodeErrorZ {
4987 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4988 err: Box::into_raw(Box::new(e)),
4993 /// Checks if the given object is currently in the success state
4995 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4999 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
5000 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
5001 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
5002 fn drop(&mut self) {
5004 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5005 let _ = unsafe { Box::from_raw(self.contents.result) };
5008 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5009 let _ = unsafe { Box::from_raw(self.contents.err) };
5014 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
5015 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5016 let contents = if o.result_ok {
5017 let result = unsafe { o.contents.result };
5018 unsafe { o.contents.result = core::ptr::null_mut() };
5019 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
5021 let err = unsafe { o.contents.err };
5022 unsafe { o.contents.err = core::ptr::null_mut(); }
5023 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
5027 result_ok: o.result_ok,
5031 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
5032 fn clone(&self) -> Self {
5034 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5035 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
5038 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5039 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5045 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
5046 /// but with all dynamically-allocated buffers duplicated in new buffers.
5047 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5049 /// The contents of CResult_NodeIdDecodeErrorZ
5050 pub union CResult_NodeIdDecodeErrorZPtr {
5051 /// A pointer to the contents in the success state.
5052 /// Reading from this pointer when `result_ok` is not set is undefined.
5053 pub result: *mut crate::lightning::routing::gossip::NodeId,
5054 /// A pointer to the contents in the error state.
5055 /// Reading from this pointer when `result_ok` is set is undefined.
5056 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5059 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5060 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5061 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5062 pub struct CResult_NodeIdDecodeErrorZ {
5063 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5064 /// `err` or `result` depending on the state of `result_ok`.
5065 pub contents: CResult_NodeIdDecodeErrorZPtr,
5066 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5067 pub result_ok: bool,
5070 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5071 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5072 CResult_NodeIdDecodeErrorZ {
5073 contents: CResult_NodeIdDecodeErrorZPtr {
5074 result: Box::into_raw(Box::new(o)),
5080 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5081 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5082 CResult_NodeIdDecodeErrorZ {
5083 contents: CResult_NodeIdDecodeErrorZPtr {
5084 err: Box::into_raw(Box::new(e)),
5089 /// Checks if the given object is currently in the success state
5091 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5095 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5096 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5097 impl Drop for CResult_NodeIdDecodeErrorZ {
5098 fn drop(&mut self) {
5100 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5101 let _ = unsafe { Box::from_raw(self.contents.result) };
5104 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5105 let _ = unsafe { Box::from_raw(self.contents.err) };
5110 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5111 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5112 let contents = if o.result_ok {
5113 let result = unsafe { o.contents.result };
5114 unsafe { o.contents.result = core::ptr::null_mut() };
5115 CResult_NodeIdDecodeErrorZPtr { result }
5117 let err = unsafe { o.contents.err };
5118 unsafe { o.contents.err = core::ptr::null_mut(); }
5119 CResult_NodeIdDecodeErrorZPtr { err }
5123 result_ok: o.result_ok,
5127 impl Clone for CResult_NodeIdDecodeErrorZ {
5128 fn clone(&self) -> Self {
5130 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5131 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5134 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5135 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5141 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5142 /// but with all dynamically-allocated buffers duplicated in new buffers.
5143 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5145 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5146 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5147 /// A pointer to the contents in the success state.
5148 /// Reading from this pointer when `result_ok` is not set is undefined.
5149 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
5150 /// A pointer to the contents in the error state.
5151 /// Reading from this pointer when `result_ok` is set is undefined.
5152 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5155 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5156 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5158 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
5159 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5160 /// `err` or `result` depending on the state of `result_ok`.
5161 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
5162 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5163 pub result_ok: bool,
5166 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
5167 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5168 CResult_COption_NetworkUpdateZDecodeErrorZ {
5169 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5170 result: Box::into_raw(Box::new(o)),
5176 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
5177 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5178 CResult_COption_NetworkUpdateZDecodeErrorZ {
5179 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5180 err: Box::into_raw(Box::new(e)),
5185 /// Checks if the given object is currently in the success state
5187 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
5191 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
5192 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
5193 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
5194 fn drop(&mut self) {
5196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5197 let _ = unsafe { Box::from_raw(self.contents.result) };
5200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5201 let _ = unsafe { Box::from_raw(self.contents.err) };
5206 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
5207 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5208 let contents = if o.result_ok {
5209 let result = unsafe { o.contents.result };
5210 unsafe { o.contents.result = core::ptr::null_mut() };
5211 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
5213 let err = unsafe { o.contents.err };
5214 unsafe { o.contents.err = core::ptr::null_mut(); }
5215 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
5219 result_ok: o.result_ok,
5223 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
5224 fn clone(&self) -> Self {
5226 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5227 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5230 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5231 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5237 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5238 /// but with all dynamically-allocated buffers duplicated in new buffers.
5239 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5241 /// An enum which can either contain a crate::lightning::chain::Access or not
5242 pub enum COption_AccessZ {
5243 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5244 Some(crate::lightning::chain::Access),
5245 /// When we're in this state, this COption_AccessZ contains nothing
5248 impl COption_AccessZ {
5249 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5250 if let Self::None = self { false } else { true }
5252 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5255 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
5256 if let Self::Some(v) = self { v } else { unreachable!() }
5260 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
5261 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
5262 COption_AccessZ::Some(o)
5265 /// Constructs a new COption_AccessZ containing nothing
5266 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
5267 COption_AccessZ::None
5270 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
5271 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
5273 /// The contents of CResult_boolLightningErrorZ
5274 pub union CResult_boolLightningErrorZPtr {
5275 /// A pointer to the contents in the success state.
5276 /// Reading from this pointer when `result_ok` is not set is undefined.
5277 pub result: *mut bool,
5278 /// A pointer to the contents in the error state.
5279 /// Reading from this pointer when `result_ok` is set is undefined.
5280 pub err: *mut crate::lightning::ln::msgs::LightningError,
5283 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5284 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5286 pub struct CResult_boolLightningErrorZ {
5287 /// The contents of this CResult_boolLightningErrorZ, accessible via either
5288 /// `err` or `result` depending on the state of `result_ok`.
5289 pub contents: CResult_boolLightningErrorZPtr,
5290 /// Whether this CResult_boolLightningErrorZ represents a success state.
5291 pub result_ok: bool,
5294 /// Creates a new CResult_boolLightningErrorZ in the success state.
5295 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5296 CResult_boolLightningErrorZ {
5297 contents: CResult_boolLightningErrorZPtr {
5298 result: Box::into_raw(Box::new(o)),
5304 /// Creates a new CResult_boolLightningErrorZ in the error state.
5305 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5306 CResult_boolLightningErrorZ {
5307 contents: CResult_boolLightningErrorZPtr {
5308 err: Box::into_raw(Box::new(e)),
5313 /// Checks if the given object is currently in the success state
5315 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5319 /// Frees any resources used by the CResult_boolLightningErrorZ.
5320 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5321 impl Drop for CResult_boolLightningErrorZ {
5322 fn drop(&mut self) {
5324 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5325 let _ = unsafe { Box::from_raw(self.contents.result) };
5328 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5329 let _ = unsafe { Box::from_raw(self.contents.err) };
5334 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5335 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5336 let contents = if o.result_ok {
5337 let result = unsafe { o.contents.result };
5338 unsafe { o.contents.result = core::ptr::null_mut() };
5339 CResult_boolLightningErrorZPtr { result }
5341 let err = unsafe { o.contents.err };
5342 unsafe { o.contents.err = core::ptr::null_mut(); }
5343 CResult_boolLightningErrorZPtr { err }
5347 result_ok: o.result_ok,
5351 impl Clone for CResult_boolLightningErrorZ {
5352 fn clone(&self) -> Self {
5354 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5355 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5358 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5359 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5365 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5366 /// but with all dynamically-allocated buffers duplicated in new buffers.
5367 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5369 /// A tuple of 3 elements. See the individual fields for the types contained.
5370 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5371 /// The element at position 0
5372 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5373 /// The element at position 1
5374 pub b: crate::lightning::ln::msgs::ChannelUpdate,
5375 /// The element at position 2
5376 pub c: crate::lightning::ln::msgs::ChannelUpdate,
5378 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5379 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5387 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5388 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5389 (self.a, self.b, self.c)
5392 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5393 fn clone(&self) -> Self {
5395 a: Clone::clone(&self.a),
5396 b: Clone::clone(&self.b),
5397 c: Clone::clone(&self.c),
5402 /// Creates a new tuple which has the same data as `orig`
5403 /// but with all dynamically-allocated buffers duplicated in new buffers.
5404 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5405 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5407 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 {
5408 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5412 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5413 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5416 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5417 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5418 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5419 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
5420 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5423 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5424 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5425 if let Self::None = self { false } else { true }
5427 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5430 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5431 if let Self::Some(v) = self { v } else { unreachable!() }
5435 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5436 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5437 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
5440 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
5441 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5442 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
5445 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
5446 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5448 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
5449 /// but with all dynamically-allocated buffers duplicated in new buffers.
5450 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
5452 /// The contents of CResult_NoneLightningErrorZ
5453 pub union CResult_NoneLightningErrorZPtr {
5454 /// Note that this value is always NULL, as there are no contents in the OK variant
5455 pub result: *mut core::ffi::c_void,
5456 /// A pointer to the contents in the error state.
5457 /// Reading from this pointer when `result_ok` is set is undefined.
5458 pub err: *mut crate::lightning::ln::msgs::LightningError,
5461 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5462 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5463 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5464 pub struct CResult_NoneLightningErrorZ {
5465 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5466 /// `err` or `result` depending on the state of `result_ok`.
5467 pub contents: CResult_NoneLightningErrorZPtr,
5468 /// Whether this CResult_NoneLightningErrorZ represents a success state.
5469 pub result_ok: bool,
5472 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5473 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5474 CResult_NoneLightningErrorZ {
5475 contents: CResult_NoneLightningErrorZPtr {
5476 result: core::ptr::null_mut(),
5482 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5483 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5484 CResult_NoneLightningErrorZ {
5485 contents: CResult_NoneLightningErrorZPtr {
5486 err: Box::into_raw(Box::new(e)),
5491 /// Checks if the given object is currently in the success state
5493 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5497 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5498 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5499 impl Drop for CResult_NoneLightningErrorZ {
5500 fn drop(&mut self) {
5503 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5504 let _ = unsafe { Box::from_raw(self.contents.err) };
5509 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5510 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5511 let contents = if o.result_ok {
5512 let _ = unsafe { Box::from_raw(o.contents.result) };
5513 o.contents.result = core::ptr::null_mut();
5514 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5516 let err = unsafe { o.contents.err };
5517 unsafe { o.contents.err = core::ptr::null_mut(); }
5518 CResult_NoneLightningErrorZPtr { err }
5522 result_ok: o.result_ok,
5526 impl Clone for CResult_NoneLightningErrorZ {
5527 fn clone(&self) -> Self {
5529 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5530 result: core::ptr::null_mut()
5533 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5534 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5540 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5541 /// but with all dynamically-allocated buffers duplicated in new buffers.
5542 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5544 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5545 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5546 /// A pointer to the contents in the success state.
5547 /// Reading from this pointer when `result_ok` is not set is undefined.
5548 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5549 /// A pointer to the contents in the error state.
5550 /// Reading from this pointer when `result_ok` is set is undefined.
5551 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5554 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5555 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5557 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5558 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5559 /// `err` or `result` depending on the state of `result_ok`.
5560 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5561 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5562 pub result_ok: bool,
5565 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5566 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5567 CResult_ChannelUpdateInfoDecodeErrorZ {
5568 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5569 result: Box::into_raw(Box::new(o)),
5575 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5576 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5577 CResult_ChannelUpdateInfoDecodeErrorZ {
5578 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5579 err: Box::into_raw(Box::new(e)),
5584 /// Checks if the given object is currently in the success state
5586 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5590 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5591 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5592 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5593 fn drop(&mut self) {
5595 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5596 let _ = unsafe { Box::from_raw(self.contents.result) };
5599 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5600 let _ = unsafe { Box::from_raw(self.contents.err) };
5605 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5606 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5607 let contents = if o.result_ok {
5608 let result = unsafe { o.contents.result };
5609 unsafe { o.contents.result = core::ptr::null_mut() };
5610 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5612 let err = unsafe { o.contents.err };
5613 unsafe { o.contents.err = core::ptr::null_mut(); }
5614 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5618 result_ok: o.result_ok,
5622 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5623 fn clone(&self) -> Self {
5625 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5626 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5629 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5630 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5636 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5637 /// but with all dynamically-allocated buffers duplicated in new buffers.
5638 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5640 /// The contents of CResult_ChannelInfoDecodeErrorZ
5641 pub union CResult_ChannelInfoDecodeErrorZPtr {
5642 /// A pointer to the contents in the success state.
5643 /// Reading from this pointer when `result_ok` is not set is undefined.
5644 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5645 /// A pointer to the contents in the error state.
5646 /// Reading from this pointer when `result_ok` is set is undefined.
5647 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5650 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5651 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5653 pub struct CResult_ChannelInfoDecodeErrorZ {
5654 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5655 /// `err` or `result` depending on the state of `result_ok`.
5656 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5657 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5658 pub result_ok: bool,
5661 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5662 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5663 CResult_ChannelInfoDecodeErrorZ {
5664 contents: CResult_ChannelInfoDecodeErrorZPtr {
5665 result: Box::into_raw(Box::new(o)),
5671 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5672 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5673 CResult_ChannelInfoDecodeErrorZ {
5674 contents: CResult_ChannelInfoDecodeErrorZPtr {
5675 err: Box::into_raw(Box::new(e)),
5680 /// Checks if the given object is currently in the success state
5682 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5686 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5687 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5688 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5689 fn drop(&mut self) {
5691 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5692 let _ = unsafe { Box::from_raw(self.contents.result) };
5695 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5696 let _ = unsafe { Box::from_raw(self.contents.err) };
5701 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5702 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5703 let contents = if o.result_ok {
5704 let result = unsafe { o.contents.result };
5705 unsafe { o.contents.result = core::ptr::null_mut() };
5706 CResult_ChannelInfoDecodeErrorZPtr { result }
5708 let err = unsafe { o.contents.err };
5709 unsafe { o.contents.err = core::ptr::null_mut(); }
5710 CResult_ChannelInfoDecodeErrorZPtr { err }
5714 result_ok: o.result_ok,
5718 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5719 fn clone(&self) -> Self {
5721 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5722 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5725 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5726 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5732 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5733 /// but with all dynamically-allocated buffers duplicated in new buffers.
5734 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5736 /// The contents of CResult_RoutingFeesDecodeErrorZ
5737 pub union CResult_RoutingFeesDecodeErrorZPtr {
5738 /// A pointer to the contents in the success state.
5739 /// Reading from this pointer when `result_ok` is not set is undefined.
5740 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5741 /// A pointer to the contents in the error state.
5742 /// Reading from this pointer when `result_ok` is set is undefined.
5743 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5746 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5747 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5749 pub struct CResult_RoutingFeesDecodeErrorZ {
5750 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5751 /// `err` or `result` depending on the state of `result_ok`.
5752 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5753 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5754 pub result_ok: bool,
5757 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5758 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5759 CResult_RoutingFeesDecodeErrorZ {
5760 contents: CResult_RoutingFeesDecodeErrorZPtr {
5761 result: Box::into_raw(Box::new(o)),
5767 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5768 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5769 CResult_RoutingFeesDecodeErrorZ {
5770 contents: CResult_RoutingFeesDecodeErrorZPtr {
5771 err: Box::into_raw(Box::new(e)),
5776 /// Checks if the given object is currently in the success state
5778 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5782 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5783 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5784 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5785 fn drop(&mut self) {
5787 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5788 let _ = unsafe { Box::from_raw(self.contents.result) };
5791 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5792 let _ = unsafe { Box::from_raw(self.contents.err) };
5797 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5798 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5799 let contents = if o.result_ok {
5800 let result = unsafe { o.contents.result };
5801 unsafe { o.contents.result = core::ptr::null_mut() };
5802 CResult_RoutingFeesDecodeErrorZPtr { result }
5804 let err = unsafe { o.contents.err };
5805 unsafe { o.contents.err = core::ptr::null_mut(); }
5806 CResult_RoutingFeesDecodeErrorZPtr { err }
5810 result_ok: o.result_ok,
5814 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5815 fn clone(&self) -> Self {
5817 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5818 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5821 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5822 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5828 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5829 /// but with all dynamically-allocated buffers duplicated in new buffers.
5830 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5832 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5833 /// This corresponds to std::vector in C++
5834 pub struct CVec_NetAddressZ {
5835 /// The elements in the array.
5836 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5837 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5838 /// The number of elements pointed to by `data`.
5841 impl CVec_NetAddressZ {
5842 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5843 if self.datalen == 0 { return Vec::new(); }
5844 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5845 self.data = core::ptr::null_mut();
5849 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5850 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5853 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5854 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5855 let datalen = v.len();
5856 let data = Box::into_raw(v.into_boxed_slice());
5857 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5862 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5863 impl Drop for CVec_NetAddressZ {
5864 fn drop(&mut self) {
5865 if self.datalen == 0 { return; }
5866 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5869 impl Clone for CVec_NetAddressZ {
5870 fn clone(&self) -> Self {
5871 let mut res = Vec::new();
5872 if self.datalen == 0 { return Self::from(res); }
5873 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5878 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5879 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5880 /// A pointer to the contents in the success state.
5881 /// Reading from this pointer when `result_ok` is not set is undefined.
5882 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5883 /// A pointer to the contents in the error state.
5884 /// Reading from this pointer when `result_ok` is set is undefined.
5885 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5888 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5889 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5891 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5892 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5893 /// `err` or `result` depending on the state of `result_ok`.
5894 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5895 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5896 pub result_ok: bool,
5899 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5900 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5901 CResult_NodeAnnouncementInfoDecodeErrorZ {
5902 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5903 result: Box::into_raw(Box::new(o)),
5909 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5910 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5911 CResult_NodeAnnouncementInfoDecodeErrorZ {
5912 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5913 err: Box::into_raw(Box::new(e)),
5918 /// Checks if the given object is currently in the success state
5920 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5924 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5925 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5926 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5927 fn drop(&mut self) {
5929 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5930 let _ = unsafe { Box::from_raw(self.contents.result) };
5933 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5934 let _ = unsafe { Box::from_raw(self.contents.err) };
5939 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5940 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5941 let contents = if o.result_ok {
5942 let result = unsafe { o.contents.result };
5943 unsafe { o.contents.result = core::ptr::null_mut() };
5944 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5946 let err = unsafe { o.contents.err };
5947 unsafe { o.contents.err = core::ptr::null_mut(); }
5948 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5952 result_ok: o.result_ok,
5956 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5957 fn clone(&self) -> Self {
5959 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5960 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5963 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5964 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5970 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5971 /// but with all dynamically-allocated buffers duplicated in new buffers.
5972 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5974 /// The contents of CResult_NodeAliasDecodeErrorZ
5975 pub union CResult_NodeAliasDecodeErrorZPtr {
5976 /// A pointer to the contents in the success state.
5977 /// Reading from this pointer when `result_ok` is not set is undefined.
5978 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
5979 /// A pointer to the contents in the error state.
5980 /// Reading from this pointer when `result_ok` is set is undefined.
5981 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5984 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5985 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5986 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5987 pub struct CResult_NodeAliasDecodeErrorZ {
5988 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5989 /// `err` or `result` depending on the state of `result_ok`.
5990 pub contents: CResult_NodeAliasDecodeErrorZPtr,
5991 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5992 pub result_ok: bool,
5995 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
5996 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
5997 CResult_NodeAliasDecodeErrorZ {
5998 contents: CResult_NodeAliasDecodeErrorZPtr {
5999 result: Box::into_raw(Box::new(o)),
6005 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6006 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6007 CResult_NodeAliasDecodeErrorZ {
6008 contents: CResult_NodeAliasDecodeErrorZPtr {
6009 err: Box::into_raw(Box::new(e)),
6014 /// Checks if the given object is currently in the success state
6016 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6020 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6021 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6022 impl Drop for CResult_NodeAliasDecodeErrorZ {
6023 fn drop(&mut self) {
6025 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6026 let _ = unsafe { Box::from_raw(self.contents.result) };
6029 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6030 let _ = unsafe { Box::from_raw(self.contents.err) };
6035 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6036 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6037 let contents = if o.result_ok {
6038 let result = unsafe { o.contents.result };
6039 unsafe { o.contents.result = core::ptr::null_mut() };
6040 CResult_NodeAliasDecodeErrorZPtr { result }
6042 let err = unsafe { o.contents.err };
6043 unsafe { o.contents.err = core::ptr::null_mut(); }
6044 CResult_NodeAliasDecodeErrorZPtr { err }
6048 result_ok: o.result_ok,
6052 impl Clone for CResult_NodeAliasDecodeErrorZ {
6053 fn clone(&self) -> Self {
6055 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6056 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6059 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6060 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6066 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6067 /// but with all dynamically-allocated buffers duplicated in new buffers.
6068 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6070 /// The contents of CResult_NodeInfoDecodeErrorZ
6071 pub union CResult_NodeInfoDecodeErrorZPtr {
6072 /// A pointer to the contents in the success state.
6073 /// Reading from this pointer when `result_ok` is not set is undefined.
6074 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6075 /// A pointer to the contents in the error state.
6076 /// Reading from this pointer when `result_ok` is set is undefined.
6077 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6080 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6081 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6083 pub struct CResult_NodeInfoDecodeErrorZ {
6084 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6085 /// `err` or `result` depending on the state of `result_ok`.
6086 pub contents: CResult_NodeInfoDecodeErrorZPtr,
6087 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6088 pub result_ok: bool,
6091 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6092 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6093 CResult_NodeInfoDecodeErrorZ {
6094 contents: CResult_NodeInfoDecodeErrorZPtr {
6095 result: Box::into_raw(Box::new(o)),
6101 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6102 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6103 CResult_NodeInfoDecodeErrorZ {
6104 contents: CResult_NodeInfoDecodeErrorZPtr {
6105 err: Box::into_raw(Box::new(e)),
6110 /// Checks if the given object is currently in the success state
6112 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
6116 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
6117 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
6118 impl Drop for CResult_NodeInfoDecodeErrorZ {
6119 fn drop(&mut self) {
6121 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6122 let _ = unsafe { Box::from_raw(self.contents.result) };
6125 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6126 let _ = unsafe { Box::from_raw(self.contents.err) };
6131 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
6132 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6133 let contents = if o.result_ok {
6134 let result = unsafe { o.contents.result };
6135 unsafe { o.contents.result = core::ptr::null_mut() };
6136 CResult_NodeInfoDecodeErrorZPtr { result }
6138 let err = unsafe { o.contents.err };
6139 unsafe { o.contents.err = core::ptr::null_mut(); }
6140 CResult_NodeInfoDecodeErrorZPtr { err }
6144 result_ok: o.result_ok,
6148 impl Clone for CResult_NodeInfoDecodeErrorZ {
6149 fn clone(&self) -> Self {
6151 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
6152 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
6155 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
6156 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6162 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
6163 /// but with all dynamically-allocated buffers duplicated in new buffers.
6164 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
6166 /// The contents of CResult_NetworkGraphDecodeErrorZ
6167 pub union CResult_NetworkGraphDecodeErrorZPtr {
6168 /// A pointer to the contents in the success state.
6169 /// Reading from this pointer when `result_ok` is not set is undefined.
6170 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
6171 /// A pointer to the contents in the error state.
6172 /// Reading from this pointer when `result_ok` is set is undefined.
6173 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6176 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6177 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6179 pub struct CResult_NetworkGraphDecodeErrorZ {
6180 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6181 /// `err` or `result` depending on the state of `result_ok`.
6182 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6183 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6184 pub result_ok: bool,
6187 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6188 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6189 CResult_NetworkGraphDecodeErrorZ {
6190 contents: CResult_NetworkGraphDecodeErrorZPtr {
6191 result: Box::into_raw(Box::new(o)),
6197 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6198 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6199 CResult_NetworkGraphDecodeErrorZ {
6200 contents: CResult_NetworkGraphDecodeErrorZPtr {
6201 err: Box::into_raw(Box::new(e)),
6206 /// Checks if the given object is currently in the success state
6208 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6212 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6213 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6214 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6215 fn drop(&mut self) {
6217 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6218 let _ = unsafe { Box::from_raw(self.contents.result) };
6221 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6222 let _ = unsafe { Box::from_raw(self.contents.err) };
6227 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6228 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6229 let contents = if o.result_ok {
6230 let result = unsafe { o.contents.result };
6231 unsafe { o.contents.result = core::ptr::null_mut() };
6232 CResult_NetworkGraphDecodeErrorZPtr { result }
6234 let err = unsafe { o.contents.err };
6235 unsafe { o.contents.err = core::ptr::null_mut(); }
6236 CResult_NetworkGraphDecodeErrorZPtr { err }
6240 result_ok: o.result_ok,
6246 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6247 pub enum COption_CVec_NetAddressZZ {
6248 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6249 Some(crate::c_types::derived::CVec_NetAddressZ),
6250 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6253 impl COption_CVec_NetAddressZZ {
6254 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6255 if let Self::None = self { false } else { true }
6257 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6260 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6261 if let Self::Some(v) = self { v } else { unreachable!() }
6265 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6266 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6267 COption_CVec_NetAddressZZ::Some(o)
6270 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6271 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6272 COption_CVec_NetAddressZZ::None
6275 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6276 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6278 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6279 /// but with all dynamically-allocated buffers duplicated in new buffers.
6280 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6282 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6283 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6284 /// A pointer to the contents in the success state.
6285 /// Reading from this pointer when `result_ok` is not set is undefined.
6286 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6287 /// A pointer to the contents in the error state.
6288 /// Reading from this pointer when `result_ok` is set is undefined.
6289 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6292 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6293 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6295 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6296 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6297 /// `err` or `result` depending on the state of `result_ok`.
6298 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6299 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6300 pub result_ok: bool,
6303 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6304 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6305 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6306 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6307 result: Box::into_raw(Box::new(o)),
6313 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6314 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6315 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6316 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6317 err: Box::into_raw(Box::new(e)),
6322 /// Checks if the given object is currently in the success state
6324 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6328 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6329 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6330 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6331 fn drop(&mut self) {
6333 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6334 let _ = unsafe { Box::from_raw(self.contents.result) };
6337 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6338 let _ = unsafe { Box::from_raw(self.contents.err) };
6343 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6344 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6345 let contents = if o.result_ok {
6346 let result = unsafe { o.contents.result };
6347 unsafe { o.contents.result = core::ptr::null_mut() };
6348 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6350 let err = unsafe { o.contents.err };
6351 unsafe { o.contents.err = core::ptr::null_mut(); }
6352 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6356 result_ok: o.result_ok,
6360 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6361 fn clone(&self) -> Self {
6363 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6364 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6367 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6368 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6374 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6375 /// but with all dynamically-allocated buffers duplicated in new buffers.
6376 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6378 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6379 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6380 /// A pointer to the contents in the success state.
6381 /// Reading from this pointer when `result_ok` is not set is undefined.
6382 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6383 /// A pointer to the contents in the error state.
6384 /// Reading from this pointer when `result_ok` is set is undefined.
6385 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6388 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6389 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6391 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6392 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6393 /// `err` or `result` depending on the state of `result_ok`.
6394 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6395 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6396 pub result_ok: bool,
6399 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6400 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6401 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6402 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6403 result: Box::into_raw(Box::new(o)),
6409 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6410 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6411 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6412 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6413 err: Box::into_raw(Box::new(e)),
6418 /// Checks if the given object is currently in the success state
6420 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6424 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6425 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6426 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6427 fn drop(&mut self) {
6429 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6430 let _ = unsafe { Box::from_raw(self.contents.result) };
6433 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6434 let _ = unsafe { Box::from_raw(self.contents.err) };
6439 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6440 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6441 let contents = if o.result_ok {
6442 let result = unsafe { o.contents.result };
6443 unsafe { o.contents.result = core::ptr::null_mut() };
6444 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6446 let err = unsafe { o.contents.err };
6447 unsafe { o.contents.err = core::ptr::null_mut(); }
6448 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6452 result_ok: o.result_ok,
6456 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6457 fn clone(&self) -> Self {
6459 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6460 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6463 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6464 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6470 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6471 /// but with all dynamically-allocated buffers duplicated in new buffers.
6472 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6474 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6475 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6476 /// A pointer to the contents in the success state.
6477 /// Reading from this pointer when `result_ok` is not set is undefined.
6478 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6479 /// A pointer to the contents in the error state.
6480 /// Reading from this pointer when `result_ok` is set is undefined.
6481 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6484 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6485 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6487 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6488 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6489 /// `err` or `result` depending on the state of `result_ok`.
6490 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6491 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6492 pub result_ok: bool,
6495 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6496 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6497 CResult_SpendableOutputDescriptorDecodeErrorZ {
6498 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6499 result: Box::into_raw(Box::new(o)),
6505 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6506 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6507 CResult_SpendableOutputDescriptorDecodeErrorZ {
6508 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6509 err: Box::into_raw(Box::new(e)),
6514 /// Checks if the given object is currently in the success state
6516 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6520 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6521 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6522 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6523 fn drop(&mut self) {
6525 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6526 let _ = unsafe { Box::from_raw(self.contents.result) };
6529 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6530 let _ = unsafe { Box::from_raw(self.contents.err) };
6535 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6536 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6537 let contents = if o.result_ok {
6538 let result = unsafe { o.contents.result };
6539 unsafe { o.contents.result = core::ptr::null_mut() };
6540 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6542 let err = unsafe { o.contents.err };
6543 unsafe { o.contents.err = core::ptr::null_mut(); }
6544 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6548 result_ok: o.result_ok,
6552 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6553 fn clone(&self) -> Self {
6555 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6556 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6559 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6560 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6566 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6567 /// but with all dynamically-allocated buffers duplicated in new buffers.
6568 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6570 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6571 /// This corresponds to std::vector in C++
6572 pub struct CVec_PaymentPreimageZ {
6573 /// The elements in the array.
6574 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6575 pub data: *mut crate::c_types::ThirtyTwoBytes,
6576 /// The number of elements pointed to by `data`.
6579 impl CVec_PaymentPreimageZ {
6580 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6581 if self.datalen == 0 { return Vec::new(); }
6582 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6583 self.data = core::ptr::null_mut();
6587 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6588 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6591 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6592 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6593 let datalen = v.len();
6594 let data = Box::into_raw(v.into_boxed_slice());
6595 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6599 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6600 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6601 impl Drop for CVec_PaymentPreimageZ {
6602 fn drop(&mut self) {
6603 if self.datalen == 0 { return; }
6604 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6607 impl Clone for CVec_PaymentPreimageZ {
6608 fn clone(&self) -> Self {
6609 let mut res = Vec::new();
6610 if self.datalen == 0 { return Self::from(res); }
6611 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6616 /// A tuple of 2 elements. See the individual fields for the types contained.
6617 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6618 /// The element at position 0
6619 pub a: crate::c_types::Signature,
6620 /// The element at position 1
6621 pub b: crate::c_types::derived::CVec_SignatureZ,
6623 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6624 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6631 impl C2Tuple_SignatureCVec_SignatureZZ {
6632 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6636 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6637 fn clone(&self) -> Self {
6639 a: Clone::clone(&self.a),
6640 b: Clone::clone(&self.b),
6645 /// Creates a new tuple which has the same data as `orig`
6646 /// but with all dynamically-allocated buffers duplicated in new buffers.
6647 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6648 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6650 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6651 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6655 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6656 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6658 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6659 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
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::derived::C2Tuple_SignatureCVec_SignatureZZ,
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_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6668 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6670 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6671 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6672 /// `err` or `result` depending on the state of `result_ok`.
6673 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6674 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6675 pub result_ok: bool,
6678 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6679 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6680 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6681 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6682 result: Box::into_raw(Box::new(o)),
6688 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6689 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6690 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6691 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6692 err: core::ptr::null_mut(),
6697 /// Checks if the given object is currently in the success state
6699 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6703 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6704 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6705 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
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::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6716 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> 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_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6722 let _ = unsafe { Box::from_raw(o.contents.err) };
6723 o.contents.err = core::ptr::null_mut();
6724 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6728 result_ok: o.result_ok,
6732 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6733 fn clone(&self) -> Self {
6735 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6736 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6739 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6740 err: core::ptr::null_mut()
6746 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6747 /// but with all dynamically-allocated buffers duplicated in new buffers.
6748 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6750 /// The contents of CResult_SignatureNoneZ
6751 pub union CResult_SignatureNoneZPtr {
6752 /// A pointer to the contents in the success state.
6753 /// Reading from this pointer when `result_ok` is not set is undefined.
6754 pub result: *mut crate::c_types::Signature,
6755 /// Note that this value is always NULL, as there are no contents in the Err variant
6756 pub err: *mut core::ffi::c_void,
6759 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6760 /// containing a crate::c_types::Signature on success and a () on failure.
6761 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6762 pub struct CResult_SignatureNoneZ {
6763 /// The contents of this CResult_SignatureNoneZ, accessible via either
6764 /// `err` or `result` depending on the state of `result_ok`.
6765 pub contents: CResult_SignatureNoneZPtr,
6766 /// Whether this CResult_SignatureNoneZ represents a success state.
6767 pub result_ok: bool,
6770 /// Creates a new CResult_SignatureNoneZ in the success state.
6771 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6772 CResult_SignatureNoneZ {
6773 contents: CResult_SignatureNoneZPtr {
6774 result: Box::into_raw(Box::new(o)),
6780 /// Creates a new CResult_SignatureNoneZ in the error state.
6781 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6782 CResult_SignatureNoneZ {
6783 contents: CResult_SignatureNoneZPtr {
6784 err: core::ptr::null_mut(),
6789 /// Checks if the given object is currently in the success state
6791 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6795 /// Frees any resources used by the CResult_SignatureNoneZ.
6796 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6797 impl Drop for CResult_SignatureNoneZ {
6798 fn drop(&mut self) {
6800 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6801 let _ = unsafe { Box::from_raw(self.contents.result) };
6807 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6808 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6809 let contents = if o.result_ok {
6810 let result = unsafe { o.contents.result };
6811 unsafe { o.contents.result = core::ptr::null_mut() };
6812 CResult_SignatureNoneZPtr { result }
6814 let _ = unsafe { Box::from_raw(o.contents.err) };
6815 o.contents.err = core::ptr::null_mut();
6816 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6820 result_ok: o.result_ok,
6824 impl Clone for CResult_SignatureNoneZ {
6825 fn clone(&self) -> Self {
6827 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6828 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6831 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6832 err: core::ptr::null_mut()
6838 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6839 /// but with all dynamically-allocated buffers duplicated in new buffers.
6840 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6842 /// A tuple of 2 elements. See the individual fields for the types contained.
6843 pub struct C2Tuple_SignatureSignatureZ {
6844 /// The element at position 0
6845 pub a: crate::c_types::Signature,
6846 /// The element at position 1
6847 pub b: crate::c_types::Signature,
6849 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6850 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6857 impl C2Tuple_SignatureSignatureZ {
6858 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6862 impl Clone for C2Tuple_SignatureSignatureZ {
6863 fn clone(&self) -> Self {
6865 a: Clone::clone(&self.a),
6866 b: Clone::clone(&self.b),
6871 /// Creates a new tuple which has the same data as `orig`
6872 /// but with all dynamically-allocated buffers duplicated in new buffers.
6873 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6874 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6876 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6877 C2Tuple_SignatureSignatureZ { a, b, }
6881 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6882 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6884 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6885 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
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::derived::C2Tuple_SignatureSignatureZ,
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_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6894 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6896 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6897 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6898 /// `err` or `result` depending on the state of `result_ok`.
6899 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6900 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6901 pub result_ok: bool,
6904 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6905 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6906 CResult_C2Tuple_SignatureSignatureZNoneZ {
6907 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6908 result: Box::into_raw(Box::new(o)),
6914 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6915 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6916 CResult_C2Tuple_SignatureSignatureZNoneZ {
6917 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6918 err: core::ptr::null_mut(),
6923 /// Checks if the given object is currently in the success state
6925 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6929 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6930 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6931 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
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::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6942 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> 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_C2Tuple_SignatureSignatureZNoneZPtr { result }
6948 let _ = unsafe { Box::from_raw(o.contents.err) };
6949 o.contents.err = core::ptr::null_mut();
6950 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6954 result_ok: o.result_ok,
6958 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6959 fn clone(&self) -> Self {
6961 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6962 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6965 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6966 err: core::ptr::null_mut()
6972 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6973 /// but with all dynamically-allocated buffers duplicated in new buffers.
6974 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6976 /// The contents of CResult_SecretKeyNoneZ
6977 pub union CResult_SecretKeyNoneZPtr {
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::SecretKey,
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_SecretKeyNoneZ represents the result of a fallible operation,
6986 /// containing a crate::c_types::SecretKey on success and a () on failure.
6987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6988 pub struct CResult_SecretKeyNoneZ {
6989 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6990 /// `err` or `result` depending on the state of `result_ok`.
6991 pub contents: CResult_SecretKeyNoneZPtr,
6992 /// Whether this CResult_SecretKeyNoneZ represents a success state.
6993 pub result_ok: bool,
6996 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6997 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6998 CResult_SecretKeyNoneZ {
6999 contents: CResult_SecretKeyNoneZPtr {
7000 result: Box::into_raw(Box::new(o)),
7006 /// Creates a new CResult_SecretKeyNoneZ in the error state.
7007 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
7008 CResult_SecretKeyNoneZ {
7009 contents: CResult_SecretKeyNoneZPtr {
7010 err: core::ptr::null_mut(),
7015 /// Checks if the given object is currently in the success state
7017 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
7021 /// Frees any resources used by the CResult_SecretKeyNoneZ.
7022 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
7023 impl Drop for CResult_SecretKeyNoneZ {
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::SecretKey, ()>> for CResult_SecretKeyNoneZ {
7034 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> 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_SecretKeyNoneZPtr { result }
7040 let _ = unsafe { Box::from_raw(o.contents.err) };
7041 o.contents.err = core::ptr::null_mut();
7042 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
7046 result_ok: o.result_ok,
7050 impl Clone for CResult_SecretKeyNoneZ {
7051 fn clone(&self) -> Self {
7053 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
7054 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
7057 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
7058 err: core::ptr::null_mut()
7064 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
7065 /// but with all dynamically-allocated buffers duplicated in new buffers.
7066 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { 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)) };
12256 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
12257 pub enum COption_NetAddressZ {
12258 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
12259 Some(crate::lightning::ln::msgs::NetAddress),
12260 /// When we're in this state, this COption_NetAddressZ contains nothing
12263 impl COption_NetAddressZ {
12264 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12265 if let Self::None = self { false } else { true }
12267 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12270 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
12271 if let Self::Some(v) = self { v } else { unreachable!() }
12275 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
12276 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
12277 COption_NetAddressZ::Some(o)
12280 /// Constructs a new COption_NetAddressZ containing nothing
12281 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
12282 COption_NetAddressZ::None
12285 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
12286 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
12288 /// Creates a new COption_NetAddressZ which has the same data as `orig`
12289 /// but with all dynamically-allocated buffers duplicated in new buffers.
12290 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
12292 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12293 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12294 /// A pointer to the contents in the success state.
12295 /// Reading from this pointer when `result_ok` is not set is undefined.
12296 pub result: *mut crate::c_types::derived::CVec_u8Z,
12297 /// A pointer to the contents in the error state.
12298 /// Reading from this pointer when `result_ok` is set is undefined.
12299 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12302 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12303 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12305 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12306 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12307 /// `err` or `result` depending on the state of `result_ok`.
12308 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12309 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12310 pub result_ok: bool,
12313 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12314 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12315 CResult_CVec_u8ZPeerHandleErrorZ {
12316 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12317 result: Box::into_raw(Box::new(o)),
12323 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12324 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12325 CResult_CVec_u8ZPeerHandleErrorZ {
12326 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12327 err: Box::into_raw(Box::new(e)),
12332 /// Checks if the given object is currently in the success state
12334 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12338 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12339 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12340 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12341 fn drop(&mut self) {
12342 if self.result_ok {
12343 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12344 let _ = unsafe { Box::from_raw(self.contents.result) };
12347 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12348 let _ = unsafe { Box::from_raw(self.contents.err) };
12353 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12354 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12355 let contents = if o.result_ok {
12356 let result = unsafe { o.contents.result };
12357 unsafe { o.contents.result = core::ptr::null_mut() };
12358 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12360 let err = unsafe { o.contents.err };
12361 unsafe { o.contents.err = core::ptr::null_mut(); }
12362 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12366 result_ok: o.result_ok,
12370 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12371 fn clone(&self) -> Self {
12372 if self.result_ok {
12373 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12374 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12377 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12378 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12384 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12385 /// but with all dynamically-allocated buffers duplicated in new buffers.
12386 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12388 /// The contents of CResult_NonePeerHandleErrorZ
12389 pub union CResult_NonePeerHandleErrorZPtr {
12390 /// Note that this value is always NULL, as there are no contents in the OK variant
12391 pub result: *mut core::ffi::c_void,
12392 /// A pointer to the contents in the error state.
12393 /// Reading from this pointer when `result_ok` is set is undefined.
12394 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12397 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12398 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12400 pub struct CResult_NonePeerHandleErrorZ {
12401 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12402 /// `err` or `result` depending on the state of `result_ok`.
12403 pub contents: CResult_NonePeerHandleErrorZPtr,
12404 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12405 pub result_ok: bool,
12408 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12409 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12410 CResult_NonePeerHandleErrorZ {
12411 contents: CResult_NonePeerHandleErrorZPtr {
12412 result: core::ptr::null_mut(),
12418 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12419 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12420 CResult_NonePeerHandleErrorZ {
12421 contents: CResult_NonePeerHandleErrorZPtr {
12422 err: Box::into_raw(Box::new(e)),
12427 /// Checks if the given object is currently in the success state
12429 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12433 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12434 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12435 impl Drop for CResult_NonePeerHandleErrorZ {
12436 fn drop(&mut self) {
12437 if self.result_ok {
12439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12440 let _ = unsafe { Box::from_raw(self.contents.err) };
12445 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12446 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12447 let contents = if o.result_ok {
12448 let _ = unsafe { Box::from_raw(o.contents.result) };
12449 o.contents.result = core::ptr::null_mut();
12450 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12452 let err = unsafe { o.contents.err };
12453 unsafe { o.contents.err = core::ptr::null_mut(); }
12454 CResult_NonePeerHandleErrorZPtr { err }
12458 result_ok: o.result_ok,
12462 impl Clone for CResult_NonePeerHandleErrorZ {
12463 fn clone(&self) -> Self {
12464 if self.result_ok {
12465 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12466 result: core::ptr::null_mut()
12469 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12470 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12476 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12477 /// but with all dynamically-allocated buffers duplicated in new buffers.
12478 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12480 /// The contents of CResult_boolPeerHandleErrorZ
12481 pub union CResult_boolPeerHandleErrorZPtr {
12482 /// A pointer to the contents in the success state.
12483 /// Reading from this pointer when `result_ok` is not set is undefined.
12484 pub result: *mut bool,
12485 /// A pointer to the contents in the error state.
12486 /// Reading from this pointer when `result_ok` is set is undefined.
12487 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12490 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12491 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12492 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12493 pub struct CResult_boolPeerHandleErrorZ {
12494 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12495 /// `err` or `result` depending on the state of `result_ok`.
12496 pub contents: CResult_boolPeerHandleErrorZPtr,
12497 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12498 pub result_ok: bool,
12501 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12502 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12503 CResult_boolPeerHandleErrorZ {
12504 contents: CResult_boolPeerHandleErrorZPtr {
12505 result: Box::into_raw(Box::new(o)),
12511 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12512 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12513 CResult_boolPeerHandleErrorZ {
12514 contents: CResult_boolPeerHandleErrorZPtr {
12515 err: Box::into_raw(Box::new(e)),
12520 /// Checks if the given object is currently in the success state
12522 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12526 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12527 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12528 impl Drop for CResult_boolPeerHandleErrorZ {
12529 fn drop(&mut self) {
12530 if self.result_ok {
12531 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12532 let _ = unsafe { Box::from_raw(self.contents.result) };
12535 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12536 let _ = unsafe { Box::from_raw(self.contents.err) };
12541 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12542 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12543 let contents = if o.result_ok {
12544 let result = unsafe { o.contents.result };
12545 unsafe { o.contents.result = core::ptr::null_mut() };
12546 CResult_boolPeerHandleErrorZPtr { result }
12548 let err = unsafe { o.contents.err };
12549 unsafe { o.contents.err = core::ptr::null_mut(); }
12550 CResult_boolPeerHandleErrorZPtr { err }
12554 result_ok: o.result_ok,
12558 impl Clone for CResult_boolPeerHandleErrorZ {
12559 fn clone(&self) -> Self {
12560 if self.result_ok {
12561 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12562 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12565 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12566 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12572 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12573 /// but with all dynamically-allocated buffers duplicated in new buffers.
12574 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12576 /// The contents of CResult_NoneSendErrorZ
12577 pub union CResult_NoneSendErrorZPtr {
12578 /// Note that this value is always NULL, as there are no contents in the OK variant
12579 pub result: *mut core::ffi::c_void,
12580 /// A pointer to the contents in the error state.
12581 /// Reading from this pointer when `result_ok` is set is undefined.
12582 pub err: *mut crate::lightning::onion_message::messenger::SendError,
12585 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12586 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12587 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12588 pub struct CResult_NoneSendErrorZ {
12589 /// The contents of this CResult_NoneSendErrorZ, accessible via either
12590 /// `err` or `result` depending on the state of `result_ok`.
12591 pub contents: CResult_NoneSendErrorZPtr,
12592 /// Whether this CResult_NoneSendErrorZ represents a success state.
12593 pub result_ok: bool,
12596 /// Creates a new CResult_NoneSendErrorZ in the success state.
12597 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12598 CResult_NoneSendErrorZ {
12599 contents: CResult_NoneSendErrorZPtr {
12600 result: core::ptr::null_mut(),
12606 /// Creates a new CResult_NoneSendErrorZ in the error state.
12607 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12608 CResult_NoneSendErrorZ {
12609 contents: CResult_NoneSendErrorZPtr {
12610 err: Box::into_raw(Box::new(e)),
12615 /// Checks if the given object is currently in the success state
12617 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12621 /// Frees any resources used by the CResult_NoneSendErrorZ.
12622 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12623 impl Drop for CResult_NoneSendErrorZ {
12624 fn drop(&mut self) {
12625 if self.result_ok {
12627 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12628 let _ = unsafe { Box::from_raw(self.contents.err) };
12633 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12634 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12635 let contents = if o.result_ok {
12636 let _ = unsafe { Box::from_raw(o.contents.result) };
12637 o.contents.result = core::ptr::null_mut();
12638 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12640 let err = unsafe { o.contents.err };
12641 unsafe { o.contents.err = core::ptr::null_mut(); }
12642 CResult_NoneSendErrorZPtr { err }
12646 result_ok: o.result_ok,
12651 /// The contents of CResult_u32GraphSyncErrorZ
12652 pub union CResult_u32GraphSyncErrorZPtr {
12653 /// A pointer to the contents in the success state.
12654 /// Reading from this pointer when `result_ok` is not set is undefined.
12655 pub result: *mut u32,
12656 /// A pointer to the contents in the error state.
12657 /// Reading from this pointer when `result_ok` is set is undefined.
12658 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12661 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12662 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12663 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12664 pub struct CResult_u32GraphSyncErrorZ {
12665 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12666 /// `err` or `result` depending on the state of `result_ok`.
12667 pub contents: CResult_u32GraphSyncErrorZPtr,
12668 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12669 pub result_ok: bool,
12672 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12673 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12674 CResult_u32GraphSyncErrorZ {
12675 contents: CResult_u32GraphSyncErrorZPtr {
12676 result: Box::into_raw(Box::new(o)),
12682 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12683 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12684 CResult_u32GraphSyncErrorZ {
12685 contents: CResult_u32GraphSyncErrorZPtr {
12686 err: Box::into_raw(Box::new(e)),
12691 /// Checks if the given object is currently in the success state
12693 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12697 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12698 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12699 impl Drop for CResult_u32GraphSyncErrorZ {
12700 fn drop(&mut self) {
12701 if self.result_ok {
12702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12703 let _ = unsafe { Box::from_raw(self.contents.result) };
12706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12707 let _ = unsafe { Box::from_raw(self.contents.err) };
12712 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12713 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12714 let contents = if o.result_ok {
12715 let result = unsafe { o.contents.result };
12716 unsafe { o.contents.result = core::ptr::null_mut() };
12717 CResult_u32GraphSyncErrorZPtr { result }
12719 let err = unsafe { o.contents.err };
12720 unsafe { o.contents.err = core::ptr::null_mut(); }
12721 CResult_u32GraphSyncErrorZPtr { err }
12725 result_ok: o.result_ok,
12730 /// The contents of CResult_NetAddressDecodeErrorZ
12731 pub union CResult_NetAddressDecodeErrorZPtr {
12732 /// A pointer to the contents in the success state.
12733 /// Reading from this pointer when `result_ok` is not set is undefined.
12734 pub result: *mut crate::lightning::ln::msgs::NetAddress,
12735 /// A pointer to the contents in the error state.
12736 /// Reading from this pointer when `result_ok` is set is undefined.
12737 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12740 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
12741 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12743 pub struct CResult_NetAddressDecodeErrorZ {
12744 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
12745 /// `err` or `result` depending on the state of `result_ok`.
12746 pub contents: CResult_NetAddressDecodeErrorZPtr,
12747 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
12748 pub result_ok: bool,
12751 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12752 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
12753 CResult_NetAddressDecodeErrorZ {
12754 contents: CResult_NetAddressDecodeErrorZPtr {
12755 result: Box::into_raw(Box::new(o)),
12761 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12762 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
12763 CResult_NetAddressDecodeErrorZ {
12764 contents: CResult_NetAddressDecodeErrorZPtr {
12765 err: Box::into_raw(Box::new(e)),
12770 /// Checks if the given object is currently in the success state
12772 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
12776 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12777 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
12778 impl Drop for CResult_NetAddressDecodeErrorZ {
12779 fn drop(&mut self) {
12780 if self.result_ok {
12781 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12782 let _ = unsafe { Box::from_raw(self.contents.result) };
12785 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12786 let _ = unsafe { Box::from_raw(self.contents.err) };
12791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
12792 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12793 let contents = if o.result_ok {
12794 let result = unsafe { o.contents.result };
12795 unsafe { o.contents.result = core::ptr::null_mut() };
12796 CResult_NetAddressDecodeErrorZPtr { result }
12798 let err = unsafe { o.contents.err };
12799 unsafe { o.contents.err = core::ptr::null_mut(); }
12800 CResult_NetAddressDecodeErrorZPtr { err }
12804 result_ok: o.result_ok,
12808 impl Clone for CResult_NetAddressDecodeErrorZ {
12809 fn clone(&self) -> Self {
12810 if self.result_ok {
12811 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
12812 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
12815 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
12816 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12822 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12823 /// but with all dynamically-allocated buffers duplicated in new buffers.
12824 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12826 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12827 /// This corresponds to std::vector in C++
12828 pub struct CVec_UpdateAddHTLCZ {
12829 /// The elements in the array.
12830 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12831 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12832 /// The number of elements pointed to by `data`.
12835 impl CVec_UpdateAddHTLCZ {
12836 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12837 if self.datalen == 0 { return Vec::new(); }
12838 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12839 self.data = core::ptr::null_mut();
12843 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12844 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12847 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12848 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12849 let datalen = v.len();
12850 let data = Box::into_raw(v.into_boxed_slice());
12851 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12855 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12856 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12857 impl Drop for CVec_UpdateAddHTLCZ {
12858 fn drop(&mut self) {
12859 if self.datalen == 0 { return; }
12860 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12863 impl Clone for CVec_UpdateAddHTLCZ {
12864 fn clone(&self) -> Self {
12865 let mut res = Vec::new();
12866 if self.datalen == 0 { return Self::from(res); }
12867 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12872 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12873 /// This corresponds to std::vector in C++
12874 pub struct CVec_UpdateFulfillHTLCZ {
12875 /// The elements in the array.
12876 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12877 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12878 /// The number of elements pointed to by `data`.
12881 impl CVec_UpdateFulfillHTLCZ {
12882 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12883 if self.datalen == 0 { return Vec::new(); }
12884 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12885 self.data = core::ptr::null_mut();
12889 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12890 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12893 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12894 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12895 let datalen = v.len();
12896 let data = Box::into_raw(v.into_boxed_slice());
12897 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12901 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12902 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12903 impl Drop for CVec_UpdateFulfillHTLCZ {
12904 fn drop(&mut self) {
12905 if self.datalen == 0 { return; }
12906 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12909 impl Clone for CVec_UpdateFulfillHTLCZ {
12910 fn clone(&self) -> Self {
12911 let mut res = Vec::new();
12912 if self.datalen == 0 { return Self::from(res); }
12913 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12918 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12919 /// This corresponds to std::vector in C++
12920 pub struct CVec_UpdateFailHTLCZ {
12921 /// The elements in the array.
12922 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12923 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12924 /// The number of elements pointed to by `data`.
12927 impl CVec_UpdateFailHTLCZ {
12928 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12929 if self.datalen == 0 { return Vec::new(); }
12930 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12931 self.data = core::ptr::null_mut();
12935 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12936 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12939 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12940 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12941 let datalen = v.len();
12942 let data = Box::into_raw(v.into_boxed_slice());
12943 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12947 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12948 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12949 impl Drop for CVec_UpdateFailHTLCZ {
12950 fn drop(&mut self) {
12951 if self.datalen == 0 { return; }
12952 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12955 impl Clone for CVec_UpdateFailHTLCZ {
12956 fn clone(&self) -> Self {
12957 let mut res = Vec::new();
12958 if self.datalen == 0 { return Self::from(res); }
12959 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12964 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12965 /// This corresponds to std::vector in C++
12966 pub struct CVec_UpdateFailMalformedHTLCZ {
12967 /// The elements in the array.
12968 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12969 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12970 /// The number of elements pointed to by `data`.
12973 impl CVec_UpdateFailMalformedHTLCZ {
12974 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12975 if self.datalen == 0 { return Vec::new(); }
12976 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12977 self.data = core::ptr::null_mut();
12981 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12982 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12985 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12986 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12987 let datalen = v.len();
12988 let data = Box::into_raw(v.into_boxed_slice());
12989 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12993 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12994 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12995 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12996 fn drop(&mut self) {
12997 if self.datalen == 0 { return; }
12998 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13001 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13002 fn clone(&self) -> Self {
13003 let mut res = Vec::new();
13004 if self.datalen == 0 { return Self::from(res); }
13005 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13010 /// The contents of CResult_AcceptChannelDecodeErrorZ
13011 pub union CResult_AcceptChannelDecodeErrorZPtr {
13012 /// A pointer to the contents in the success state.
13013 /// Reading from this pointer when `result_ok` is not set is undefined.
13014 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13015 /// A pointer to the contents in the error state.
13016 /// Reading from this pointer when `result_ok` is set is undefined.
13017 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13020 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13021 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13023 pub struct CResult_AcceptChannelDecodeErrorZ {
13024 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13025 /// `err` or `result` depending on the state of `result_ok`.
13026 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13027 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13028 pub result_ok: bool,
13031 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13032 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13033 CResult_AcceptChannelDecodeErrorZ {
13034 contents: CResult_AcceptChannelDecodeErrorZPtr {
13035 result: Box::into_raw(Box::new(o)),
13041 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13042 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13043 CResult_AcceptChannelDecodeErrorZ {
13044 contents: CResult_AcceptChannelDecodeErrorZPtr {
13045 err: Box::into_raw(Box::new(e)),
13050 /// Checks if the given object is currently in the success state
13052 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13056 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13057 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13058 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13059 fn drop(&mut self) {
13060 if self.result_ok {
13061 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13062 let _ = unsafe { Box::from_raw(self.contents.result) };
13065 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13066 let _ = unsafe { Box::from_raw(self.contents.err) };
13071 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13072 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13073 let contents = if o.result_ok {
13074 let result = unsafe { o.contents.result };
13075 unsafe { o.contents.result = core::ptr::null_mut() };
13076 CResult_AcceptChannelDecodeErrorZPtr { result }
13078 let err = unsafe { o.contents.err };
13079 unsafe { o.contents.err = core::ptr::null_mut(); }
13080 CResult_AcceptChannelDecodeErrorZPtr { err }
13084 result_ok: o.result_ok,
13088 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13089 fn clone(&self) -> Self {
13090 if self.result_ok {
13091 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13092 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13095 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13096 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13102 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13103 /// but with all dynamically-allocated buffers duplicated in new buffers.
13104 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13106 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13107 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13108 /// A pointer to the contents in the success state.
13109 /// Reading from this pointer when `result_ok` is not set is undefined.
13110 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13111 /// A pointer to the contents in the error state.
13112 /// Reading from this pointer when `result_ok` is set is undefined.
13113 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13116 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13117 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13118 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13119 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13120 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13121 /// `err` or `result` depending on the state of `result_ok`.
13122 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13123 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13124 pub result_ok: bool,
13127 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13128 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13129 CResult_AnnouncementSignaturesDecodeErrorZ {
13130 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13131 result: Box::into_raw(Box::new(o)),
13137 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13138 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13139 CResult_AnnouncementSignaturesDecodeErrorZ {
13140 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13141 err: Box::into_raw(Box::new(e)),
13146 /// Checks if the given object is currently in the success state
13148 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13152 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13153 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13154 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13155 fn drop(&mut self) {
13156 if self.result_ok {
13157 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13158 let _ = unsafe { Box::from_raw(self.contents.result) };
13161 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13162 let _ = unsafe { Box::from_raw(self.contents.err) };
13167 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13168 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13169 let contents = if o.result_ok {
13170 let result = unsafe { o.contents.result };
13171 unsafe { o.contents.result = core::ptr::null_mut() };
13172 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13174 let err = unsafe { o.contents.err };
13175 unsafe { o.contents.err = core::ptr::null_mut(); }
13176 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13180 result_ok: o.result_ok,
13184 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13185 fn clone(&self) -> Self {
13186 if self.result_ok {
13187 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13188 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13191 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13192 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13198 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13199 /// but with all dynamically-allocated buffers duplicated in new buffers.
13200 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13202 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13203 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13204 /// A pointer to the contents in the success state.
13205 /// Reading from this pointer when `result_ok` is not set is undefined.
13206 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13207 /// A pointer to the contents in the error state.
13208 /// Reading from this pointer when `result_ok` is set is undefined.
13209 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13212 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13213 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13214 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13215 pub struct CResult_ChannelReestablishDecodeErrorZ {
13216 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13217 /// `err` or `result` depending on the state of `result_ok`.
13218 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13219 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13220 pub result_ok: bool,
13223 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13224 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13225 CResult_ChannelReestablishDecodeErrorZ {
13226 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13227 result: Box::into_raw(Box::new(o)),
13233 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13234 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13235 CResult_ChannelReestablishDecodeErrorZ {
13236 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13237 err: Box::into_raw(Box::new(e)),
13242 /// Checks if the given object is currently in the success state
13244 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13248 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13249 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13250 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13251 fn drop(&mut self) {
13252 if self.result_ok {
13253 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13254 let _ = unsafe { Box::from_raw(self.contents.result) };
13257 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13258 let _ = unsafe { Box::from_raw(self.contents.err) };
13263 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
13264 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
13265 let contents = if o.result_ok {
13266 let result = unsafe { o.contents.result };
13267 unsafe { o.contents.result = core::ptr::null_mut() };
13268 CResult_ChannelReestablishDecodeErrorZPtr { result }
13270 let err = unsafe { o.contents.err };
13271 unsafe { o.contents.err = core::ptr::null_mut(); }
13272 CResult_ChannelReestablishDecodeErrorZPtr { err }
13276 result_ok: o.result_ok,
13280 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
13281 fn clone(&self) -> Self {
13282 if self.result_ok {
13283 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13284 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
13287 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13288 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13294 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13295 /// but with all dynamically-allocated buffers duplicated in new buffers.
13296 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
13298 /// The contents of CResult_ClosingSignedDecodeErrorZ
13299 pub union CResult_ClosingSignedDecodeErrorZPtr {
13300 /// A pointer to the contents in the success state.
13301 /// Reading from this pointer when `result_ok` is not set is undefined.
13302 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
13303 /// A pointer to the contents in the error state.
13304 /// Reading from this pointer when `result_ok` is set is undefined.
13305 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13308 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
13309 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13310 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13311 pub struct CResult_ClosingSignedDecodeErrorZ {
13312 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
13313 /// `err` or `result` depending on the state of `result_ok`.
13314 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
13315 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
13316 pub result_ok: bool,
13319 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13320 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
13321 CResult_ClosingSignedDecodeErrorZ {
13322 contents: CResult_ClosingSignedDecodeErrorZPtr {
13323 result: Box::into_raw(Box::new(o)),
13329 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13330 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
13331 CResult_ClosingSignedDecodeErrorZ {
13332 contents: CResult_ClosingSignedDecodeErrorZPtr {
13333 err: Box::into_raw(Box::new(e)),
13338 /// Checks if the given object is currently in the success state
13340 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
13344 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13345 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
13346 impl Drop for CResult_ClosingSignedDecodeErrorZ {
13347 fn drop(&mut self) {
13348 if self.result_ok {
13349 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13350 let _ = unsafe { Box::from_raw(self.contents.result) };
13353 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13354 let _ = unsafe { Box::from_raw(self.contents.err) };
13359 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
13360 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13361 let contents = if o.result_ok {
13362 let result = unsafe { o.contents.result };
13363 unsafe { o.contents.result = core::ptr::null_mut() };
13364 CResult_ClosingSignedDecodeErrorZPtr { result }
13366 let err = unsafe { o.contents.err };
13367 unsafe { o.contents.err = core::ptr::null_mut(); }
13368 CResult_ClosingSignedDecodeErrorZPtr { err }
13372 result_ok: o.result_ok,
13376 impl Clone for CResult_ClosingSignedDecodeErrorZ {
13377 fn clone(&self) -> Self {
13378 if self.result_ok {
13379 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
13380 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
13383 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
13384 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13390 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13391 /// but with all dynamically-allocated buffers duplicated in new buffers.
13392 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
13394 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
13395 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13396 /// A pointer to the contents in the success state.
13397 /// Reading from this pointer when `result_ok` is not set is undefined.
13398 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
13399 /// A pointer to the contents in the error state.
13400 /// Reading from this pointer when `result_ok` is set is undefined.
13401 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13404 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
13405 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13406 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13407 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
13408 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
13409 /// `err` or `result` depending on the state of `result_ok`.
13410 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
13411 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
13412 pub result_ok: bool,
13415 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13416 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13417 CResult_ClosingSignedFeeRangeDecodeErrorZ {
13418 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13419 result: Box::into_raw(Box::new(o)),
13425 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13426 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13427 CResult_ClosingSignedFeeRangeDecodeErrorZ {
13428 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13429 err: Box::into_raw(Box::new(e)),
13434 /// Checks if the given object is currently in the success state
13436 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
13440 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13441 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
13442 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13443 fn drop(&mut self) {
13444 if self.result_ok {
13445 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13446 let _ = unsafe { Box::from_raw(self.contents.result) };
13449 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13450 let _ = unsafe { Box::from_raw(self.contents.err) };
13455 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13456 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13457 let contents = if o.result_ok {
13458 let result = unsafe { o.contents.result };
13459 unsafe { o.contents.result = core::ptr::null_mut() };
13460 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13462 let err = unsafe { o.contents.err };
13463 unsafe { o.contents.err = core::ptr::null_mut(); }
13464 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13468 result_ok: o.result_ok,
13472 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13473 fn clone(&self) -> Self {
13474 if self.result_ok {
13475 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13476 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13479 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13480 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13486 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13487 /// but with all dynamically-allocated buffers duplicated in new buffers.
13488 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13490 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13491 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13492 /// A pointer to the contents in the success state.
13493 /// Reading from this pointer when `result_ok` is not set is undefined.
13494 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13495 /// A pointer to the contents in the error state.
13496 /// Reading from this pointer when `result_ok` is set is undefined.
13497 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13500 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13501 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13502 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13503 pub struct CResult_CommitmentSignedDecodeErrorZ {
13504 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13505 /// `err` or `result` depending on the state of `result_ok`.
13506 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13507 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13508 pub result_ok: bool,
13511 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13512 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13513 CResult_CommitmentSignedDecodeErrorZ {
13514 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13515 result: Box::into_raw(Box::new(o)),
13521 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13522 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13523 CResult_CommitmentSignedDecodeErrorZ {
13524 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13525 err: Box::into_raw(Box::new(e)),
13530 /// Checks if the given object is currently in the success state
13532 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13536 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13537 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13538 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13539 fn drop(&mut self) {
13540 if self.result_ok {
13541 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13542 let _ = unsafe { Box::from_raw(self.contents.result) };
13545 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13546 let _ = unsafe { Box::from_raw(self.contents.err) };
13551 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13552 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13553 let contents = if o.result_ok {
13554 let result = unsafe { o.contents.result };
13555 unsafe { o.contents.result = core::ptr::null_mut() };
13556 CResult_CommitmentSignedDecodeErrorZPtr { result }
13558 let err = unsafe { o.contents.err };
13559 unsafe { o.contents.err = core::ptr::null_mut(); }
13560 CResult_CommitmentSignedDecodeErrorZPtr { err }
13564 result_ok: o.result_ok,
13568 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13569 fn clone(&self) -> Self {
13570 if self.result_ok {
13571 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13572 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13575 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13576 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13582 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13583 /// but with all dynamically-allocated buffers duplicated in new buffers.
13584 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13586 /// The contents of CResult_FundingCreatedDecodeErrorZ
13587 pub union CResult_FundingCreatedDecodeErrorZPtr {
13588 /// A pointer to the contents in the success state.
13589 /// Reading from this pointer when `result_ok` is not set is undefined.
13590 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13591 /// A pointer to the contents in the error state.
13592 /// Reading from this pointer when `result_ok` is set is undefined.
13593 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13596 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13597 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13599 pub struct CResult_FundingCreatedDecodeErrorZ {
13600 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13601 /// `err` or `result` depending on the state of `result_ok`.
13602 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13603 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13604 pub result_ok: bool,
13607 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13608 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13609 CResult_FundingCreatedDecodeErrorZ {
13610 contents: CResult_FundingCreatedDecodeErrorZPtr {
13611 result: Box::into_raw(Box::new(o)),
13617 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13618 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13619 CResult_FundingCreatedDecodeErrorZ {
13620 contents: CResult_FundingCreatedDecodeErrorZPtr {
13621 err: Box::into_raw(Box::new(e)),
13626 /// Checks if the given object is currently in the success state
13628 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13632 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13633 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13634 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13635 fn drop(&mut self) {
13636 if self.result_ok {
13637 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13638 let _ = unsafe { Box::from_raw(self.contents.result) };
13641 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13642 let _ = unsafe { Box::from_raw(self.contents.err) };
13647 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13648 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13649 let contents = if o.result_ok {
13650 let result = unsafe { o.contents.result };
13651 unsafe { o.contents.result = core::ptr::null_mut() };
13652 CResult_FundingCreatedDecodeErrorZPtr { result }
13654 let err = unsafe { o.contents.err };
13655 unsafe { o.contents.err = core::ptr::null_mut(); }
13656 CResult_FundingCreatedDecodeErrorZPtr { err }
13660 result_ok: o.result_ok,
13664 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13665 fn clone(&self) -> Self {
13666 if self.result_ok {
13667 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13668 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13671 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13672 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13678 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13679 /// but with all dynamically-allocated buffers duplicated in new buffers.
13680 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13682 /// The contents of CResult_FundingSignedDecodeErrorZ
13683 pub union CResult_FundingSignedDecodeErrorZPtr {
13684 /// A pointer to the contents in the success state.
13685 /// Reading from this pointer when `result_ok` is not set is undefined.
13686 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13687 /// A pointer to the contents in the error state.
13688 /// Reading from this pointer when `result_ok` is set is undefined.
13689 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13692 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13693 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13695 pub struct CResult_FundingSignedDecodeErrorZ {
13696 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13697 /// `err` or `result` depending on the state of `result_ok`.
13698 pub contents: CResult_FundingSignedDecodeErrorZPtr,
13699 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13700 pub result_ok: bool,
13703 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13704 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13705 CResult_FundingSignedDecodeErrorZ {
13706 contents: CResult_FundingSignedDecodeErrorZPtr {
13707 result: Box::into_raw(Box::new(o)),
13713 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13714 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13715 CResult_FundingSignedDecodeErrorZ {
13716 contents: CResult_FundingSignedDecodeErrorZPtr {
13717 err: Box::into_raw(Box::new(e)),
13722 /// Checks if the given object is currently in the success state
13724 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13728 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13729 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13730 impl Drop for CResult_FundingSignedDecodeErrorZ {
13731 fn drop(&mut self) {
13732 if self.result_ok {
13733 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13734 let _ = unsafe { Box::from_raw(self.contents.result) };
13737 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13738 let _ = unsafe { Box::from_raw(self.contents.err) };
13743 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13744 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13745 let contents = if o.result_ok {
13746 let result = unsafe { o.contents.result };
13747 unsafe { o.contents.result = core::ptr::null_mut() };
13748 CResult_FundingSignedDecodeErrorZPtr { result }
13750 let err = unsafe { o.contents.err };
13751 unsafe { o.contents.err = core::ptr::null_mut(); }
13752 CResult_FundingSignedDecodeErrorZPtr { err }
13756 result_ok: o.result_ok,
13760 impl Clone for CResult_FundingSignedDecodeErrorZ {
13761 fn clone(&self) -> Self {
13762 if self.result_ok {
13763 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13764 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13767 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13768 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13774 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13775 /// but with all dynamically-allocated buffers duplicated in new buffers.
13776 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13778 /// The contents of CResult_ChannelReadyDecodeErrorZ
13779 pub union CResult_ChannelReadyDecodeErrorZPtr {
13780 /// A pointer to the contents in the success state.
13781 /// Reading from this pointer when `result_ok` is not set is undefined.
13782 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13783 /// A pointer to the contents in the error state.
13784 /// Reading from this pointer when `result_ok` is set is undefined.
13785 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13788 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13789 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13791 pub struct CResult_ChannelReadyDecodeErrorZ {
13792 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13793 /// `err` or `result` depending on the state of `result_ok`.
13794 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13795 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13796 pub result_ok: bool,
13799 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13800 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13801 CResult_ChannelReadyDecodeErrorZ {
13802 contents: CResult_ChannelReadyDecodeErrorZPtr {
13803 result: Box::into_raw(Box::new(o)),
13809 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13810 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13811 CResult_ChannelReadyDecodeErrorZ {
13812 contents: CResult_ChannelReadyDecodeErrorZPtr {
13813 err: Box::into_raw(Box::new(e)),
13818 /// Checks if the given object is currently in the success state
13820 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13824 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13825 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13826 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13827 fn drop(&mut self) {
13828 if self.result_ok {
13829 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13830 let _ = unsafe { Box::from_raw(self.contents.result) };
13833 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13834 let _ = unsafe { Box::from_raw(self.contents.err) };
13839 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13840 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13841 let contents = if o.result_ok {
13842 let result = unsafe { o.contents.result };
13843 unsafe { o.contents.result = core::ptr::null_mut() };
13844 CResult_ChannelReadyDecodeErrorZPtr { result }
13846 let err = unsafe { o.contents.err };
13847 unsafe { o.contents.err = core::ptr::null_mut(); }
13848 CResult_ChannelReadyDecodeErrorZPtr { err }
13852 result_ok: o.result_ok,
13856 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13857 fn clone(&self) -> Self {
13858 if self.result_ok {
13859 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13860 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13863 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13864 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13870 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13871 /// but with all dynamically-allocated buffers duplicated in new buffers.
13872 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13874 /// The contents of CResult_InitDecodeErrorZ
13875 pub union CResult_InitDecodeErrorZPtr {
13876 /// A pointer to the contents in the success state.
13877 /// Reading from this pointer when `result_ok` is not set is undefined.
13878 pub result: *mut crate::lightning::ln::msgs::Init,
13879 /// A pointer to the contents in the error state.
13880 /// Reading from this pointer when `result_ok` is set is undefined.
13881 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13884 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13885 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13887 pub struct CResult_InitDecodeErrorZ {
13888 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13889 /// `err` or `result` depending on the state of `result_ok`.
13890 pub contents: CResult_InitDecodeErrorZPtr,
13891 /// Whether this CResult_InitDecodeErrorZ represents a success state.
13892 pub result_ok: bool,
13895 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13896 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13897 CResult_InitDecodeErrorZ {
13898 contents: CResult_InitDecodeErrorZPtr {
13899 result: Box::into_raw(Box::new(o)),
13905 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13906 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13907 CResult_InitDecodeErrorZ {
13908 contents: CResult_InitDecodeErrorZPtr {
13909 err: Box::into_raw(Box::new(e)),
13914 /// Checks if the given object is currently in the success state
13916 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13920 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13921 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13922 impl Drop for CResult_InitDecodeErrorZ {
13923 fn drop(&mut self) {
13924 if self.result_ok {
13925 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13926 let _ = unsafe { Box::from_raw(self.contents.result) };
13929 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13930 let _ = unsafe { Box::from_raw(self.contents.err) };
13935 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13936 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13937 let contents = if o.result_ok {
13938 let result = unsafe { o.contents.result };
13939 unsafe { o.contents.result = core::ptr::null_mut() };
13940 CResult_InitDecodeErrorZPtr { result }
13942 let err = unsafe { o.contents.err };
13943 unsafe { o.contents.err = core::ptr::null_mut(); }
13944 CResult_InitDecodeErrorZPtr { err }
13948 result_ok: o.result_ok,
13952 impl Clone for CResult_InitDecodeErrorZ {
13953 fn clone(&self) -> Self {
13954 if self.result_ok {
13955 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13956 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13959 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13960 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13966 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13967 /// but with all dynamically-allocated buffers duplicated in new buffers.
13968 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13970 /// The contents of CResult_OpenChannelDecodeErrorZ
13971 pub union CResult_OpenChannelDecodeErrorZPtr {
13972 /// A pointer to the contents in the success state.
13973 /// Reading from this pointer when `result_ok` is not set is undefined.
13974 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13975 /// A pointer to the contents in the error state.
13976 /// Reading from this pointer when `result_ok` is set is undefined.
13977 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13980 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13981 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13983 pub struct CResult_OpenChannelDecodeErrorZ {
13984 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13985 /// `err` or `result` depending on the state of `result_ok`.
13986 pub contents: CResult_OpenChannelDecodeErrorZPtr,
13987 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13988 pub result_ok: bool,
13991 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13992 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13993 CResult_OpenChannelDecodeErrorZ {
13994 contents: CResult_OpenChannelDecodeErrorZPtr {
13995 result: Box::into_raw(Box::new(o)),
14001 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14002 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14003 CResult_OpenChannelDecodeErrorZ {
14004 contents: CResult_OpenChannelDecodeErrorZPtr {
14005 err: Box::into_raw(Box::new(e)),
14010 /// Checks if the given object is currently in the success state
14012 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14016 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14017 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14018 impl Drop for CResult_OpenChannelDecodeErrorZ {
14019 fn drop(&mut self) {
14020 if self.result_ok {
14021 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14022 let _ = unsafe { Box::from_raw(self.contents.result) };
14025 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14026 let _ = unsafe { Box::from_raw(self.contents.err) };
14031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14032 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14033 let contents = if o.result_ok {
14034 let result = unsafe { o.contents.result };
14035 unsafe { o.contents.result = core::ptr::null_mut() };
14036 CResult_OpenChannelDecodeErrorZPtr { result }
14038 let err = unsafe { o.contents.err };
14039 unsafe { o.contents.err = core::ptr::null_mut(); }
14040 CResult_OpenChannelDecodeErrorZPtr { err }
14044 result_ok: o.result_ok,
14048 impl Clone for CResult_OpenChannelDecodeErrorZ {
14049 fn clone(&self) -> Self {
14050 if self.result_ok {
14051 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14052 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14055 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14056 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14062 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14063 /// but with all dynamically-allocated buffers duplicated in new buffers.
14064 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14066 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14067 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14068 /// A pointer to the contents in the success state.
14069 /// Reading from this pointer when `result_ok` is not set is undefined.
14070 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14071 /// A pointer to the contents in the error state.
14072 /// Reading from this pointer when `result_ok` is set is undefined.
14073 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14076 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14077 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14079 pub struct CResult_RevokeAndACKDecodeErrorZ {
14080 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14081 /// `err` or `result` depending on the state of `result_ok`.
14082 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14083 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14084 pub result_ok: bool,
14087 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14088 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14089 CResult_RevokeAndACKDecodeErrorZ {
14090 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14091 result: Box::into_raw(Box::new(o)),
14097 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14098 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14099 CResult_RevokeAndACKDecodeErrorZ {
14100 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14101 err: Box::into_raw(Box::new(e)),
14106 /// Checks if the given object is currently in the success state
14108 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14112 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14113 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14114 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14115 fn drop(&mut self) {
14116 if self.result_ok {
14117 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14118 let _ = unsafe { Box::from_raw(self.contents.result) };
14121 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14122 let _ = unsafe { Box::from_raw(self.contents.err) };
14127 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14128 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14129 let contents = if o.result_ok {
14130 let result = unsafe { o.contents.result };
14131 unsafe { o.contents.result = core::ptr::null_mut() };
14132 CResult_RevokeAndACKDecodeErrorZPtr { result }
14134 let err = unsafe { o.contents.err };
14135 unsafe { o.contents.err = core::ptr::null_mut(); }
14136 CResult_RevokeAndACKDecodeErrorZPtr { err }
14140 result_ok: o.result_ok,
14144 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14145 fn clone(&self) -> Self {
14146 if self.result_ok {
14147 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14148 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14151 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14152 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14158 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14159 /// but with all dynamically-allocated buffers duplicated in new buffers.
14160 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14162 /// The contents of CResult_ShutdownDecodeErrorZ
14163 pub union CResult_ShutdownDecodeErrorZPtr {
14164 /// A pointer to the contents in the success state.
14165 /// Reading from this pointer when `result_ok` is not set is undefined.
14166 pub result: *mut crate::lightning::ln::msgs::Shutdown,
14167 /// A pointer to the contents in the error state.
14168 /// Reading from this pointer when `result_ok` is set is undefined.
14169 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14172 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14173 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14174 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14175 pub struct CResult_ShutdownDecodeErrorZ {
14176 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14177 /// `err` or `result` depending on the state of `result_ok`.
14178 pub contents: CResult_ShutdownDecodeErrorZPtr,
14179 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14180 pub result_ok: bool,
14183 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14184 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14185 CResult_ShutdownDecodeErrorZ {
14186 contents: CResult_ShutdownDecodeErrorZPtr {
14187 result: Box::into_raw(Box::new(o)),
14193 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14194 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14195 CResult_ShutdownDecodeErrorZ {
14196 contents: CResult_ShutdownDecodeErrorZPtr {
14197 err: Box::into_raw(Box::new(e)),
14202 /// Checks if the given object is currently in the success state
14204 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14208 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14209 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14210 impl Drop for CResult_ShutdownDecodeErrorZ {
14211 fn drop(&mut self) {
14212 if self.result_ok {
14213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14214 let _ = unsafe { Box::from_raw(self.contents.result) };
14217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14218 let _ = unsafe { Box::from_raw(self.contents.err) };
14223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14225 let contents = if o.result_ok {
14226 let result = unsafe { o.contents.result };
14227 unsafe { o.contents.result = core::ptr::null_mut() };
14228 CResult_ShutdownDecodeErrorZPtr { result }
14230 let err = unsafe { o.contents.err };
14231 unsafe { o.contents.err = core::ptr::null_mut(); }
14232 CResult_ShutdownDecodeErrorZPtr { err }
14236 result_ok: o.result_ok,
14240 impl Clone for CResult_ShutdownDecodeErrorZ {
14241 fn clone(&self) -> Self {
14242 if self.result_ok {
14243 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14244 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14247 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14254 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14255 /// but with all dynamically-allocated buffers duplicated in new buffers.
14256 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
14258 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
14259 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
14260 /// A pointer to the contents in the success state.
14261 /// Reading from this pointer when `result_ok` is not set is undefined.
14262 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14263 /// A pointer to the contents in the error state.
14264 /// Reading from this pointer when `result_ok` is set is undefined.
14265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14268 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
14269 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14271 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
14272 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
14273 /// `err` or `result` depending on the state of `result_ok`.
14274 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
14275 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
14276 pub result_ok: bool,
14279 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14280 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
14281 CResult_UpdateFailHTLCDecodeErrorZ {
14282 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14283 result: Box::into_raw(Box::new(o)),
14289 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14290 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
14291 CResult_UpdateFailHTLCDecodeErrorZ {
14292 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14293 err: Box::into_raw(Box::new(e)),
14298 /// Checks if the given object is currently in the success state
14300 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
14304 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14305 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
14306 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
14307 fn drop(&mut self) {
14308 if self.result_ok {
14309 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14310 let _ = unsafe { Box::from_raw(self.contents.result) };
14313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14314 let _ = unsafe { Box::from_raw(self.contents.err) };
14319 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
14320 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14321 let contents = if o.result_ok {
14322 let result = unsafe { o.contents.result };
14323 unsafe { o.contents.result = core::ptr::null_mut() };
14324 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
14326 let err = unsafe { o.contents.err };
14327 unsafe { o.contents.err = core::ptr::null_mut(); }
14328 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
14332 result_ok: o.result_ok,
14336 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
14337 fn clone(&self) -> Self {
14338 if self.result_ok {
14339 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14340 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
14343 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14344 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14350 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14351 /// but with all dynamically-allocated buffers duplicated in new buffers.
14352 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
14354 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
14355 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14356 /// A pointer to the contents in the success state.
14357 /// Reading from this pointer when `result_ok` is not set is undefined.
14358 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14359 /// A pointer to the contents in the error state.
14360 /// Reading from this pointer when `result_ok` is set is undefined.
14361 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14364 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
14365 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14367 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14368 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
14369 /// `err` or `result` depending on the state of `result_ok`.
14370 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
14371 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
14372 pub result_ok: bool,
14375 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14376 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14377 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14378 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14379 result: Box::into_raw(Box::new(o)),
14385 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14386 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14387 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14388 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14389 err: Box::into_raw(Box::new(e)),
14394 /// Checks if the given object is currently in the success state
14396 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
14400 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14401 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
14402 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14403 fn drop(&mut self) {
14404 if self.result_ok {
14405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14406 let _ = unsafe { Box::from_raw(self.contents.result) };
14409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14410 let _ = unsafe { Box::from_raw(self.contents.err) };
14415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14417 let contents = if o.result_ok {
14418 let result = unsafe { o.contents.result };
14419 unsafe { o.contents.result = core::ptr::null_mut() };
14420 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
14422 let err = unsafe { o.contents.err };
14423 unsafe { o.contents.err = core::ptr::null_mut(); }
14424 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
14428 result_ok: o.result_ok,
14432 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14433 fn clone(&self) -> Self {
14434 if self.result_ok {
14435 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14436 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
14439 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14440 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14446 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14447 /// but with all dynamically-allocated buffers duplicated in new buffers.
14448 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
14450 /// The contents of CResult_UpdateFeeDecodeErrorZ
14451 pub union CResult_UpdateFeeDecodeErrorZPtr {
14452 /// A pointer to the contents in the success state.
14453 /// Reading from this pointer when `result_ok` is not set is undefined.
14454 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14455 /// A pointer to the contents in the error state.
14456 /// Reading from this pointer when `result_ok` is set is undefined.
14457 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14460 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14461 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14463 pub struct CResult_UpdateFeeDecodeErrorZ {
14464 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14465 /// `err` or `result` depending on the state of `result_ok`.
14466 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14467 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14468 pub result_ok: bool,
14471 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14472 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14473 CResult_UpdateFeeDecodeErrorZ {
14474 contents: CResult_UpdateFeeDecodeErrorZPtr {
14475 result: Box::into_raw(Box::new(o)),
14481 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14482 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14483 CResult_UpdateFeeDecodeErrorZ {
14484 contents: CResult_UpdateFeeDecodeErrorZPtr {
14485 err: Box::into_raw(Box::new(e)),
14490 /// Checks if the given object is currently in the success state
14492 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14496 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14497 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14498 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14499 fn drop(&mut self) {
14500 if self.result_ok {
14501 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14502 let _ = unsafe { Box::from_raw(self.contents.result) };
14505 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14506 let _ = unsafe { Box::from_raw(self.contents.err) };
14511 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14512 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14513 let contents = if o.result_ok {
14514 let result = unsafe { o.contents.result };
14515 unsafe { o.contents.result = core::ptr::null_mut() };
14516 CResult_UpdateFeeDecodeErrorZPtr { result }
14518 let err = unsafe { o.contents.err };
14519 unsafe { o.contents.err = core::ptr::null_mut(); }
14520 CResult_UpdateFeeDecodeErrorZPtr { err }
14524 result_ok: o.result_ok,
14528 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14529 fn clone(&self) -> Self {
14530 if self.result_ok {
14531 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14532 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14535 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14536 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14542 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14543 /// but with all dynamically-allocated buffers duplicated in new buffers.
14544 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14546 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14547 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14548 /// A pointer to the contents in the success state.
14549 /// Reading from this pointer when `result_ok` is not set is undefined.
14550 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14551 /// A pointer to the contents in the error state.
14552 /// Reading from this pointer when `result_ok` is set is undefined.
14553 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14556 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14557 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14559 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14560 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14561 /// `err` or `result` depending on the state of `result_ok`.
14562 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14563 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14564 pub result_ok: bool,
14567 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14568 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14569 CResult_UpdateFulfillHTLCDecodeErrorZ {
14570 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14571 result: Box::into_raw(Box::new(o)),
14577 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14578 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14579 CResult_UpdateFulfillHTLCDecodeErrorZ {
14580 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14581 err: Box::into_raw(Box::new(e)),
14586 /// Checks if the given object is currently in the success state
14588 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14592 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14593 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14594 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14595 fn drop(&mut self) {
14596 if self.result_ok {
14597 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14598 let _ = unsafe { Box::from_raw(self.contents.result) };
14601 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14602 let _ = unsafe { Box::from_raw(self.contents.err) };
14607 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14608 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14609 let contents = if o.result_ok {
14610 let result = unsafe { o.contents.result };
14611 unsafe { o.contents.result = core::ptr::null_mut() };
14612 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14614 let err = unsafe { o.contents.err };
14615 unsafe { o.contents.err = core::ptr::null_mut(); }
14616 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14620 result_ok: o.result_ok,
14624 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14625 fn clone(&self) -> Self {
14626 if self.result_ok {
14627 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14628 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14631 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14632 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14638 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14639 /// but with all dynamically-allocated buffers duplicated in new buffers.
14640 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14642 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14643 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14644 /// A pointer to the contents in the success state.
14645 /// Reading from this pointer when `result_ok` is not set is undefined.
14646 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14647 /// A pointer to the contents in the error state.
14648 /// Reading from this pointer when `result_ok` is set is undefined.
14649 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14652 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14653 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14655 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14656 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14657 /// `err` or `result` depending on the state of `result_ok`.
14658 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14659 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14660 pub result_ok: bool,
14663 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14664 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14665 CResult_UpdateAddHTLCDecodeErrorZ {
14666 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14667 result: Box::into_raw(Box::new(o)),
14673 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14674 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14675 CResult_UpdateAddHTLCDecodeErrorZ {
14676 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14677 err: Box::into_raw(Box::new(e)),
14682 /// Checks if the given object is currently in the success state
14684 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14688 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14689 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14690 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14691 fn drop(&mut self) {
14692 if self.result_ok {
14693 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14694 let _ = unsafe { Box::from_raw(self.contents.result) };
14697 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14698 let _ = unsafe { Box::from_raw(self.contents.err) };
14703 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14704 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14705 let contents = if o.result_ok {
14706 let result = unsafe { o.contents.result };
14707 unsafe { o.contents.result = core::ptr::null_mut() };
14708 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14710 let err = unsafe { o.contents.err };
14711 unsafe { o.contents.err = core::ptr::null_mut(); }
14712 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14716 result_ok: o.result_ok,
14720 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14721 fn clone(&self) -> Self {
14722 if self.result_ok {
14723 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14724 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14727 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14728 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14734 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14735 /// but with all dynamically-allocated buffers duplicated in new buffers.
14736 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14738 /// The contents of CResult_OnionMessageDecodeErrorZ
14739 pub union CResult_OnionMessageDecodeErrorZPtr {
14740 /// A pointer to the contents in the success state.
14741 /// Reading from this pointer when `result_ok` is not set is undefined.
14742 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
14743 /// A pointer to the contents in the error state.
14744 /// Reading from this pointer when `result_ok` is set is undefined.
14745 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14748 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
14749 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14751 pub struct CResult_OnionMessageDecodeErrorZ {
14752 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
14753 /// `err` or `result` depending on the state of `result_ok`.
14754 pub contents: CResult_OnionMessageDecodeErrorZPtr,
14755 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
14756 pub result_ok: bool,
14759 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
14760 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
14761 CResult_OnionMessageDecodeErrorZ {
14762 contents: CResult_OnionMessageDecodeErrorZPtr {
14763 result: Box::into_raw(Box::new(o)),
14769 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
14770 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
14771 CResult_OnionMessageDecodeErrorZ {
14772 contents: CResult_OnionMessageDecodeErrorZPtr {
14773 err: Box::into_raw(Box::new(e)),
14778 /// Checks if the given object is currently in the success state
14780 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
14784 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
14785 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
14786 impl Drop for CResult_OnionMessageDecodeErrorZ {
14787 fn drop(&mut self) {
14788 if self.result_ok {
14789 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14790 let _ = unsafe { Box::from_raw(self.contents.result) };
14793 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14794 let _ = unsafe { Box::from_raw(self.contents.err) };
14799 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
14800 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14801 let contents = if o.result_ok {
14802 let result = unsafe { o.contents.result };
14803 unsafe { o.contents.result = core::ptr::null_mut() };
14804 CResult_OnionMessageDecodeErrorZPtr { result }
14806 let err = unsafe { o.contents.err };
14807 unsafe { o.contents.err = core::ptr::null_mut(); }
14808 CResult_OnionMessageDecodeErrorZPtr { err }
14812 result_ok: o.result_ok,
14816 impl Clone for CResult_OnionMessageDecodeErrorZ {
14817 fn clone(&self) -> Self {
14818 if self.result_ok {
14819 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
14820 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
14823 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
14824 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14830 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
14831 /// but with all dynamically-allocated buffers duplicated in new buffers.
14832 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
14834 /// The contents of CResult_PingDecodeErrorZ
14835 pub union CResult_PingDecodeErrorZPtr {
14836 /// A pointer to the contents in the success state.
14837 /// Reading from this pointer when `result_ok` is not set is undefined.
14838 pub result: *mut crate::lightning::ln::msgs::Ping,
14839 /// A pointer to the contents in the error state.
14840 /// Reading from this pointer when `result_ok` is set is undefined.
14841 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14844 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
14845 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
14846 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14847 pub struct CResult_PingDecodeErrorZ {
14848 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
14849 /// `err` or `result` depending on the state of `result_ok`.
14850 pub contents: CResult_PingDecodeErrorZPtr,
14851 /// Whether this CResult_PingDecodeErrorZ represents a success state.
14852 pub result_ok: bool,
14855 /// Creates a new CResult_PingDecodeErrorZ in the success state.
14856 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
14857 CResult_PingDecodeErrorZ {
14858 contents: CResult_PingDecodeErrorZPtr {
14859 result: Box::into_raw(Box::new(o)),
14865 /// Creates a new CResult_PingDecodeErrorZ in the error state.
14866 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
14867 CResult_PingDecodeErrorZ {
14868 contents: CResult_PingDecodeErrorZPtr {
14869 err: Box::into_raw(Box::new(e)),
14874 /// Checks if the given object is currently in the success state
14876 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
14880 /// Frees any resources used by the CResult_PingDecodeErrorZ.
14881 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
14882 impl Drop for CResult_PingDecodeErrorZ {
14883 fn drop(&mut self) {
14884 if self.result_ok {
14885 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14886 let _ = unsafe { Box::from_raw(self.contents.result) };
14889 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14890 let _ = unsafe { Box::from_raw(self.contents.err) };
14895 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
14896 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
14897 let contents = if o.result_ok {
14898 let result = unsafe { o.contents.result };
14899 unsafe { o.contents.result = core::ptr::null_mut() };
14900 CResult_PingDecodeErrorZPtr { result }
14902 let err = unsafe { o.contents.err };
14903 unsafe { o.contents.err = core::ptr::null_mut(); }
14904 CResult_PingDecodeErrorZPtr { err }
14908 result_ok: o.result_ok,
14912 impl Clone for CResult_PingDecodeErrorZ {
14913 fn clone(&self) -> Self {
14914 if self.result_ok {
14915 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
14916 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
14919 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
14920 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14926 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14927 /// but with all dynamically-allocated buffers duplicated in new buffers.
14928 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
14930 /// The contents of CResult_PongDecodeErrorZ
14931 pub union CResult_PongDecodeErrorZPtr {
14932 /// A pointer to the contents in the success state.
14933 /// Reading from this pointer when `result_ok` is not set is undefined.
14934 pub result: *mut crate::lightning::ln::msgs::Pong,
14935 /// A pointer to the contents in the error state.
14936 /// Reading from this pointer when `result_ok` is set is undefined.
14937 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14940 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
14941 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
14942 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14943 pub struct CResult_PongDecodeErrorZ {
14944 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
14945 /// `err` or `result` depending on the state of `result_ok`.
14946 pub contents: CResult_PongDecodeErrorZPtr,
14947 /// Whether this CResult_PongDecodeErrorZ represents a success state.
14948 pub result_ok: bool,
14951 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14952 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14953 CResult_PongDecodeErrorZ {
14954 contents: CResult_PongDecodeErrorZPtr {
14955 result: Box::into_raw(Box::new(o)),
14961 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14962 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14963 CResult_PongDecodeErrorZ {
14964 contents: CResult_PongDecodeErrorZPtr {
14965 err: Box::into_raw(Box::new(e)),
14970 /// Checks if the given object is currently in the success state
14972 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14976 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14977 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14978 impl Drop for CResult_PongDecodeErrorZ {
14979 fn drop(&mut self) {
14980 if self.result_ok {
14981 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14982 let _ = unsafe { Box::from_raw(self.contents.result) };
14985 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14986 let _ = unsafe { Box::from_raw(self.contents.err) };
14991 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14992 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14993 let contents = if o.result_ok {
14994 let result = unsafe { o.contents.result };
14995 unsafe { o.contents.result = core::ptr::null_mut() };
14996 CResult_PongDecodeErrorZPtr { result }
14998 let err = unsafe { o.contents.err };
14999 unsafe { o.contents.err = core::ptr::null_mut(); }
15000 CResult_PongDecodeErrorZPtr { err }
15004 result_ok: o.result_ok,
15008 impl Clone for CResult_PongDecodeErrorZ {
15009 fn clone(&self) -> Self {
15010 if self.result_ok {
15011 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15012 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15015 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15016 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15022 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15023 /// but with all dynamically-allocated buffers duplicated in new buffers.
15024 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15026 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15027 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15028 /// A pointer to the contents in the success state.
15029 /// Reading from this pointer when `result_ok` is not set is undefined.
15030 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15031 /// A pointer to the contents in the error state.
15032 /// Reading from this pointer when `result_ok` is set is undefined.
15033 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15036 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15037 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15038 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15039 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15040 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15041 /// `err` or `result` depending on the state of `result_ok`.
15042 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15043 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15044 pub result_ok: bool,
15047 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15048 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15049 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15050 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15051 result: Box::into_raw(Box::new(o)),
15057 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15058 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15059 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15060 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15061 err: Box::into_raw(Box::new(e)),
15066 /// Checks if the given object is currently in the success state
15068 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15072 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15073 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15074 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15075 fn drop(&mut self) {
15076 if self.result_ok {
15077 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15078 let _ = unsafe { Box::from_raw(self.contents.result) };
15081 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15082 let _ = unsafe { Box::from_raw(self.contents.err) };
15087 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15088 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15089 let contents = if o.result_ok {
15090 let result = unsafe { o.contents.result };
15091 unsafe { o.contents.result = core::ptr::null_mut() };
15092 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15094 let err = unsafe { o.contents.err };
15095 unsafe { o.contents.err = core::ptr::null_mut(); }
15096 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15100 result_ok: o.result_ok,
15104 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15105 fn clone(&self) -> Self {
15106 if self.result_ok {
15107 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15108 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15111 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15112 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15118 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15119 /// but with all dynamically-allocated buffers duplicated in new buffers.
15120 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15122 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15123 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15124 /// A pointer to the contents in the success state.
15125 /// Reading from this pointer when `result_ok` is not set is undefined.
15126 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15127 /// A pointer to the contents in the error state.
15128 /// Reading from this pointer when `result_ok` is set is undefined.
15129 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15132 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15133 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15135 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15136 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15137 /// `err` or `result` depending on the state of `result_ok`.
15138 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15139 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15140 pub result_ok: bool,
15143 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15144 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15145 CResult_ChannelAnnouncementDecodeErrorZ {
15146 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15147 result: Box::into_raw(Box::new(o)),
15153 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15154 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15155 CResult_ChannelAnnouncementDecodeErrorZ {
15156 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15157 err: Box::into_raw(Box::new(e)),
15162 /// Checks if the given object is currently in the success state
15164 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15168 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15169 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15170 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15171 fn drop(&mut self) {
15172 if self.result_ok {
15173 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15174 let _ = unsafe { Box::from_raw(self.contents.result) };
15177 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15178 let _ = unsafe { Box::from_raw(self.contents.err) };
15183 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15184 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15185 let contents = if o.result_ok {
15186 let result = unsafe { o.contents.result };
15187 unsafe { o.contents.result = core::ptr::null_mut() };
15188 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15190 let err = unsafe { o.contents.err };
15191 unsafe { o.contents.err = core::ptr::null_mut(); }
15192 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15196 result_ok: o.result_ok,
15200 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15201 fn clone(&self) -> Self {
15202 if self.result_ok {
15203 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15204 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15207 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15208 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15214 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15215 /// but with all dynamically-allocated buffers duplicated in new buffers.
15216 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15218 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15219 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15220 /// A pointer to the contents in the success state.
15221 /// Reading from this pointer when `result_ok` is not set is undefined.
15222 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15223 /// A pointer to the contents in the error state.
15224 /// Reading from this pointer when `result_ok` is set is undefined.
15225 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15228 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15229 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15231 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15232 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15233 /// `err` or `result` depending on the state of `result_ok`.
15234 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15235 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15236 pub result_ok: bool,
15239 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15240 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15241 CResult_UnsignedChannelUpdateDecodeErrorZ {
15242 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15243 result: Box::into_raw(Box::new(o)),
15249 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15250 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15251 CResult_UnsignedChannelUpdateDecodeErrorZ {
15252 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15253 err: Box::into_raw(Box::new(e)),
15258 /// Checks if the given object is currently in the success state
15260 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
15264 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15265 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
15266 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
15267 fn drop(&mut self) {
15268 if self.result_ok {
15269 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15270 let _ = unsafe { Box::from_raw(self.contents.result) };
15273 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15274 let _ = unsafe { Box::from_raw(self.contents.err) };
15279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
15280 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15281 let contents = if o.result_ok {
15282 let result = unsafe { o.contents.result };
15283 unsafe { o.contents.result = core::ptr::null_mut() };
15284 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
15286 let err = unsafe { o.contents.err };
15287 unsafe { o.contents.err = core::ptr::null_mut(); }
15288 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
15292 result_ok: o.result_ok,
15296 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
15297 fn clone(&self) -> Self {
15298 if self.result_ok {
15299 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15300 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
15303 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15304 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15310 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15311 /// but with all dynamically-allocated buffers duplicated in new buffers.
15312 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15314 /// The contents of CResult_ChannelUpdateDecodeErrorZ
15315 pub union CResult_ChannelUpdateDecodeErrorZPtr {
15316 /// A pointer to the contents in the success state.
15317 /// Reading from this pointer when `result_ok` is not set is undefined.
15318 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
15319 /// A pointer to the contents in the error state.
15320 /// Reading from this pointer when `result_ok` is set is undefined.
15321 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15324 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15325 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15327 pub struct CResult_ChannelUpdateDecodeErrorZ {
15328 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
15329 /// `err` or `result` depending on the state of `result_ok`.
15330 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
15331 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
15332 pub result_ok: bool,
15335 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15336 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
15337 CResult_ChannelUpdateDecodeErrorZ {
15338 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15339 result: Box::into_raw(Box::new(o)),
15345 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15346 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
15347 CResult_ChannelUpdateDecodeErrorZ {
15348 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15349 err: Box::into_raw(Box::new(e)),
15354 /// Checks if the given object is currently in the success state
15356 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
15360 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15361 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
15362 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
15363 fn drop(&mut self) {
15364 if self.result_ok {
15365 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15366 let _ = unsafe { Box::from_raw(self.contents.result) };
15369 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15370 let _ = unsafe { Box::from_raw(self.contents.err) };
15375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
15376 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15377 let contents = if o.result_ok {
15378 let result = unsafe { o.contents.result };
15379 unsafe { o.contents.result = core::ptr::null_mut() };
15380 CResult_ChannelUpdateDecodeErrorZPtr { result }
15382 let err = unsafe { o.contents.err };
15383 unsafe { o.contents.err = core::ptr::null_mut(); }
15384 CResult_ChannelUpdateDecodeErrorZPtr { err }
15388 result_ok: o.result_ok,
15392 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
15393 fn clone(&self) -> Self {
15394 if self.result_ok {
15395 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15396 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
15399 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15400 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15406 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15407 /// but with all dynamically-allocated buffers duplicated in new buffers.
15408 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15410 /// The contents of CResult_ErrorMessageDecodeErrorZ
15411 pub union CResult_ErrorMessageDecodeErrorZPtr {
15412 /// A pointer to the contents in the success state.
15413 /// Reading from this pointer when `result_ok` is not set is undefined.
15414 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
15415 /// A pointer to the contents in the error state.
15416 /// Reading from this pointer when `result_ok` is set is undefined.
15417 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15420 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
15421 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15423 pub struct CResult_ErrorMessageDecodeErrorZ {
15424 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
15425 /// `err` or `result` depending on the state of `result_ok`.
15426 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
15427 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
15428 pub result_ok: bool,
15431 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15432 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
15433 CResult_ErrorMessageDecodeErrorZ {
15434 contents: CResult_ErrorMessageDecodeErrorZPtr {
15435 result: Box::into_raw(Box::new(o)),
15441 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15442 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
15443 CResult_ErrorMessageDecodeErrorZ {
15444 contents: CResult_ErrorMessageDecodeErrorZPtr {
15445 err: Box::into_raw(Box::new(e)),
15450 /// Checks if the given object is currently in the success state
15452 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
15456 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15457 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
15458 impl Drop for CResult_ErrorMessageDecodeErrorZ {
15459 fn drop(&mut self) {
15460 if self.result_ok {
15461 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15462 let _ = unsafe { Box::from_raw(self.contents.result) };
15465 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15466 let _ = unsafe { Box::from_raw(self.contents.err) };
15471 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
15472 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15473 let contents = if o.result_ok {
15474 let result = unsafe { o.contents.result };
15475 unsafe { o.contents.result = core::ptr::null_mut() };
15476 CResult_ErrorMessageDecodeErrorZPtr { result }
15478 let err = unsafe { o.contents.err };
15479 unsafe { o.contents.err = core::ptr::null_mut(); }
15480 CResult_ErrorMessageDecodeErrorZPtr { err }
15484 result_ok: o.result_ok,
15488 impl Clone for CResult_ErrorMessageDecodeErrorZ {
15489 fn clone(&self) -> Self {
15490 if self.result_ok {
15491 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
15492 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
15495 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
15496 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15502 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15503 /// but with all dynamically-allocated buffers duplicated in new buffers.
15504 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
15506 /// The contents of CResult_WarningMessageDecodeErrorZ
15507 pub union CResult_WarningMessageDecodeErrorZPtr {
15508 /// A pointer to the contents in the success state.
15509 /// Reading from this pointer when `result_ok` is not set is undefined.
15510 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
15511 /// A pointer to the contents in the error state.
15512 /// Reading from this pointer when `result_ok` is set is undefined.
15513 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15516 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
15517 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15518 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15519 pub struct CResult_WarningMessageDecodeErrorZ {
15520 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
15521 /// `err` or `result` depending on the state of `result_ok`.
15522 pub contents: CResult_WarningMessageDecodeErrorZPtr,
15523 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
15524 pub result_ok: bool,
15527 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
15528 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
15529 CResult_WarningMessageDecodeErrorZ {
15530 contents: CResult_WarningMessageDecodeErrorZPtr {
15531 result: Box::into_raw(Box::new(o)),
15537 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
15538 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
15539 CResult_WarningMessageDecodeErrorZ {
15540 contents: CResult_WarningMessageDecodeErrorZPtr {
15541 err: Box::into_raw(Box::new(e)),
15546 /// Checks if the given object is currently in the success state
15548 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15552 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15553 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15554 impl Drop for CResult_WarningMessageDecodeErrorZ {
15555 fn drop(&mut self) {
15556 if self.result_ok {
15557 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15558 let _ = unsafe { Box::from_raw(self.contents.result) };
15561 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15562 let _ = unsafe { Box::from_raw(self.contents.err) };
15567 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15568 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15569 let contents = if o.result_ok {
15570 let result = unsafe { o.contents.result };
15571 unsafe { o.contents.result = core::ptr::null_mut() };
15572 CResult_WarningMessageDecodeErrorZPtr { result }
15574 let err = unsafe { o.contents.err };
15575 unsafe { o.contents.err = core::ptr::null_mut(); }
15576 CResult_WarningMessageDecodeErrorZPtr { err }
15580 result_ok: o.result_ok,
15584 impl Clone for CResult_WarningMessageDecodeErrorZ {
15585 fn clone(&self) -> Self {
15586 if self.result_ok {
15587 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15588 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15591 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15592 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15598 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15599 /// but with all dynamically-allocated buffers duplicated in new buffers.
15600 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15602 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15603 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15604 /// A pointer to the contents in the success state.
15605 /// Reading from this pointer when `result_ok` is not set is undefined.
15606 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15607 /// A pointer to the contents in the error state.
15608 /// Reading from this pointer when `result_ok` is set is undefined.
15609 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15612 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15613 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15615 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15616 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15617 /// `err` or `result` depending on the state of `result_ok`.
15618 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15619 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15620 pub result_ok: bool,
15623 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15624 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15625 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15626 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15627 result: Box::into_raw(Box::new(o)),
15633 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15634 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15635 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15636 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15637 err: Box::into_raw(Box::new(e)),
15642 /// Checks if the given object is currently in the success state
15644 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
15648 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15649 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
15650 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15651 fn drop(&mut self) {
15652 if self.result_ok {
15653 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15654 let _ = unsafe { Box::from_raw(self.contents.result) };
15657 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15658 let _ = unsafe { Box::from_raw(self.contents.err) };
15663 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15664 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15665 let contents = if o.result_ok {
15666 let result = unsafe { o.contents.result };
15667 unsafe { o.contents.result = core::ptr::null_mut() };
15668 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
15670 let err = unsafe { o.contents.err };
15671 unsafe { o.contents.err = core::ptr::null_mut(); }
15672 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
15676 result_ok: o.result_ok,
15680 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15681 fn clone(&self) -> Self {
15682 if self.result_ok {
15683 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15684 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15687 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15688 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15694 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15695 /// but with all dynamically-allocated buffers duplicated in new buffers.
15696 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15698 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15699 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15700 /// A pointer to the contents in the success state.
15701 /// Reading from this pointer when `result_ok` is not set is undefined.
15702 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15703 /// A pointer to the contents in the error state.
15704 /// Reading from this pointer when `result_ok` is set is undefined.
15705 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15708 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15709 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15711 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15712 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15713 /// `err` or `result` depending on the state of `result_ok`.
15714 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15715 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15716 pub result_ok: bool,
15719 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15720 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15721 CResult_NodeAnnouncementDecodeErrorZ {
15722 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15723 result: Box::into_raw(Box::new(o)),
15729 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15730 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15731 CResult_NodeAnnouncementDecodeErrorZ {
15732 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15733 err: Box::into_raw(Box::new(e)),
15738 /// Checks if the given object is currently in the success state
15740 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15744 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15745 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15746 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15747 fn drop(&mut self) {
15748 if self.result_ok {
15749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15750 let _ = unsafe { Box::from_raw(self.contents.result) };
15753 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15754 let _ = unsafe { Box::from_raw(self.contents.err) };
15759 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15760 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15761 let contents = if o.result_ok {
15762 let result = unsafe { o.contents.result };
15763 unsafe { o.contents.result = core::ptr::null_mut() };
15764 CResult_NodeAnnouncementDecodeErrorZPtr { result }
15766 let err = unsafe { o.contents.err };
15767 unsafe { o.contents.err = core::ptr::null_mut(); }
15768 CResult_NodeAnnouncementDecodeErrorZPtr { err }
15772 result_ok: o.result_ok,
15776 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15777 fn clone(&self) -> Self {
15778 if self.result_ok {
15779 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15780 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15783 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15784 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15790 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15791 /// but with all dynamically-allocated buffers duplicated in new buffers.
15792 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15794 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15795 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15796 /// A pointer to the contents in the success state.
15797 /// Reading from this pointer when `result_ok` is not set is undefined.
15798 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15799 /// A pointer to the contents in the error state.
15800 /// Reading from this pointer when `result_ok` is set is undefined.
15801 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15804 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15805 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15807 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15808 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15809 /// `err` or `result` depending on the state of `result_ok`.
15810 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15811 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15812 pub result_ok: bool,
15815 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15816 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15817 CResult_QueryShortChannelIdsDecodeErrorZ {
15818 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15819 result: Box::into_raw(Box::new(o)),
15825 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15826 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15827 CResult_QueryShortChannelIdsDecodeErrorZ {
15828 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15829 err: Box::into_raw(Box::new(e)),
15834 /// Checks if the given object is currently in the success state
15836 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
15840 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15841 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
15842 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
15843 fn drop(&mut self) {
15844 if self.result_ok {
15845 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15846 let _ = unsafe { Box::from_raw(self.contents.result) };
15849 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15850 let _ = unsafe { Box::from_raw(self.contents.err) };
15855 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
15856 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
15857 let contents = if o.result_ok {
15858 let result = unsafe { o.contents.result };
15859 unsafe { o.contents.result = core::ptr::null_mut() };
15860 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
15862 let err = unsafe { o.contents.err };
15863 unsafe { o.contents.err = core::ptr::null_mut(); }
15864 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
15868 result_ok: o.result_ok,
15872 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
15873 fn clone(&self) -> Self {
15874 if self.result_ok {
15875 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15876 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
15879 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15880 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15886 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15887 /// but with all dynamically-allocated buffers duplicated in new buffers.
15888 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
15890 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
15891 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15892 /// A pointer to the contents in the success state.
15893 /// Reading from this pointer when `result_ok` is not set is undefined.
15894 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
15895 /// A pointer to the contents in the error state.
15896 /// Reading from this pointer when `result_ok` is set is undefined.
15897 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15900 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
15901 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
15902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15903 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15904 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
15905 /// `err` or `result` depending on the state of `result_ok`.
15906 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
15907 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
15908 pub result_ok: bool,
15911 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
15912 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15913 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15914 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15915 result: Box::into_raw(Box::new(o)),
15921 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15922 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15923 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15924 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15925 err: Box::into_raw(Box::new(e)),
15930 /// Checks if the given object is currently in the success state
15932 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
15936 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15937 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
15938 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15939 fn drop(&mut self) {
15940 if self.result_ok {
15941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15942 let _ = unsafe { Box::from_raw(self.contents.result) };
15945 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15946 let _ = unsafe { Box::from_raw(self.contents.err) };
15951 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15952 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15953 let contents = if o.result_ok {
15954 let result = unsafe { o.contents.result };
15955 unsafe { o.contents.result = core::ptr::null_mut() };
15956 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15958 let err = unsafe { o.contents.err };
15959 unsafe { o.contents.err = core::ptr::null_mut(); }
15960 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15964 result_ok: o.result_ok,
15968 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15969 fn clone(&self) -> Self {
15970 if self.result_ok {
15971 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15972 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15975 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15976 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15982 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15983 /// but with all dynamically-allocated buffers duplicated in new buffers.
15984 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15986 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15987 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15988 /// A pointer to the contents in the success state.
15989 /// Reading from this pointer when `result_ok` is not set is undefined.
15990 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15991 /// A pointer to the contents in the error state.
15992 /// Reading from this pointer when `result_ok` is set is undefined.
15993 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15996 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15997 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15999 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16000 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16001 /// `err` or `result` depending on the state of `result_ok`.
16002 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16003 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16004 pub result_ok: bool,
16007 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16008 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16009 CResult_QueryChannelRangeDecodeErrorZ {
16010 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16011 result: Box::into_raw(Box::new(o)),
16017 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16018 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16019 CResult_QueryChannelRangeDecodeErrorZ {
16020 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16021 err: Box::into_raw(Box::new(e)),
16026 /// Checks if the given object is currently in the success state
16028 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16032 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16033 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16034 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16035 fn drop(&mut self) {
16036 if self.result_ok {
16037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16038 let _ = unsafe { Box::from_raw(self.contents.result) };
16041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16042 let _ = unsafe { Box::from_raw(self.contents.err) };
16047 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16048 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16049 let contents = if o.result_ok {
16050 let result = unsafe { o.contents.result };
16051 unsafe { o.contents.result = core::ptr::null_mut() };
16052 CResult_QueryChannelRangeDecodeErrorZPtr { result }
16054 let err = unsafe { o.contents.err };
16055 unsafe { o.contents.err = core::ptr::null_mut(); }
16056 CResult_QueryChannelRangeDecodeErrorZPtr { err }
16060 result_ok: o.result_ok,
16064 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16065 fn clone(&self) -> Self {
16066 if self.result_ok {
16067 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16068 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16071 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16072 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16078 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16079 /// but with all dynamically-allocated buffers duplicated in new buffers.
16080 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16082 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16083 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16084 /// A pointer to the contents in the success state.
16085 /// Reading from this pointer when `result_ok` is not set is undefined.
16086 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16087 /// A pointer to the contents in the error state.
16088 /// Reading from this pointer when `result_ok` is set is undefined.
16089 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16092 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16093 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16095 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16096 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16097 /// `err` or `result` depending on the state of `result_ok`.
16098 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16099 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16100 pub result_ok: bool,
16103 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16104 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16105 CResult_ReplyChannelRangeDecodeErrorZ {
16106 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16107 result: Box::into_raw(Box::new(o)),
16113 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16114 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16115 CResult_ReplyChannelRangeDecodeErrorZ {
16116 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16117 err: Box::into_raw(Box::new(e)),
16122 /// Checks if the given object is currently in the success state
16124 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16128 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16129 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16130 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16131 fn drop(&mut self) {
16132 if self.result_ok {
16133 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16134 let _ = unsafe { Box::from_raw(self.contents.result) };
16137 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16138 let _ = unsafe { Box::from_raw(self.contents.err) };
16143 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16144 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16145 let contents = if o.result_ok {
16146 let result = unsafe { o.contents.result };
16147 unsafe { o.contents.result = core::ptr::null_mut() };
16148 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16150 let err = unsafe { o.contents.err };
16151 unsafe { o.contents.err = core::ptr::null_mut(); }
16152 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16156 result_ok: o.result_ok,
16160 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16161 fn clone(&self) -> Self {
16162 if self.result_ok {
16163 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16164 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16167 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16168 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16174 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16175 /// but with all dynamically-allocated buffers duplicated in new buffers.
16176 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16178 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16179 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16180 /// A pointer to the contents in the success state.
16181 /// Reading from this pointer when `result_ok` is not set is undefined.
16182 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16183 /// A pointer to the contents in the error state.
16184 /// Reading from this pointer when `result_ok` is set is undefined.
16185 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16188 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16189 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16191 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16192 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16193 /// `err` or `result` depending on the state of `result_ok`.
16194 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16195 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16196 pub result_ok: bool,
16199 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16200 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16201 CResult_GossipTimestampFilterDecodeErrorZ {
16202 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16203 result: Box::into_raw(Box::new(o)),
16209 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16210 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16211 CResult_GossipTimestampFilterDecodeErrorZ {
16212 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16213 err: Box::into_raw(Box::new(e)),
16218 /// Checks if the given object is currently in the success state
16220 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16224 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16225 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16226 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16227 fn drop(&mut self) {
16228 if self.result_ok {
16229 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16230 let _ = unsafe { Box::from_raw(self.contents.result) };
16233 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16234 let _ = unsafe { Box::from_raw(self.contents.err) };
16239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16240 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16241 let contents = if o.result_ok {
16242 let result = unsafe { o.contents.result };
16243 unsafe { o.contents.result = core::ptr::null_mut() };
16244 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16246 let err = unsafe { o.contents.err };
16247 unsafe { o.contents.err = core::ptr::null_mut(); }
16248 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16252 result_ok: o.result_ok,
16256 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
16257 fn clone(&self) -> Self {
16258 if self.result_ok {
16259 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16260 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
16263 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16264 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16270 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16271 /// but with all dynamically-allocated buffers duplicated in new buffers.
16272 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
16274 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16275 /// This corresponds to std::vector in C++
16276 pub struct CVec_PhantomRouteHintsZ {
16277 /// The elements in the array.
16278 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16279 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
16280 /// The number of elements pointed to by `data`.
16283 impl CVec_PhantomRouteHintsZ {
16284 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
16285 if self.datalen == 0 { return Vec::new(); }
16286 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16287 self.data = core::ptr::null_mut();
16291 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
16292 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16295 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
16296 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
16297 let datalen = v.len();
16298 let data = Box::into_raw(v.into_boxed_slice());
16299 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16303 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16304 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
16305 impl Drop for CVec_PhantomRouteHintsZ {
16306 fn drop(&mut self) {
16307 if self.datalen == 0 { return; }
16308 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16311 impl Clone for CVec_PhantomRouteHintsZ {
16312 fn clone(&self) -> Self {
16313 let mut res = Vec::new();
16314 if self.datalen == 0 { return Self::from(res); }
16315 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16320 /// The contents of CResult_InvoiceSignOrCreationErrorZ
16321 pub union CResult_InvoiceSignOrCreationErrorZPtr {
16322 /// A pointer to the contents in the success state.
16323 /// Reading from this pointer when `result_ok` is not set is undefined.
16324 pub result: *mut crate::lightning_invoice::Invoice,
16325 /// A pointer to the contents in the error state.
16326 /// Reading from this pointer when `result_ok` is set is undefined.
16327 pub err: *mut crate::lightning_invoice::SignOrCreationError,
16330 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16331 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16332 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16333 pub struct CResult_InvoiceSignOrCreationErrorZ {
16334 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
16335 /// `err` or `result` depending on the state of `result_ok`.
16336 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
16337 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
16338 pub result_ok: bool,
16341 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16342 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
16343 CResult_InvoiceSignOrCreationErrorZ {
16344 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16345 result: Box::into_raw(Box::new(o)),
16351 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16352 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
16353 CResult_InvoiceSignOrCreationErrorZ {
16354 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16355 err: Box::into_raw(Box::new(e)),
16360 /// Checks if the given object is currently in the success state
16362 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
16366 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16367 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
16368 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
16369 fn drop(&mut self) {
16370 if self.result_ok {
16371 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16372 let _ = unsafe { Box::from_raw(self.contents.result) };
16375 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16376 let _ = unsafe { Box::from_raw(self.contents.err) };
16381 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
16382 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
16383 let contents = if o.result_ok {
16384 let result = unsafe { o.contents.result };
16385 unsafe { o.contents.result = core::ptr::null_mut() };
16386 CResult_InvoiceSignOrCreationErrorZPtr { result }
16388 let err = unsafe { o.contents.err };
16389 unsafe { o.contents.err = core::ptr::null_mut(); }
16390 CResult_InvoiceSignOrCreationErrorZPtr { err }
16394 result_ok: o.result_ok,
16398 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
16399 fn clone(&self) -> Self {
16400 if self.result_ok {
16401 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16402 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
16405 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16406 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
16412 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16413 /// but with all dynamically-allocated buffers duplicated in new buffers.
16414 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
16416 /// An enum which can either contain a crate::lightning::chain::Filter or not
16417 pub enum COption_FilterZ {
16418 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
16419 Some(crate::lightning::chain::Filter),
16420 /// When we're in this state, this COption_FilterZ contains nothing
16423 impl COption_FilterZ {
16424 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
16425 if let Self::None = self { false } else { true }
16427 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
16430 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
16431 if let Self::Some(v) = self { v } else { unreachable!() }
16435 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16436 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
16437 COption_FilterZ::Some(o)
16440 /// Constructs a new COption_FilterZ containing nothing
16441 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
16442 COption_FilterZ::None
16445 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16446 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
16448 /// The contents of CResult_LockedChannelMonitorNoneZ
16449 pub union CResult_LockedChannelMonitorNoneZPtr {
16450 /// A pointer to the contents in the success state.
16451 /// Reading from this pointer when `result_ok` is not set is undefined.
16452 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
16453 /// Note that this value is always NULL, as there are no contents in the Err variant
16454 pub err: *mut core::ffi::c_void,
16457 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
16458 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
16459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16460 pub struct CResult_LockedChannelMonitorNoneZ {
16461 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
16462 /// `err` or `result` depending on the state of `result_ok`.
16463 pub contents: CResult_LockedChannelMonitorNoneZPtr,
16464 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
16465 pub result_ok: bool,
16468 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16469 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
16470 CResult_LockedChannelMonitorNoneZ {
16471 contents: CResult_LockedChannelMonitorNoneZPtr {
16472 result: Box::into_raw(Box::new(o)),
16478 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16479 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
16480 CResult_LockedChannelMonitorNoneZ {
16481 contents: CResult_LockedChannelMonitorNoneZPtr {
16482 err: core::ptr::null_mut(),
16487 /// Checks if the given object is currently in the success state
16489 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
16493 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16494 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
16495 impl Drop for CResult_LockedChannelMonitorNoneZ {
16496 fn drop(&mut self) {
16497 if self.result_ok {
16498 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16499 let _ = unsafe { Box::from_raw(self.contents.result) };
16505 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
16506 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
16507 let contents = if o.result_ok {
16508 let result = unsafe { o.contents.result };
16509 unsafe { o.contents.result = core::ptr::null_mut() };
16510 CResult_LockedChannelMonitorNoneZPtr { result }
16512 let _ = unsafe { Box::from_raw(o.contents.err) };
16513 o.contents.err = core::ptr::null_mut();
16514 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
16518 result_ok: o.result_ok,
16523 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
16524 /// This corresponds to std::vector in C++
16525 pub struct CVec_OutPointZ {
16526 /// The elements in the array.
16527 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16528 pub data: *mut crate::lightning::chain::transaction::OutPoint,
16529 /// The number of elements pointed to by `data`.
16532 impl CVec_OutPointZ {
16533 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
16534 if self.datalen == 0 { return Vec::new(); }
16535 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16536 self.data = core::ptr::null_mut();
16540 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
16541 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16544 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
16545 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
16546 let datalen = v.len();
16547 let data = Box::into_raw(v.into_boxed_slice());
16548 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16552 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16553 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
16554 impl Drop for CVec_OutPointZ {
16555 fn drop(&mut self) {
16556 if self.datalen == 0 { return; }
16557 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16560 impl Clone for CVec_OutPointZ {
16561 fn clone(&self) -> Self {
16562 let mut res = Vec::new();
16563 if self.datalen == 0 { return Self::from(res); }
16564 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });