2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4 /// A pointer to the contents in the success state.
5 /// Reading from this pointer when `result_ok` is not set is undefined.
6 pub result: *mut crate::c_types::SecretKey,
7 /// A pointer to the contents in the error state.
8 /// Reading from this pointer when `result_ok` is set is undefined.
9 pub err: *mut crate::c_types::Secp256k1Error,
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17 /// `err` or `result` depending on the state of `result_ok`.
18 pub contents: CResult_SecretKeyErrorZPtr,
19 /// Whether this CResult_SecretKeyErrorZ represents a success state.
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25 CResult_SecretKeyErrorZ {
26 contents: CResult_SecretKeyErrorZPtr {
27 result: Box::into_raw(Box::new(o)),
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35 CResult_SecretKeyErrorZ {
36 contents: CResult_SecretKeyErrorZPtr {
37 err: Box::into_raw(Box::new(e)),
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
48 if unsafe { !(self.contents.result as *mut ()).is_null() } {
49 let _ = unsafe { Box::from_raw(self.contents.result) };
52 if unsafe { !(self.contents.err as *mut ()).is_null() } {
53 let _ = unsafe { Box::from_raw(self.contents.err) };
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60 let contents = if o.result_ok {
61 let result = unsafe { o.contents.result };
62 unsafe { o.contents.result = std::ptr::null_mut() };
63 CResult_SecretKeyErrorZPtr { result }
65 let err = unsafe { o.contents.err };
66 unsafe { o.contents.err = std::ptr::null_mut(); }
67 CResult_SecretKeyErrorZPtr { err }
71 result_ok: o.result_ok,
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78 /// A pointer to the contents in the success state.
79 /// Reading from this pointer when `result_ok` is not set is undefined.
80 pub result: *mut crate::c_types::PublicKey,
81 /// A pointer to the contents in the error state.
82 /// Reading from this pointer when `result_ok` is set is undefined.
83 pub err: *mut crate::c_types::Secp256k1Error,
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91 /// `err` or `result` depending on the state of `result_ok`.
92 pub contents: CResult_PublicKeyErrorZPtr,
93 /// Whether this CResult_PublicKeyErrorZ represents a success state.
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99 CResult_PublicKeyErrorZ {
100 contents: CResult_PublicKeyErrorZPtr {
101 result: Box::into_raw(Box::new(o)),
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109 CResult_PublicKeyErrorZ {
110 contents: CResult_PublicKeyErrorZPtr {
111 err: Box::into_raw(Box::new(e)),
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
123 let _ = unsafe { Box::from_raw(self.contents.result) };
126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
127 let _ = unsafe { Box::from_raw(self.contents.err) };
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134 let contents = if o.result_ok {
135 let result = unsafe { o.contents.result };
136 unsafe { o.contents.result = std::ptr::null_mut() };
137 CResult_PublicKeyErrorZPtr { result }
139 let err = unsafe { o.contents.err };
140 unsafe { o.contents.err = std::ptr::null_mut(); }
141 CResult_PublicKeyErrorZPtr { err }
145 result_ok: o.result_ok,
149 impl Clone for CResult_PublicKeyErrorZ {
150 fn clone(&self) -> Self {
152 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
153 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
156 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
157 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
163 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
164 /// but with all dynamically-allocated buffers duplicated in new buffers.
165 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { orig.clone() }
167 /// The contents of CResult_TxCreationKeysDecodeErrorZ
168 pub union CResult_TxCreationKeysDecodeErrorZPtr {
169 /// A pointer to the contents in the success state.
170 /// Reading from this pointer when `result_ok` is not set is undefined.
171 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
172 /// A pointer to the contents in the error state.
173 /// Reading from this pointer when `result_ok` is set is undefined.
174 pub err: *mut crate::lightning::ln::msgs::DecodeError,
177 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
178 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
180 pub struct CResult_TxCreationKeysDecodeErrorZ {
181 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
182 /// `err` or `result` depending on the state of `result_ok`.
183 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
184 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
188 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
189 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
190 CResult_TxCreationKeysDecodeErrorZ {
191 contents: CResult_TxCreationKeysDecodeErrorZPtr {
192 result: Box::into_raw(Box::new(o)),
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
200 CResult_TxCreationKeysDecodeErrorZ {
201 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202 err: Box::into_raw(Box::new(e)),
208 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
210 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
214 let _ = unsafe { Box::from_raw(self.contents.result) };
217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
218 let _ = unsafe { Box::from_raw(self.contents.err) };
223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
225 let contents = if o.result_ok {
226 let result = unsafe { o.contents.result };
227 unsafe { o.contents.result = std::ptr::null_mut() };
228 CResult_TxCreationKeysDecodeErrorZPtr { result }
230 let err = unsafe { o.contents.err };
231 unsafe { o.contents.err = std::ptr::null_mut(); }
232 CResult_TxCreationKeysDecodeErrorZPtr { err }
236 result_ok: o.result_ok,
240 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
241 fn clone(&self) -> Self {
243 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
244 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
247 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
254 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
255 /// but with all dynamically-allocated buffers duplicated in new buffers.
256 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { orig.clone() }
258 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
259 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
260 /// A pointer to the contents in the success state.
261 /// Reading from this pointer when `result_ok` is not set is undefined.
262 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
263 /// A pointer to the contents in the error state.
264 /// Reading from this pointer when `result_ok` is set is undefined.
265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
268 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
269 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
272 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
273 /// `err` or `result` depending on the state of `result_ok`.
274 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
275 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
279 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
280 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
281 CResult_ChannelPublicKeysDecodeErrorZ {
282 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
283 result: Box::into_raw(Box::new(o)),
289 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
290 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
291 CResult_ChannelPublicKeysDecodeErrorZ {
292 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
293 err: Box::into_raw(Box::new(e)),
299 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
300 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
301 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
305 let _ = unsafe { Box::from_raw(self.contents.result) };
308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
309 let _ = unsafe { Box::from_raw(self.contents.err) };
314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
315 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
316 let contents = if o.result_ok {
317 let result = unsafe { o.contents.result };
318 unsafe { o.contents.result = std::ptr::null_mut() };
319 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
321 let err = unsafe { o.contents.err };
322 unsafe { o.contents.err = std::ptr::null_mut(); }
323 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
327 result_ok: o.result_ok,
331 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
332 fn clone(&self) -> Self {
334 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
335 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
338 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
345 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
346 /// but with all dynamically-allocated buffers duplicated in new buffers.
347 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { orig.clone() }
349 /// The contents of CResult_TxCreationKeysErrorZ
350 pub union CResult_TxCreationKeysErrorZPtr {
351 /// A pointer to the contents in the success state.
352 /// Reading from this pointer when `result_ok` is not set is undefined.
353 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
354 /// A pointer to the contents in the error state.
355 /// Reading from this pointer when `result_ok` is set is undefined.
356 pub err: *mut crate::c_types::Secp256k1Error,
359 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
360 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
362 pub struct CResult_TxCreationKeysErrorZ {
363 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
364 /// `err` or `result` depending on the state of `result_ok`.
365 pub contents: CResult_TxCreationKeysErrorZPtr,
366 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
370 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
371 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
372 CResult_TxCreationKeysErrorZ {
373 contents: CResult_TxCreationKeysErrorZPtr {
374 result: Box::into_raw(Box::new(o)),
380 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
381 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
382 CResult_TxCreationKeysErrorZ {
383 contents: CResult_TxCreationKeysErrorZPtr {
384 err: Box::into_raw(Box::new(e)),
390 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
392 impl Drop for CResult_TxCreationKeysErrorZ {
395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
396 let _ = unsafe { Box::from_raw(self.contents.result) };
399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
400 let _ = unsafe { Box::from_raw(self.contents.err) };
405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
407 let contents = if o.result_ok {
408 let result = unsafe { o.contents.result };
409 unsafe { o.contents.result = std::ptr::null_mut() };
410 CResult_TxCreationKeysErrorZPtr { result }
412 let err = unsafe { o.contents.err };
413 unsafe { o.contents.err = std::ptr::null_mut(); }
414 CResult_TxCreationKeysErrorZPtr { err }
418 result_ok: o.result_ok,
422 impl Clone for CResult_TxCreationKeysErrorZ {
423 fn clone(&self) -> Self {
425 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
426 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
429 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
430 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
436 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
437 /// but with all dynamically-allocated buffers duplicated in new buffers.
438 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { orig.clone() }
441 /// An enum which can either contain a u32 or not
442 pub enum COption_u32Z {
443 /// When we're in this state, this COption_u32Z contains a u32
445 /// When we're in this state, this COption_u32Z contains nothing
449 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
450 if let Self::Some(_) = self { true } else { false }
452 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
453 if let Self::Some(v) = self { v } else { unreachable!() }
457 /// Constructs a new COption_u32Z containing a u32
458 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
459 COption_u32Z::Some(o)
462 /// Constructs a new COption_u32Z containing nothing
463 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
467 /// Frees any resources associated with the u32, if we are in the Some state
468 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
470 /// Creates a new COption_u32Z which has the same data as `orig`
471 /// but with all dynamically-allocated buffers duplicated in new buffers.
472 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { orig.clone() }
474 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
475 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
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::lightning::ln::chan_utils::HTLCOutputInCommitment,
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::lightning::ln::msgs::DecodeError,
484 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
485 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
487 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
488 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
489 /// `err` or `result` depending on the state of `result_ok`.
490 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
491 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
495 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
496 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
497 CResult_HTLCOutputInCommitmentDecodeErrorZ {
498 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
499 result: Box::into_raw(Box::new(o)),
505 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
506 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
507 CResult_HTLCOutputInCommitmentDecodeErrorZ {
508 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
509 err: Box::into_raw(Box::new(e)),
515 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
516 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
517 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
521 let _ = unsafe { Box::from_raw(self.contents.result) };
524 if unsafe { !(self.contents.err as *mut ()).is_null() } {
525 let _ = unsafe { Box::from_raw(self.contents.err) };
530 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
531 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
532 let contents = if o.result_ok {
533 let result = unsafe { o.contents.result };
534 unsafe { o.contents.result = std::ptr::null_mut() };
535 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
537 let err = unsafe { o.contents.err };
538 unsafe { o.contents.err = std::ptr::null_mut(); }
539 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
543 result_ok: o.result_ok,
547 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
548 fn clone(&self) -> Self {
550 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
551 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
554 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
555 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
561 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
562 /// but with all dynamically-allocated buffers duplicated in new buffers.
563 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
565 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
566 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
567 /// A pointer to the contents in the success state.
568 /// Reading from this pointer when `result_ok` is not set is undefined.
569 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
570 /// A pointer to the contents in the error state.
571 /// Reading from this pointer when `result_ok` is set is undefined.
572 pub err: *mut crate::lightning::ln::msgs::DecodeError,
575 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
576 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
578 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
579 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
580 /// `err` or `result` depending on the state of `result_ok`.
581 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
582 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
586 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
587 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
588 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
589 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
590 result: Box::into_raw(Box::new(o)),
596 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
597 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
598 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
599 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
600 err: Box::into_raw(Box::new(e)),
606 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
607 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
608 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
611 if unsafe { !(self.contents.result as *mut ()).is_null() } {
612 let _ = unsafe { Box::from_raw(self.contents.result) };
615 if unsafe { !(self.contents.err as *mut ()).is_null() } {
616 let _ = unsafe { Box::from_raw(self.contents.err) };
621 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
622 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
623 let contents = if o.result_ok {
624 let result = unsafe { o.contents.result };
625 unsafe { o.contents.result = std::ptr::null_mut() };
626 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
628 let err = unsafe { o.contents.err };
629 unsafe { o.contents.err = std::ptr::null_mut(); }
630 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
634 result_ok: o.result_ok,
638 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
639 fn clone(&self) -> Self {
641 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
642 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
645 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
646 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
652 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
653 /// but with all dynamically-allocated buffers duplicated in new buffers.
654 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
656 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
657 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
658 /// A pointer to the contents in the success state.
659 /// Reading from this pointer when `result_ok` is not set is undefined.
660 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
661 /// A pointer to the contents in the error state.
662 /// Reading from this pointer when `result_ok` is set is undefined.
663 pub err: *mut crate::lightning::ln::msgs::DecodeError,
666 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
667 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
669 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
670 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
671 /// `err` or `result` depending on the state of `result_ok`.
672 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
673 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
677 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
678 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
679 CResult_ChannelTransactionParametersDecodeErrorZ {
680 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
681 result: Box::into_raw(Box::new(o)),
687 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
688 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
689 CResult_ChannelTransactionParametersDecodeErrorZ {
690 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
691 err: Box::into_raw(Box::new(e)),
697 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
698 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
699 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
703 let _ = unsafe { Box::from_raw(self.contents.result) };
706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
707 let _ = unsafe { Box::from_raw(self.contents.err) };
712 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
713 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
714 let contents = if o.result_ok {
715 let result = unsafe { o.contents.result };
716 unsafe { o.contents.result = std::ptr::null_mut() };
717 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
719 let err = unsafe { o.contents.err };
720 unsafe { o.contents.err = std::ptr::null_mut(); }
721 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
725 result_ok: o.result_ok,
729 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
730 fn clone(&self) -> Self {
732 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
733 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
736 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
737 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
743 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
744 /// but with all dynamically-allocated buffers duplicated in new buffers.
745 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
747 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
748 /// This corresponds to std::vector in C++
749 pub struct CVec_SignatureZ {
750 /// The elements in the array.
751 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
752 pub data: *mut crate::c_types::Signature,
753 /// The number of elements pointed to by `data`.
756 impl CVec_SignatureZ {
757 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
758 if self.datalen == 0 { return Vec::new(); }
759 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
760 self.data = std::ptr::null_mut();
764 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
765 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
768 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
769 fn from(v: Vec<crate::c_types::Signature>) -> Self {
770 let datalen = v.len();
771 let data = Box::into_raw(v.into_boxed_slice());
772 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
776 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
777 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
778 impl Drop for CVec_SignatureZ {
780 if self.datalen == 0 { return; }
781 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
784 impl Clone for CVec_SignatureZ {
785 fn clone(&self) -> Self {
786 let mut res = Vec::new();
787 if self.datalen == 0 { return Self::from(res); }
788 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
793 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
794 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
795 /// A pointer to the contents in the success state.
796 /// Reading from this pointer when `result_ok` is not set is undefined.
797 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
798 /// A pointer to the contents in the error state.
799 /// Reading from this pointer when `result_ok` is set is undefined.
800 pub err: *mut crate::lightning::ln::msgs::DecodeError,
803 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
804 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
806 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
807 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
808 /// `err` or `result` depending on the state of `result_ok`.
809 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
810 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
814 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
815 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
816 CResult_HolderCommitmentTransactionDecodeErrorZ {
817 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
818 result: Box::into_raw(Box::new(o)),
824 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
825 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
826 CResult_HolderCommitmentTransactionDecodeErrorZ {
827 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
828 err: Box::into_raw(Box::new(e)),
834 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
835 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
836 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
839 if unsafe { !(self.contents.result as *mut ()).is_null() } {
840 let _ = unsafe { Box::from_raw(self.contents.result) };
843 if unsafe { !(self.contents.err as *mut ()).is_null() } {
844 let _ = unsafe { Box::from_raw(self.contents.err) };
849 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
850 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
851 let contents = if o.result_ok {
852 let result = unsafe { o.contents.result };
853 unsafe { o.contents.result = std::ptr::null_mut() };
854 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
856 let err = unsafe { o.contents.err };
857 unsafe { o.contents.err = std::ptr::null_mut(); }
858 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
862 result_ok: o.result_ok,
866 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
867 fn clone(&self) -> Self {
869 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
870 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
873 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
874 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
880 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
881 /// but with all dynamically-allocated buffers duplicated in new buffers.
882 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
884 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
885 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
886 /// A pointer to the contents in the success state.
887 /// Reading from this pointer when `result_ok` is not set is undefined.
888 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
889 /// A pointer to the contents in the error state.
890 /// Reading from this pointer when `result_ok` is set is undefined.
891 pub err: *mut crate::lightning::ln::msgs::DecodeError,
894 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
895 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
897 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
898 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
899 /// `err` or `result` depending on the state of `result_ok`.
900 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
901 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
905 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
906 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
907 CResult_BuiltCommitmentTransactionDecodeErrorZ {
908 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
909 result: Box::into_raw(Box::new(o)),
915 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
916 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
917 CResult_BuiltCommitmentTransactionDecodeErrorZ {
918 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
919 err: Box::into_raw(Box::new(e)),
925 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
926 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
927 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
930 if unsafe { !(self.contents.result as *mut ()).is_null() } {
931 let _ = unsafe { Box::from_raw(self.contents.result) };
934 if unsafe { !(self.contents.err as *mut ()).is_null() } {
935 let _ = unsafe { Box::from_raw(self.contents.err) };
940 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
941 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
942 let contents = if o.result_ok {
943 let result = unsafe { o.contents.result };
944 unsafe { o.contents.result = std::ptr::null_mut() };
945 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
947 let err = unsafe { o.contents.err };
948 unsafe { o.contents.err = std::ptr::null_mut(); }
949 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
953 result_ok: o.result_ok,
957 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
958 fn clone(&self) -> Self {
960 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
961 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
964 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
965 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
971 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
972 /// but with all dynamically-allocated buffers duplicated in new buffers.
973 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
975 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
976 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
977 /// A pointer to the contents in the success state.
978 /// Reading from this pointer when `result_ok` is not set is undefined.
979 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
980 /// A pointer to the contents in the error state.
981 /// Reading from this pointer when `result_ok` is set is undefined.
982 pub err: *mut crate::lightning::ln::msgs::DecodeError,
985 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
986 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
988 pub struct CResult_CommitmentTransactionDecodeErrorZ {
989 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
990 /// `err` or `result` depending on the state of `result_ok`.
991 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
992 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
996 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
997 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
998 CResult_CommitmentTransactionDecodeErrorZ {
999 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1000 result: Box::into_raw(Box::new(o)),
1006 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1007 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1008 CResult_CommitmentTransactionDecodeErrorZ {
1009 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1010 err: Box::into_raw(Box::new(e)),
1016 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1017 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1018 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1019 fn drop(&mut self) {
1021 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1022 let _ = unsafe { Box::from_raw(self.contents.result) };
1025 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1026 let _ = unsafe { Box::from_raw(self.contents.err) };
1031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1032 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1033 let contents = if o.result_ok {
1034 let result = unsafe { o.contents.result };
1035 unsafe { o.contents.result = std::ptr::null_mut() };
1036 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1038 let err = unsafe { o.contents.err };
1039 unsafe { o.contents.err = std::ptr::null_mut(); }
1040 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1044 result_ok: o.result_ok,
1048 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1049 fn clone(&self) -> Self {
1051 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1052 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1055 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1056 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1062 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1063 /// but with all dynamically-allocated buffers duplicated in new buffers.
1064 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
1066 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1067 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1068 /// A pointer to the contents in the success state.
1069 /// Reading from this pointer when `result_ok` is not set is undefined.
1070 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1071 /// Note that this value is always NULL, as there are no contents in the Err variant
1072 pub err: *mut std::ffi::c_void,
1075 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1076 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1078 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1079 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1080 /// `err` or `result` depending on the state of `result_ok`.
1081 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1082 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1083 pub result_ok: bool,
1086 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1087 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1088 CResult_TrustedCommitmentTransactionNoneZ {
1089 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1090 result: Box::into_raw(Box::new(o)),
1096 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1097 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1098 CResult_TrustedCommitmentTransactionNoneZ {
1099 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1100 err: std::ptr::null_mut(),
1106 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1107 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1108 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1109 fn drop(&mut self) {
1111 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1112 let _ = unsafe { Box::from_raw(self.contents.result) };
1118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1119 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1120 let contents = if o.result_ok {
1121 let result = unsafe { o.contents.result };
1122 unsafe { o.contents.result = std::ptr::null_mut() };
1123 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1125 let _ = unsafe { Box::from_raw(o.contents.err) };
1126 o.contents.err = std::ptr::null_mut();
1127 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1131 result_ok: o.result_ok,
1136 /// The contents of CResult_CVec_SignatureZNoneZ
1137 pub union CResult_CVec_SignatureZNoneZPtr {
1138 /// A pointer to the contents in the success state.
1139 /// Reading from this pointer when `result_ok` is not set is undefined.
1140 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1141 /// Note that this value is always NULL, as there are no contents in the Err variant
1142 pub err: *mut std::ffi::c_void,
1145 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1146 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1148 pub struct CResult_CVec_SignatureZNoneZ {
1149 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1150 /// `err` or `result` depending on the state of `result_ok`.
1151 pub contents: CResult_CVec_SignatureZNoneZPtr,
1152 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1153 pub result_ok: bool,
1156 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1157 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1158 CResult_CVec_SignatureZNoneZ {
1159 contents: CResult_CVec_SignatureZNoneZPtr {
1160 result: Box::into_raw(Box::new(o)),
1166 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1167 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1168 CResult_CVec_SignatureZNoneZ {
1169 contents: CResult_CVec_SignatureZNoneZPtr {
1170 err: std::ptr::null_mut(),
1176 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1177 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1178 impl Drop for CResult_CVec_SignatureZNoneZ {
1179 fn drop(&mut self) {
1181 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1182 let _ = unsafe { Box::from_raw(self.contents.result) };
1188 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1189 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1190 let contents = if o.result_ok {
1191 let result = unsafe { o.contents.result };
1192 unsafe { o.contents.result = std::ptr::null_mut() };
1193 CResult_CVec_SignatureZNoneZPtr { result }
1195 let _ = unsafe { Box::from_raw(o.contents.err) };
1196 o.contents.err = std::ptr::null_mut();
1197 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1201 result_ok: o.result_ok,
1205 impl Clone for CResult_CVec_SignatureZNoneZ {
1206 fn clone(&self) -> Self {
1208 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1209 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1212 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1213 err: std::ptr::null_mut()
1219 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1220 /// but with all dynamically-allocated buffers duplicated in new buffers.
1221 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
1223 /// The contents of CResult_NoneErrorZ
1224 pub union CResult_NoneErrorZPtr {
1225 /// Note that this value is always NULL, as there are no contents in the OK variant
1226 pub result: *mut std::ffi::c_void,
1227 /// A pointer to the contents in the error state.
1228 /// Reading from this pointer when `result_ok` is set is undefined.
1229 pub err: *mut crate::c_types::IOError,
1232 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1233 /// containing a () on success and a crate::c_types::IOError on failure.
1234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1235 pub struct CResult_NoneErrorZ {
1236 /// The contents of this CResult_NoneErrorZ, accessible via either
1237 /// `err` or `result` depending on the state of `result_ok`.
1238 pub contents: CResult_NoneErrorZPtr,
1239 /// Whether this CResult_NoneErrorZ represents a success state.
1240 pub result_ok: bool,
1243 /// Creates a new CResult_NoneErrorZ in the success state.
1244 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1245 CResult_NoneErrorZ {
1246 contents: CResult_NoneErrorZPtr {
1247 result: std::ptr::null_mut(),
1253 /// Creates a new CResult_NoneErrorZ in the error state.
1254 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1255 CResult_NoneErrorZ {
1256 contents: CResult_NoneErrorZPtr {
1257 err: Box::into_raw(Box::new(e)),
1263 /// Frees any resources used by the CResult_NoneErrorZ.
1264 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1265 impl Drop for CResult_NoneErrorZ {
1266 fn drop(&mut self) {
1269 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1270 let _ = unsafe { Box::from_raw(self.contents.err) };
1275 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1276 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1277 let contents = if o.result_ok {
1278 let _ = unsafe { Box::from_raw(o.contents.result) };
1279 o.contents.result = std::ptr::null_mut();
1280 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1282 let err = unsafe { o.contents.err };
1283 unsafe { o.contents.err = std::ptr::null_mut(); }
1284 CResult_NoneErrorZPtr { err }
1288 result_ok: o.result_ok,
1292 impl Clone for CResult_NoneErrorZ {
1293 fn clone(&self) -> Self {
1295 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1296 result: std::ptr::null_mut()
1299 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1300 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1306 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1307 /// but with all dynamically-allocated buffers duplicated in new buffers.
1308 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { orig.clone() }
1310 /// The contents of CResult_RouteHopDecodeErrorZ
1311 pub union CResult_RouteHopDecodeErrorZPtr {
1312 /// A pointer to the contents in the success state.
1313 /// Reading from this pointer when `result_ok` is not set is undefined.
1314 pub result: *mut crate::lightning::routing::router::RouteHop,
1315 /// A pointer to the contents in the error state.
1316 /// Reading from this pointer when `result_ok` is set is undefined.
1317 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1320 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1321 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1322 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1323 pub struct CResult_RouteHopDecodeErrorZ {
1324 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1325 /// `err` or `result` depending on the state of `result_ok`.
1326 pub contents: CResult_RouteHopDecodeErrorZPtr,
1327 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1328 pub result_ok: bool,
1331 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1332 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1333 CResult_RouteHopDecodeErrorZ {
1334 contents: CResult_RouteHopDecodeErrorZPtr {
1335 result: Box::into_raw(Box::new(o)),
1341 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1342 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1343 CResult_RouteHopDecodeErrorZ {
1344 contents: CResult_RouteHopDecodeErrorZPtr {
1345 err: Box::into_raw(Box::new(e)),
1351 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1352 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1353 impl Drop for CResult_RouteHopDecodeErrorZ {
1354 fn drop(&mut self) {
1356 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1357 let _ = unsafe { Box::from_raw(self.contents.result) };
1360 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1361 let _ = unsafe { Box::from_raw(self.contents.err) };
1366 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1367 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1368 let contents = if o.result_ok {
1369 let result = unsafe { o.contents.result };
1370 unsafe { o.contents.result = std::ptr::null_mut() };
1371 CResult_RouteHopDecodeErrorZPtr { result }
1373 let err = unsafe { o.contents.err };
1374 unsafe { o.contents.err = std::ptr::null_mut(); }
1375 CResult_RouteHopDecodeErrorZPtr { err }
1379 result_ok: o.result_ok,
1383 impl Clone for CResult_RouteHopDecodeErrorZ {
1384 fn clone(&self) -> Self {
1386 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1387 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1390 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1391 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1397 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1398 /// but with all dynamically-allocated buffers duplicated in new buffers.
1399 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { orig.clone() }
1401 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1402 /// This corresponds to std::vector in C++
1403 pub struct CVec_RouteHopZ {
1404 /// The elements in the array.
1405 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1406 pub data: *mut crate::lightning::routing::router::RouteHop,
1407 /// The number of elements pointed to by `data`.
1410 impl CVec_RouteHopZ {
1411 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1412 if self.datalen == 0 { return Vec::new(); }
1413 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1414 self.data = std::ptr::null_mut();
1418 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1419 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1422 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1423 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1424 let datalen = v.len();
1425 let data = Box::into_raw(v.into_boxed_slice());
1426 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1430 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1431 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1432 impl Drop for CVec_RouteHopZ {
1433 fn drop(&mut self) {
1434 if self.datalen == 0 { return; }
1435 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1438 impl Clone for CVec_RouteHopZ {
1439 fn clone(&self) -> Self {
1440 let mut res = Vec::new();
1441 if self.datalen == 0 { return Self::from(res); }
1442 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1447 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1448 /// This corresponds to std::vector in C++
1449 pub struct CVec_CVec_RouteHopZZ {
1450 /// The elements in the array.
1451 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1452 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1453 /// The number of elements pointed to by `data`.
1456 impl CVec_CVec_RouteHopZZ {
1457 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1458 if self.datalen == 0 { return Vec::new(); }
1459 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1460 self.data = std::ptr::null_mut();
1464 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1465 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1468 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1469 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1470 let datalen = v.len();
1471 let data = Box::into_raw(v.into_boxed_slice());
1472 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1476 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1477 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1478 impl Drop for CVec_CVec_RouteHopZZ {
1479 fn drop(&mut self) {
1480 if self.datalen == 0 { return; }
1481 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1484 impl Clone for CVec_CVec_RouteHopZZ {
1485 fn clone(&self) -> Self {
1486 let mut res = Vec::new();
1487 if self.datalen == 0 { return Self::from(res); }
1488 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1493 /// The contents of CResult_RouteDecodeErrorZ
1494 pub union CResult_RouteDecodeErrorZPtr {
1495 /// A pointer to the contents in the success state.
1496 /// Reading from this pointer when `result_ok` is not set is undefined.
1497 pub result: *mut crate::lightning::routing::router::Route,
1498 /// A pointer to the contents in the error state.
1499 /// Reading from this pointer when `result_ok` is set is undefined.
1500 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1503 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1504 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1506 pub struct CResult_RouteDecodeErrorZ {
1507 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1508 /// `err` or `result` depending on the state of `result_ok`.
1509 pub contents: CResult_RouteDecodeErrorZPtr,
1510 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1511 pub result_ok: bool,
1514 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1515 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1516 CResult_RouteDecodeErrorZ {
1517 contents: CResult_RouteDecodeErrorZPtr {
1518 result: Box::into_raw(Box::new(o)),
1524 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1525 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1526 CResult_RouteDecodeErrorZ {
1527 contents: CResult_RouteDecodeErrorZPtr {
1528 err: Box::into_raw(Box::new(e)),
1534 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1535 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1536 impl Drop for CResult_RouteDecodeErrorZ {
1537 fn drop(&mut self) {
1539 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1540 let _ = unsafe { Box::from_raw(self.contents.result) };
1543 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1544 let _ = unsafe { Box::from_raw(self.contents.err) };
1549 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1550 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1551 let contents = if o.result_ok {
1552 let result = unsafe { o.contents.result };
1553 unsafe { o.contents.result = std::ptr::null_mut() };
1554 CResult_RouteDecodeErrorZPtr { result }
1556 let err = unsafe { o.contents.err };
1557 unsafe { o.contents.err = std::ptr::null_mut(); }
1558 CResult_RouteDecodeErrorZPtr { err }
1562 result_ok: o.result_ok,
1566 impl Clone for CResult_RouteDecodeErrorZ {
1567 fn clone(&self) -> Self {
1569 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1570 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1573 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1574 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1580 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1581 /// but with all dynamically-allocated buffers duplicated in new buffers.
1582 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
1585 /// An enum which can either contain a u64 or not
1586 pub enum COption_u64Z {
1587 /// When we're in this state, this COption_u64Z contains a u64
1589 /// When we're in this state, this COption_u64Z contains nothing
1593 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1594 if let Self::Some(_) = self { true } else { false }
1596 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1597 if let Self::Some(v) = self { v } else { unreachable!() }
1601 /// Constructs a new COption_u64Z containing a u64
1602 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1603 COption_u64Z::Some(o)
1606 /// Constructs a new COption_u64Z containing nothing
1607 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1611 /// Frees any resources associated with the u64, if we are in the Some state
1612 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1614 /// Creates a new COption_u64Z which has the same data as `orig`
1615 /// but with all dynamically-allocated buffers duplicated in new buffers.
1616 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1618 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1619 /// This corresponds to std::vector in C++
1620 pub struct CVec_ChannelDetailsZ {
1621 /// The elements in the array.
1622 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1623 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
1624 /// The number of elements pointed to by `data`.
1627 impl CVec_ChannelDetailsZ {
1628 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
1629 if self.datalen == 0 { return Vec::new(); }
1630 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1631 self.data = std::ptr::null_mut();
1635 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
1636 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1639 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1640 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
1641 let datalen = v.len();
1642 let data = Box::into_raw(v.into_boxed_slice());
1643 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1647 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1648 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1649 impl Drop for CVec_ChannelDetailsZ {
1650 fn drop(&mut self) {
1651 if self.datalen == 0 { return; }
1652 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1655 impl Clone for CVec_ChannelDetailsZ {
1656 fn clone(&self) -> Self {
1657 let mut res = Vec::new();
1658 if self.datalen == 0 { return Self::from(res); }
1659 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1664 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1665 /// This corresponds to std::vector in C++
1666 pub struct CVec_RouteHintZ {
1667 /// The elements in the array.
1668 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1669 pub data: *mut crate::lightning::routing::router::RouteHint,
1670 /// The number of elements pointed to by `data`.
1673 impl CVec_RouteHintZ {
1674 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1675 if self.datalen == 0 { return Vec::new(); }
1676 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1677 self.data = std::ptr::null_mut();
1681 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1682 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1685 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1686 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1687 let datalen = v.len();
1688 let data = Box::into_raw(v.into_boxed_slice());
1689 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1693 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1694 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1695 impl Drop for CVec_RouteHintZ {
1696 fn drop(&mut self) {
1697 if self.datalen == 0 { return; }
1698 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1701 impl Clone for CVec_RouteHintZ {
1702 fn clone(&self) -> Self {
1703 let mut res = Vec::new();
1704 if self.datalen == 0 { return Self::from(res); }
1705 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1710 /// The contents of CResult_RouteLightningErrorZ
1711 pub union CResult_RouteLightningErrorZPtr {
1712 /// A pointer to the contents in the success state.
1713 /// Reading from this pointer when `result_ok` is not set is undefined.
1714 pub result: *mut crate::lightning::routing::router::Route,
1715 /// A pointer to the contents in the error state.
1716 /// Reading from this pointer when `result_ok` is set is undefined.
1717 pub err: *mut crate::lightning::ln::msgs::LightningError,
1720 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1721 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1723 pub struct CResult_RouteLightningErrorZ {
1724 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
1725 /// `err` or `result` depending on the state of `result_ok`.
1726 pub contents: CResult_RouteLightningErrorZPtr,
1727 /// Whether this CResult_RouteLightningErrorZ represents a success state.
1728 pub result_ok: bool,
1731 /// Creates a new CResult_RouteLightningErrorZ in the success state.
1732 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
1733 CResult_RouteLightningErrorZ {
1734 contents: CResult_RouteLightningErrorZPtr {
1735 result: Box::into_raw(Box::new(o)),
1741 /// Creates a new CResult_RouteLightningErrorZ in the error state.
1742 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
1743 CResult_RouteLightningErrorZ {
1744 contents: CResult_RouteLightningErrorZPtr {
1745 err: Box::into_raw(Box::new(e)),
1751 /// Frees any resources used by the CResult_RouteLightningErrorZ.
1752 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
1753 impl Drop for CResult_RouteLightningErrorZ {
1754 fn drop(&mut self) {
1756 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1757 let _ = unsafe { Box::from_raw(self.contents.result) };
1760 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1761 let _ = unsafe { Box::from_raw(self.contents.err) };
1766 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
1767 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
1768 let contents = if o.result_ok {
1769 let result = unsafe { o.contents.result };
1770 unsafe { o.contents.result = std::ptr::null_mut() };
1771 CResult_RouteLightningErrorZPtr { result }
1773 let err = unsafe { o.contents.err };
1774 unsafe { o.contents.err = std::ptr::null_mut(); }
1775 CResult_RouteLightningErrorZPtr { err }
1779 result_ok: o.result_ok,
1783 impl Clone for CResult_RouteLightningErrorZ {
1784 fn clone(&self) -> Self {
1786 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
1787 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1790 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
1791 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1797 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
1798 /// but with all dynamically-allocated buffers duplicated in new buffers.
1799 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
1801 /// The contents of CResult_TxOutAccessErrorZ
1802 pub union CResult_TxOutAccessErrorZPtr {
1803 /// A pointer to the contents in the success state.
1804 /// Reading from this pointer when `result_ok` is not set is undefined.
1805 pub result: *mut crate::c_types::TxOut,
1806 /// A pointer to the contents in the error state.
1807 /// Reading from this pointer when `result_ok` is set is undefined.
1808 pub err: *mut crate::lightning::chain::AccessError,
1811 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1812 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1814 pub struct CResult_TxOutAccessErrorZ {
1815 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
1816 /// `err` or `result` depending on the state of `result_ok`.
1817 pub contents: CResult_TxOutAccessErrorZPtr,
1818 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
1819 pub result_ok: bool,
1822 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
1823 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
1824 CResult_TxOutAccessErrorZ {
1825 contents: CResult_TxOutAccessErrorZPtr {
1826 result: Box::into_raw(Box::new(o)),
1832 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
1833 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
1834 CResult_TxOutAccessErrorZ {
1835 contents: CResult_TxOutAccessErrorZPtr {
1836 err: Box::into_raw(Box::new(e)),
1842 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
1843 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
1844 impl Drop for CResult_TxOutAccessErrorZ {
1845 fn drop(&mut self) {
1847 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1848 let _ = unsafe { Box::from_raw(self.contents.result) };
1851 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1852 let _ = unsafe { Box::from_raw(self.contents.err) };
1857 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
1858 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
1859 let contents = if o.result_ok {
1860 let result = unsafe { o.contents.result };
1861 unsafe { o.contents.result = std::ptr::null_mut() };
1862 CResult_TxOutAccessErrorZPtr { result }
1864 let err = unsafe { o.contents.err };
1865 unsafe { o.contents.err = std::ptr::null_mut(); }
1866 CResult_TxOutAccessErrorZPtr { err }
1870 result_ok: o.result_ok,
1874 impl Clone for CResult_TxOutAccessErrorZ {
1875 fn clone(&self) -> Self {
1877 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
1878 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
1881 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
1882 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
1888 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
1889 /// but with all dynamically-allocated buffers duplicated in new buffers.
1890 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
1892 /// A tuple of 2 elements. See the individual fields for the types contained.
1893 pub struct C2Tuple_usizeTransactionZ {
1894 /// The element at position 0
1896 /// The element at position 1
1897 pub b: crate::c_types::Transaction,
1899 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
1900 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
1907 impl C2Tuple_usizeTransactionZ {
1908 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
1912 impl Clone for C2Tuple_usizeTransactionZ {
1913 fn clone(&self) -> Self {
1921 /// Creates a new tuple which has the same data as `orig`
1922 /// but with all dynamically-allocated buffers duplicated in new buffers.
1923 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { orig.clone() }
1924 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
1926 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
1927 C2Tuple_usizeTransactionZ { a, b, }
1931 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
1932 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
1934 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1935 /// This corresponds to std::vector in C++
1936 pub struct CVec_C2Tuple_usizeTransactionZZ {
1937 /// The elements in the array.
1938 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1939 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
1940 /// The number of elements pointed to by `data`.
1943 impl CVec_C2Tuple_usizeTransactionZZ {
1944 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
1945 if self.datalen == 0 { return Vec::new(); }
1946 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1947 self.data = std::ptr::null_mut();
1951 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
1952 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1955 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
1956 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
1957 let datalen = v.len();
1958 let data = Box::into_raw(v.into_boxed_slice());
1959 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1963 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1964 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
1965 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
1966 fn drop(&mut self) {
1967 if self.datalen == 0 { return; }
1968 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1971 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
1972 fn clone(&self) -> Self {
1973 let mut res = Vec::new();
1974 if self.datalen == 0 { return Self::from(res); }
1975 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1980 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1981 /// This corresponds to std::vector in C++
1982 pub struct CVec_TxidZ {
1983 /// The elements in the array.
1984 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1985 pub data: *mut crate::c_types::ThirtyTwoBytes,
1986 /// The number of elements pointed to by `data`.
1990 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1991 if self.datalen == 0 { return Vec::new(); }
1992 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1993 self.data = std::ptr::null_mut();
1997 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1998 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2001 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2002 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2003 let datalen = v.len();
2004 let data = Box::into_raw(v.into_boxed_slice());
2005 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2009 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2010 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2011 impl Drop for CVec_TxidZ {
2012 fn drop(&mut self) {
2013 if self.datalen == 0 { return; }
2014 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2017 impl Clone for CVec_TxidZ {
2018 fn clone(&self) -> Self {
2019 let mut res = Vec::new();
2020 if self.datalen == 0 { return Self::from(res); }
2021 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2026 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2027 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2028 /// Note that this value is always NULL, as there are no contents in the OK variant
2029 pub result: *mut std::ffi::c_void,
2030 /// A pointer to the contents in the error state.
2031 /// Reading from this pointer when `result_ok` is set is undefined.
2032 pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2035 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2036 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2038 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2039 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2040 /// `err` or `result` depending on the state of `result_ok`.
2041 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2042 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2043 pub result_ok: bool,
2046 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2047 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2048 CResult_NoneChannelMonitorUpdateErrZ {
2049 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2050 result: std::ptr::null_mut(),
2056 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2057 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2058 CResult_NoneChannelMonitorUpdateErrZ {
2059 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2060 err: Box::into_raw(Box::new(e)),
2066 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2067 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2068 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2069 fn drop(&mut self) {
2072 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2073 let _ = unsafe { Box::from_raw(self.contents.err) };
2078 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2079 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2080 let contents = if o.result_ok {
2081 let _ = unsafe { Box::from_raw(o.contents.result) };
2082 o.contents.result = std::ptr::null_mut();
2083 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2085 let err = unsafe { o.contents.err };
2086 unsafe { o.contents.err = std::ptr::null_mut(); }
2087 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2091 result_ok: o.result_ok,
2095 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2096 fn clone(&self) -> Self {
2098 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2099 result: std::ptr::null_mut()
2102 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2103 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2109 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2110 /// but with all dynamically-allocated buffers duplicated in new buffers.
2111 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2113 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2114 /// This corresponds to std::vector in C++
2115 pub struct CVec_MonitorEventZ {
2116 /// The elements in the array.
2117 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2118 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2119 /// The number of elements pointed to by `data`.
2122 impl CVec_MonitorEventZ {
2123 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2124 if self.datalen == 0 { return Vec::new(); }
2125 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2126 self.data = std::ptr::null_mut();
2130 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2131 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2134 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2135 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2136 let datalen = v.len();
2137 let data = Box::into_raw(v.into_boxed_slice());
2138 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2142 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2143 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2144 impl Drop for CVec_MonitorEventZ {
2145 fn drop(&mut self) {
2146 if self.datalen == 0 { return; }
2147 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2150 impl Clone for CVec_MonitorEventZ {
2151 fn clone(&self) -> Self {
2152 let mut res = Vec::new();
2153 if self.datalen == 0 { return Self::from(res); }
2154 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2160 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2161 pub enum COption_C2Tuple_usizeTransactionZZ {
2162 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2163 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2164 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2167 impl COption_C2Tuple_usizeTransactionZZ {
2168 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2169 if let Self::Some(_) = self { true } else { false }
2171 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2172 if let Self::Some(v) = self { v } else { unreachable!() }
2176 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2177 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2178 COption_C2Tuple_usizeTransactionZZ::Some(o)
2181 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2182 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2183 COption_C2Tuple_usizeTransactionZZ::None
2186 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2187 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2189 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2190 /// but with all dynamically-allocated buffers duplicated in new buffers.
2191 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { orig.clone() }
2193 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2194 /// This corresponds to std::vector in C++
2195 pub struct CVec_SpendableOutputDescriptorZ {
2196 /// The elements in the array.
2197 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2198 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2199 /// The number of elements pointed to by `data`.
2202 impl CVec_SpendableOutputDescriptorZ {
2203 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2204 if self.datalen == 0 { return Vec::new(); }
2205 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2206 self.data = std::ptr::null_mut();
2210 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2211 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2214 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2215 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2216 let datalen = v.len();
2217 let data = Box::into_raw(v.into_boxed_slice());
2218 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2222 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2223 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2224 impl Drop for CVec_SpendableOutputDescriptorZ {
2225 fn drop(&mut self) {
2226 if self.datalen == 0 { return; }
2227 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2230 impl Clone for CVec_SpendableOutputDescriptorZ {
2231 fn clone(&self) -> Self {
2232 let mut res = Vec::new();
2233 if self.datalen == 0 { return Self::from(res); }
2234 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2239 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2240 /// This corresponds to std::vector in C++
2241 pub struct CVec_MessageSendEventZ {
2242 /// The elements in the array.
2243 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2244 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2245 /// The number of elements pointed to by `data`.
2248 impl CVec_MessageSendEventZ {
2249 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2250 if self.datalen == 0 { return Vec::new(); }
2251 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2252 self.data = std::ptr::null_mut();
2256 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2257 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2260 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2261 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2262 let datalen = v.len();
2263 let data = Box::into_raw(v.into_boxed_slice());
2264 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2268 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2269 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2270 impl Drop for CVec_MessageSendEventZ {
2271 fn drop(&mut self) {
2272 if self.datalen == 0 { return; }
2273 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2276 impl Clone for CVec_MessageSendEventZ {
2277 fn clone(&self) -> Self {
2278 let mut res = Vec::new();
2279 if self.datalen == 0 { return Self::from(res); }
2280 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2285 /// The contents of CResult_InitFeaturesDecodeErrorZ
2286 pub union CResult_InitFeaturesDecodeErrorZPtr {
2287 /// A pointer to the contents in the success state.
2288 /// Reading from this pointer when `result_ok` is not set is undefined.
2289 pub result: *mut crate::lightning::ln::features::InitFeatures,
2290 /// A pointer to the contents in the error state.
2291 /// Reading from this pointer when `result_ok` is set is undefined.
2292 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2295 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2296 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2297 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2298 pub struct CResult_InitFeaturesDecodeErrorZ {
2299 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2300 /// `err` or `result` depending on the state of `result_ok`.
2301 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2302 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2303 pub result_ok: bool,
2306 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2307 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2308 CResult_InitFeaturesDecodeErrorZ {
2309 contents: CResult_InitFeaturesDecodeErrorZPtr {
2310 result: Box::into_raw(Box::new(o)),
2316 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
2317 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
2318 CResult_InitFeaturesDecodeErrorZ {
2319 contents: CResult_InitFeaturesDecodeErrorZPtr {
2320 err: Box::into_raw(Box::new(e)),
2326 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
2327 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
2328 impl Drop for CResult_InitFeaturesDecodeErrorZ {
2329 fn drop(&mut self) {
2331 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2332 let _ = unsafe { Box::from_raw(self.contents.result) };
2335 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2336 let _ = unsafe { Box::from_raw(self.contents.err) };
2341 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
2342 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2343 let contents = if o.result_ok {
2344 let result = unsafe { o.contents.result };
2345 unsafe { o.contents.result = std::ptr::null_mut() };
2346 CResult_InitFeaturesDecodeErrorZPtr { result }
2348 let err = unsafe { o.contents.err };
2349 unsafe { o.contents.err = std::ptr::null_mut(); }
2350 CResult_InitFeaturesDecodeErrorZPtr { err }
2354 result_ok: o.result_ok,
2359 /// The contents of CResult_NodeFeaturesDecodeErrorZ
2360 pub union CResult_NodeFeaturesDecodeErrorZPtr {
2361 /// A pointer to the contents in the success state.
2362 /// Reading from this pointer when `result_ok` is not set is undefined.
2363 pub result: *mut crate::lightning::ln::features::NodeFeatures,
2364 /// A pointer to the contents in the error state.
2365 /// Reading from this pointer when `result_ok` is set is undefined.
2366 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2369 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2370 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2371 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2372 pub struct CResult_NodeFeaturesDecodeErrorZ {
2373 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2374 /// `err` or `result` depending on the state of `result_ok`.
2375 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
2376 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2377 pub result_ok: bool,
2380 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2381 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2382 CResult_NodeFeaturesDecodeErrorZ {
2383 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2384 result: Box::into_raw(Box::new(o)),
2390 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2391 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2392 CResult_NodeFeaturesDecodeErrorZ {
2393 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2394 err: Box::into_raw(Box::new(e)),
2400 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2401 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2402 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2403 fn drop(&mut self) {
2405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2406 let _ = unsafe { Box::from_raw(self.contents.result) };
2409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2410 let _ = unsafe { Box::from_raw(self.contents.err) };
2415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2417 let contents = if o.result_ok {
2418 let result = unsafe { o.contents.result };
2419 unsafe { o.contents.result = std::ptr::null_mut() };
2420 CResult_NodeFeaturesDecodeErrorZPtr { result }
2422 let err = unsafe { o.contents.err };
2423 unsafe { o.contents.err = std::ptr::null_mut(); }
2424 CResult_NodeFeaturesDecodeErrorZPtr { err }
2428 result_ok: o.result_ok,
2433 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2434 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2435 /// A pointer to the contents in the success state.
2436 /// Reading from this pointer when `result_ok` is not set is undefined.
2437 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
2438 /// A pointer to the contents in the error state.
2439 /// Reading from this pointer when `result_ok` is set is undefined.
2440 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2443 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2444 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2446 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2447 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2448 /// `err` or `result` depending on the state of `result_ok`.
2449 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2450 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2451 pub result_ok: bool,
2454 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2455 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2456 CResult_ChannelFeaturesDecodeErrorZ {
2457 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2458 result: Box::into_raw(Box::new(o)),
2464 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2465 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2466 CResult_ChannelFeaturesDecodeErrorZ {
2467 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2468 err: Box::into_raw(Box::new(e)),
2474 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2475 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2476 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
2477 fn drop(&mut self) {
2479 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2480 let _ = unsafe { Box::from_raw(self.contents.result) };
2483 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2484 let _ = unsafe { Box::from_raw(self.contents.err) };
2489 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2490 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2491 let contents = if o.result_ok {
2492 let result = unsafe { o.contents.result };
2493 unsafe { o.contents.result = std::ptr::null_mut() };
2494 CResult_ChannelFeaturesDecodeErrorZPtr { result }
2496 let err = unsafe { o.contents.err };
2497 unsafe { o.contents.err = std::ptr::null_mut(); }
2498 CResult_ChannelFeaturesDecodeErrorZPtr { err }
2502 result_ok: o.result_ok,
2507 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2508 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
2509 /// A pointer to the contents in the success state.
2510 /// Reading from this pointer when `result_ok` is not set is undefined.
2511 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
2512 /// A pointer to the contents in the error state.
2513 /// Reading from this pointer when `result_ok` is set is undefined.
2514 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2517 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2518 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2520 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
2521 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2522 /// `err` or `result` depending on the state of `result_ok`.
2523 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2524 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2525 pub result_ok: bool,
2528 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2529 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2530 CResult_InvoiceFeaturesDecodeErrorZ {
2531 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2532 result: Box::into_raw(Box::new(o)),
2538 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2539 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2540 CResult_InvoiceFeaturesDecodeErrorZ {
2541 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2542 err: Box::into_raw(Box::new(e)),
2548 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2549 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2550 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
2551 fn drop(&mut self) {
2553 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2554 let _ = unsafe { Box::from_raw(self.contents.result) };
2557 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2558 let _ = unsafe { Box::from_raw(self.contents.err) };
2563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2564 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2565 let contents = if o.result_ok {
2566 let result = unsafe { o.contents.result };
2567 unsafe { o.contents.result = std::ptr::null_mut() };
2568 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
2570 let err = unsafe { o.contents.err };
2571 unsafe { o.contents.err = std::ptr::null_mut(); }
2572 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2576 result_ok: o.result_ok,
2581 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2582 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2583 /// A pointer to the contents in the success state.
2584 /// Reading from this pointer when `result_ok` is not set is undefined.
2585 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
2586 /// A pointer to the contents in the error state.
2587 /// Reading from this pointer when `result_ok` is set is undefined.
2588 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2591 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2592 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2594 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2595 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2596 /// `err` or `result` depending on the state of `result_ok`.
2597 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
2598 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2599 pub result_ok: bool,
2602 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
2603 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2604 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2605 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2606 result: Box::into_raw(Box::new(o)),
2612 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
2613 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2614 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2615 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2616 err: Box::into_raw(Box::new(e)),
2622 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
2623 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
2624 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2625 fn drop(&mut self) {
2627 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2628 let _ = unsafe { Box::from_raw(self.contents.result) };
2631 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2632 let _ = unsafe { Box::from_raw(self.contents.err) };
2637 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2638 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2639 let contents = if o.result_ok {
2640 let result = unsafe { o.contents.result };
2641 unsafe { o.contents.result = std::ptr::null_mut() };
2642 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
2644 let err = unsafe { o.contents.err };
2645 unsafe { o.contents.err = std::ptr::null_mut(); }
2646 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
2650 result_ok: o.result_ok,
2654 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2655 fn clone(&self) -> Self {
2657 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2658 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2661 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2662 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2668 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2669 /// but with all dynamically-allocated buffers duplicated in new buffers.
2670 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2672 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2673 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2674 /// A pointer to the contents in the success state.
2675 /// Reading from this pointer when `result_ok` is not set is undefined.
2676 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
2677 /// A pointer to the contents in the error state.
2678 /// Reading from this pointer when `result_ok` is set is undefined.
2679 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2682 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2683 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2684 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2685 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2686 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2687 /// `err` or `result` depending on the state of `result_ok`.
2688 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
2689 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2690 pub result_ok: bool,
2693 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
2694 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2695 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2696 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2697 result: Box::into_raw(Box::new(o)),
2703 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
2704 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2705 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2706 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2707 err: Box::into_raw(Box::new(e)),
2713 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
2714 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
2715 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2716 fn drop(&mut self) {
2718 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2719 let _ = unsafe { Box::from_raw(self.contents.result) };
2722 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2723 let _ = unsafe { Box::from_raw(self.contents.err) };
2728 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2729 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2730 let contents = if o.result_ok {
2731 let result = unsafe { o.contents.result };
2732 unsafe { o.contents.result = std::ptr::null_mut() };
2733 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
2735 let err = unsafe { o.contents.err };
2736 unsafe { o.contents.err = std::ptr::null_mut(); }
2737 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
2741 result_ok: o.result_ok,
2745 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2746 fn clone(&self) -> Self {
2748 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2749 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2752 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2753 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2759 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2760 /// but with all dynamically-allocated buffers duplicated in new buffers.
2761 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2763 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
2764 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2765 /// A pointer to the contents in the success state.
2766 /// Reading from this pointer when `result_ok` is not set is undefined.
2767 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2768 /// A pointer to the contents in the error state.
2769 /// Reading from this pointer when `result_ok` is set is undefined.
2770 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2773 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2774 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2776 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
2777 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
2778 /// `err` or `result` depending on the state of `result_ok`.
2779 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
2780 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
2781 pub result_ok: bool,
2784 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
2785 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2786 CResult_SpendableOutputDescriptorDecodeErrorZ {
2787 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2788 result: Box::into_raw(Box::new(o)),
2794 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
2795 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2796 CResult_SpendableOutputDescriptorDecodeErrorZ {
2797 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2798 err: Box::into_raw(Box::new(e)),
2804 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
2805 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
2806 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
2807 fn drop(&mut self) {
2809 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2810 let _ = unsafe { Box::from_raw(self.contents.result) };
2813 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2814 let _ = unsafe { Box::from_raw(self.contents.err) };
2819 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
2820 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2821 let contents = if o.result_ok {
2822 let result = unsafe { o.contents.result };
2823 unsafe { o.contents.result = std::ptr::null_mut() };
2824 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
2826 let err = unsafe { o.contents.err };
2827 unsafe { o.contents.err = std::ptr::null_mut(); }
2828 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
2832 result_ok: o.result_ok,
2836 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
2837 fn clone(&self) -> Self {
2839 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2840 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2843 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2844 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2850 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
2851 /// but with all dynamically-allocated buffers duplicated in new buffers.
2852 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
2854 /// A tuple of 2 elements. See the individual fields for the types contained.
2855 pub struct C2Tuple_SignatureCVec_SignatureZZ {
2856 /// The element at position 0
2857 pub a: crate::c_types::Signature,
2858 /// The element at position 1
2859 pub b: crate::c_types::derived::CVec_SignatureZ,
2861 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
2862 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
2869 impl C2Tuple_SignatureCVec_SignatureZZ {
2870 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
2874 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
2875 fn clone(&self) -> Self {
2883 /// Creates a new tuple which has the same data as `orig`
2884 /// but with all dynamically-allocated buffers duplicated in new buffers.
2885 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
2886 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
2888 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
2889 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
2893 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
2894 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
2896 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
2897 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2898 /// A pointer to the contents in the success state.
2899 /// Reading from this pointer when `result_ok` is not set is undefined.
2900 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
2901 /// Note that this value is always NULL, as there are no contents in the Err variant
2902 pub err: *mut std::ffi::c_void,
2905 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
2906 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
2907 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2908 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2909 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
2910 /// `err` or `result` depending on the state of `result_ok`.
2911 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
2912 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2913 pub result_ok: bool,
2916 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
2917 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2918 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2919 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2920 result: Box::into_raw(Box::new(o)),
2926 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
2927 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2928 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2929 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2930 err: std::ptr::null_mut(),
2936 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
2937 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
2938 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2939 fn drop(&mut self) {
2941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2942 let _ = unsafe { Box::from_raw(self.contents.result) };
2948 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2949 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
2950 let contents = if o.result_ok {
2951 let result = unsafe { o.contents.result };
2952 unsafe { o.contents.result = std::ptr::null_mut() };
2953 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
2955 let _ = unsafe { Box::from_raw(o.contents.err) };
2956 o.contents.err = std::ptr::null_mut();
2957 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
2961 result_ok: o.result_ok,
2965 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2966 fn clone(&self) -> Self {
2968 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2969 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
2972 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2973 err: std::ptr::null_mut()
2979 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
2980 /// but with all dynamically-allocated buffers duplicated in new buffers.
2981 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
2983 /// The contents of CResult_SignatureNoneZ
2984 pub union CResult_SignatureNoneZPtr {
2985 /// A pointer to the contents in the success state.
2986 /// Reading from this pointer when `result_ok` is not set is undefined.
2987 pub result: *mut crate::c_types::Signature,
2988 /// Note that this value is always NULL, as there are no contents in the Err variant
2989 pub err: *mut std::ffi::c_void,
2992 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
2993 /// containing a crate::c_types::Signature on success and a () on failure.
2994 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2995 pub struct CResult_SignatureNoneZ {
2996 /// The contents of this CResult_SignatureNoneZ, accessible via either
2997 /// `err` or `result` depending on the state of `result_ok`.
2998 pub contents: CResult_SignatureNoneZPtr,
2999 /// Whether this CResult_SignatureNoneZ represents a success state.
3000 pub result_ok: bool,
3003 /// Creates a new CResult_SignatureNoneZ in the success state.
3004 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3005 CResult_SignatureNoneZ {
3006 contents: CResult_SignatureNoneZPtr {
3007 result: Box::into_raw(Box::new(o)),
3013 /// Creates a new CResult_SignatureNoneZ in the error state.
3014 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3015 CResult_SignatureNoneZ {
3016 contents: CResult_SignatureNoneZPtr {
3017 err: std::ptr::null_mut(),
3023 /// Frees any resources used by the CResult_SignatureNoneZ.
3024 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3025 impl Drop for CResult_SignatureNoneZ {
3026 fn drop(&mut self) {
3028 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3029 let _ = unsafe { Box::from_raw(self.contents.result) };
3035 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3036 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3037 let contents = if o.result_ok {
3038 let result = unsafe { o.contents.result };
3039 unsafe { o.contents.result = std::ptr::null_mut() };
3040 CResult_SignatureNoneZPtr { result }
3042 let _ = unsafe { Box::from_raw(o.contents.err) };
3043 o.contents.err = std::ptr::null_mut();
3044 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3048 result_ok: o.result_ok,
3052 impl Clone for CResult_SignatureNoneZ {
3053 fn clone(&self) -> Self {
3055 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3056 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3059 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3060 err: std::ptr::null_mut()
3066 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3067 /// but with all dynamically-allocated buffers duplicated in new buffers.
3068 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
3070 /// The contents of CResult_SignDecodeErrorZ
3071 pub union CResult_SignDecodeErrorZPtr {
3072 /// A pointer to the contents in the success state.
3073 /// Reading from this pointer when `result_ok` is not set is undefined.
3074 pub result: *mut crate::lightning::chain::keysinterface::Sign,
3075 /// A pointer to the contents in the error state.
3076 /// Reading from this pointer when `result_ok` is set is undefined.
3077 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3080 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3081 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3083 pub struct CResult_SignDecodeErrorZ {
3084 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3085 /// `err` or `result` depending on the state of `result_ok`.
3086 pub contents: CResult_SignDecodeErrorZPtr,
3087 /// Whether this CResult_SignDecodeErrorZ represents a success state.
3088 pub result_ok: bool,
3091 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3092 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3093 CResult_SignDecodeErrorZ {
3094 contents: CResult_SignDecodeErrorZPtr {
3095 result: Box::into_raw(Box::new(o)),
3101 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3102 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3103 CResult_SignDecodeErrorZ {
3104 contents: CResult_SignDecodeErrorZPtr {
3105 err: Box::into_raw(Box::new(e)),
3111 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3112 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3113 impl Drop for CResult_SignDecodeErrorZ {
3114 fn drop(&mut self) {
3116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3117 let _ = unsafe { Box::from_raw(self.contents.result) };
3120 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3121 let _ = unsafe { Box::from_raw(self.contents.err) };
3126 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3127 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3128 let contents = if o.result_ok {
3129 let result = unsafe { o.contents.result };
3130 unsafe { o.contents.result = std::ptr::null_mut() };
3131 CResult_SignDecodeErrorZPtr { result }
3133 let err = unsafe { o.contents.err };
3134 unsafe { o.contents.err = std::ptr::null_mut(); }
3135 CResult_SignDecodeErrorZPtr { err }
3139 result_ok: o.result_ok,
3143 impl Clone for CResult_SignDecodeErrorZ {
3144 fn clone(&self) -> Self {
3146 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3147 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3150 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3151 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3157 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3158 /// but with all dynamically-allocated buffers duplicated in new buffers.
3159 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
3161 /// A dynamically-allocated array of u8s of arbitrary size.
3162 /// This corresponds to std::vector in C++
3163 pub struct CVec_u8Z {
3164 /// The elements in the array.
3165 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3167 /// The number of elements pointed to by `data`.
3171 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3172 if self.datalen == 0 { return Vec::new(); }
3173 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3174 self.data = std::ptr::null_mut();
3178 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3179 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3182 impl From<Vec<u8>> for CVec_u8Z {
3183 fn from(v: Vec<u8>) -> Self {
3184 let datalen = v.len();
3185 let data = Box::into_raw(v.into_boxed_slice());
3186 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3190 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3191 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3192 impl Drop for CVec_u8Z {
3193 fn drop(&mut self) {
3194 if self.datalen == 0 { return; }
3195 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3198 impl Clone for CVec_u8Z {
3199 fn clone(&self) -> Self {
3200 let mut res = Vec::new();
3201 if self.datalen == 0 { return Self::from(res); }
3202 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3207 /// The contents of CResult_RecoverableSignatureNoneZ
3208 pub union CResult_RecoverableSignatureNoneZPtr {
3209 /// A pointer to the contents in the success state.
3210 /// Reading from this pointer when `result_ok` is not set is undefined.
3211 pub result: *mut crate::c_types::RecoverableSignature,
3212 /// Note that this value is always NULL, as there are no contents in the Err variant
3213 pub err: *mut std::ffi::c_void,
3216 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3217 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3219 pub struct CResult_RecoverableSignatureNoneZ {
3220 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3221 /// `err` or `result` depending on the state of `result_ok`.
3222 pub contents: CResult_RecoverableSignatureNoneZPtr,
3223 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3224 pub result_ok: bool,
3227 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
3228 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
3229 CResult_RecoverableSignatureNoneZ {
3230 contents: CResult_RecoverableSignatureNoneZPtr {
3231 result: Box::into_raw(Box::new(o)),
3237 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
3238 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
3239 CResult_RecoverableSignatureNoneZ {
3240 contents: CResult_RecoverableSignatureNoneZPtr {
3241 err: std::ptr::null_mut(),
3247 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
3248 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
3249 impl Drop for CResult_RecoverableSignatureNoneZ {
3250 fn drop(&mut self) {
3252 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3253 let _ = unsafe { Box::from_raw(self.contents.result) };
3259 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
3260 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
3261 let contents = if o.result_ok {
3262 let result = unsafe { o.contents.result };
3263 unsafe { o.contents.result = std::ptr::null_mut() };
3264 CResult_RecoverableSignatureNoneZPtr { result }
3266 let _ = unsafe { Box::from_raw(o.contents.err) };
3267 o.contents.err = std::ptr::null_mut();
3268 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
3272 result_ok: o.result_ok,
3276 impl Clone for CResult_RecoverableSignatureNoneZ {
3277 fn clone(&self) -> Self {
3279 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
3280 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
3283 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
3284 err: std::ptr::null_mut()
3290 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
3291 /// but with all dynamically-allocated buffers duplicated in new buffers.
3292 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { orig.clone() }
3294 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3295 /// This corresponds to std::vector in C++
3296 pub struct CVec_CVec_u8ZZ {
3297 /// The elements in the array.
3298 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3299 pub data: *mut crate::c_types::derived::CVec_u8Z,
3300 /// The number of elements pointed to by `data`.
3303 impl CVec_CVec_u8ZZ {
3304 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3305 if self.datalen == 0 { return Vec::new(); }
3306 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3307 self.data = std::ptr::null_mut();
3311 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3312 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3315 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3316 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3317 let datalen = v.len();
3318 let data = Box::into_raw(v.into_boxed_slice());
3319 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3323 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3324 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3325 impl Drop for CVec_CVec_u8ZZ {
3326 fn drop(&mut self) {
3327 if self.datalen == 0 { return; }
3328 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3331 impl Clone for CVec_CVec_u8ZZ {
3332 fn clone(&self) -> Self {
3333 let mut res = Vec::new();
3334 if self.datalen == 0 { return Self::from(res); }
3335 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3340 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3341 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3342 /// A pointer to the contents in the success state.
3343 /// Reading from this pointer when `result_ok` is not set is undefined.
3344 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3345 /// Note that this value is always NULL, as there are no contents in the Err variant
3346 pub err: *mut std::ffi::c_void,
3349 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3350 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3352 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3353 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3354 /// `err` or `result` depending on the state of `result_ok`.
3355 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3356 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3357 pub result_ok: bool,
3360 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3361 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3362 CResult_CVec_CVec_u8ZZNoneZ {
3363 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3364 result: Box::into_raw(Box::new(o)),
3370 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3371 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3372 CResult_CVec_CVec_u8ZZNoneZ {
3373 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3374 err: std::ptr::null_mut(),
3380 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3381 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3382 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3383 fn drop(&mut self) {
3385 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3386 let _ = unsafe { Box::from_raw(self.contents.result) };
3392 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3393 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3394 let contents = if o.result_ok {
3395 let result = unsafe { o.contents.result };
3396 unsafe { o.contents.result = std::ptr::null_mut() };
3397 CResult_CVec_CVec_u8ZZNoneZPtr { result }
3399 let _ = unsafe { Box::from_raw(o.contents.err) };
3400 o.contents.err = std::ptr::null_mut();
3401 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
3405 result_ok: o.result_ok,
3409 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3410 fn clone(&self) -> Self {
3412 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3413 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3416 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3417 err: std::ptr::null_mut()
3423 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3424 /// but with all dynamically-allocated buffers duplicated in new buffers.
3425 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
3427 /// The contents of CResult_InMemorySignerDecodeErrorZ
3428 pub union CResult_InMemorySignerDecodeErrorZPtr {
3429 /// A pointer to the contents in the success state.
3430 /// Reading from this pointer when `result_ok` is not set is undefined.
3431 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
3432 /// A pointer to the contents in the error state.
3433 /// Reading from this pointer when `result_ok` is set is undefined.
3434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3437 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3438 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3440 pub struct CResult_InMemorySignerDecodeErrorZ {
3441 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3442 /// `err` or `result` depending on the state of `result_ok`.
3443 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3444 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3445 pub result_ok: bool,
3448 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3449 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3450 CResult_InMemorySignerDecodeErrorZ {
3451 contents: CResult_InMemorySignerDecodeErrorZPtr {
3452 result: Box::into_raw(Box::new(o)),
3458 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3459 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3460 CResult_InMemorySignerDecodeErrorZ {
3461 contents: CResult_InMemorySignerDecodeErrorZPtr {
3462 err: Box::into_raw(Box::new(e)),
3468 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3469 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3470 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3471 fn drop(&mut self) {
3473 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3474 let _ = unsafe { Box::from_raw(self.contents.result) };
3477 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3478 let _ = unsafe { Box::from_raw(self.contents.err) };
3483 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3484 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3485 let contents = if o.result_ok {
3486 let result = unsafe { o.contents.result };
3487 unsafe { o.contents.result = std::ptr::null_mut() };
3488 CResult_InMemorySignerDecodeErrorZPtr { result }
3490 let err = unsafe { o.contents.err };
3491 unsafe { o.contents.err = std::ptr::null_mut(); }
3492 CResult_InMemorySignerDecodeErrorZPtr { err }
3496 result_ok: o.result_ok,
3500 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3501 fn clone(&self) -> Self {
3503 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3504 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3507 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3508 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3514 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3515 /// but with all dynamically-allocated buffers duplicated in new buffers.
3516 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
3518 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3519 /// This corresponds to std::vector in C++
3520 pub struct CVec_TxOutZ {
3521 /// The elements in the array.
3522 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3523 pub data: *mut crate::c_types::TxOut,
3524 /// The number of elements pointed to by `data`.
3528 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
3529 if self.datalen == 0 { return Vec::new(); }
3530 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3531 self.data = std::ptr::null_mut();
3535 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
3536 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3539 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
3540 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
3541 let datalen = v.len();
3542 let data = Box::into_raw(v.into_boxed_slice());
3543 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3547 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3548 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
3549 impl Drop for CVec_TxOutZ {
3550 fn drop(&mut self) {
3551 if self.datalen == 0 { return; }
3552 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3555 impl Clone for CVec_TxOutZ {
3556 fn clone(&self) -> Self {
3557 let mut res = Vec::new();
3558 if self.datalen == 0 { return Self::from(res); }
3559 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3564 /// The contents of CResult_TransactionNoneZ
3565 pub union CResult_TransactionNoneZPtr {
3566 /// A pointer to the contents in the success state.
3567 /// Reading from this pointer when `result_ok` is not set is undefined.
3568 pub result: *mut crate::c_types::Transaction,
3569 /// Note that this value is always NULL, as there are no contents in the Err variant
3570 pub err: *mut std::ffi::c_void,
3573 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3574 /// containing a crate::c_types::Transaction on success and a () on failure.
3575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3576 pub struct CResult_TransactionNoneZ {
3577 /// The contents of this CResult_TransactionNoneZ, accessible via either
3578 /// `err` or `result` depending on the state of `result_ok`.
3579 pub contents: CResult_TransactionNoneZPtr,
3580 /// Whether this CResult_TransactionNoneZ represents a success state.
3581 pub result_ok: bool,
3584 /// Creates a new CResult_TransactionNoneZ in the success state.
3585 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3586 CResult_TransactionNoneZ {
3587 contents: CResult_TransactionNoneZPtr {
3588 result: Box::into_raw(Box::new(o)),
3594 /// Creates a new CResult_TransactionNoneZ in the error state.
3595 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3596 CResult_TransactionNoneZ {
3597 contents: CResult_TransactionNoneZPtr {
3598 err: std::ptr::null_mut(),
3604 /// Frees any resources used by the CResult_TransactionNoneZ.
3605 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3606 impl Drop for CResult_TransactionNoneZ {
3607 fn drop(&mut self) {
3609 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3610 let _ = unsafe { Box::from_raw(self.contents.result) };
3616 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3617 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3618 let contents = if o.result_ok {
3619 let result = unsafe { o.contents.result };
3620 unsafe { o.contents.result = std::ptr::null_mut() };
3621 CResult_TransactionNoneZPtr { result }
3623 let _ = unsafe { Box::from_raw(o.contents.err) };
3624 o.contents.err = std::ptr::null_mut();
3625 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
3629 result_ok: o.result_ok,
3633 impl Clone for CResult_TransactionNoneZ {
3634 fn clone(&self) -> Self {
3636 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3637 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3640 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3641 err: std::ptr::null_mut()
3647 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3648 /// but with all dynamically-allocated buffers duplicated in new buffers.
3649 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { orig.clone() }
3651 /// A tuple of 2 elements. See the individual fields for the types contained.
3652 pub struct C2Tuple_BlockHashChannelMonitorZ {
3653 /// The element at position 0
3654 pub a: crate::c_types::ThirtyTwoBytes,
3655 /// The element at position 1
3656 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3658 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3659 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3666 impl C2Tuple_BlockHashChannelMonitorZ {
3667 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3671 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3673 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3674 C2Tuple_BlockHashChannelMonitorZ { a, b, }
3678 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3679 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3681 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3682 /// This corresponds to std::vector in C++
3683 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
3684 /// The elements in the array.
3685 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3686 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3687 /// The number of elements pointed to by `data`.
3690 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
3691 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
3692 if self.datalen == 0 { return Vec::new(); }
3693 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3694 self.data = std::ptr::null_mut();
3698 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
3699 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3702 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3703 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
3704 let datalen = v.len();
3705 let data = Box::into_raw(v.into_boxed_slice());
3706 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3710 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3711 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
3712 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3713 fn drop(&mut self) {
3714 if self.datalen == 0 { return; }
3715 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3719 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3720 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3721 /// A pointer to the contents in the success state.
3722 /// Reading from this pointer when `result_ok` is not set is undefined.
3723 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
3724 /// A pointer to the contents in the error state.
3725 /// Reading from this pointer when `result_ok` is set is undefined.
3726 pub err: *mut crate::c_types::IOError,
3729 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3730 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3732 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3733 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3734 /// `err` or `result` depending on the state of `result_ok`.
3735 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
3736 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3737 pub result_ok: bool,
3740 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
3741 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3742 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3743 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3744 result: Box::into_raw(Box::new(o)),
3750 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
3751 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3752 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3753 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3754 err: Box::into_raw(Box::new(e)),
3760 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
3761 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
3762 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3763 fn drop(&mut self) {
3765 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3766 let _ = unsafe { Box::from_raw(self.contents.result) };
3769 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3770 let _ = unsafe { Box::from_raw(self.contents.err) };
3775 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3776 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
3777 let contents = if o.result_ok {
3778 let result = unsafe { o.contents.result };
3779 unsafe { o.contents.result = std::ptr::null_mut() };
3780 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
3782 let err = unsafe { o.contents.err };
3783 unsafe { o.contents.err = std::ptr::null_mut(); }
3784 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
3788 result_ok: o.result_ok,
3794 /// An enum which can either contain a u16 or not
3795 pub enum COption_u16Z {
3796 /// When we're in this state, this COption_u16Z contains a u16
3798 /// When we're in this state, this COption_u16Z contains nothing
3802 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3803 if let Self::Some(_) = self { true } else { false }
3805 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
3806 if let Self::Some(v) = self { v } else { unreachable!() }
3810 /// Constructs a new COption_u16Z containing a u16
3811 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
3812 COption_u16Z::Some(o)
3815 /// Constructs a new COption_u16Z containing nothing
3816 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
3820 /// Frees any resources associated with the u16, if we are in the Some state
3821 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
3823 /// Creates a new COption_u16Z which has the same data as `orig`
3824 /// but with all dynamically-allocated buffers duplicated in new buffers.
3825 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { orig.clone() }
3827 /// The contents of CResult_NoneAPIErrorZ
3828 pub union CResult_NoneAPIErrorZPtr {
3829 /// Note that this value is always NULL, as there are no contents in the OK variant
3830 pub result: *mut std::ffi::c_void,
3831 /// A pointer to the contents in the error state.
3832 /// Reading from this pointer when `result_ok` is set is undefined.
3833 pub err: *mut crate::lightning::util::errors::APIError,
3836 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
3837 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
3838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3839 pub struct CResult_NoneAPIErrorZ {
3840 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
3841 /// `err` or `result` depending on the state of `result_ok`.
3842 pub contents: CResult_NoneAPIErrorZPtr,
3843 /// Whether this CResult_NoneAPIErrorZ represents a success state.
3844 pub result_ok: bool,
3847 /// Creates a new CResult_NoneAPIErrorZ in the success state.
3848 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
3849 CResult_NoneAPIErrorZ {
3850 contents: CResult_NoneAPIErrorZPtr {
3851 result: std::ptr::null_mut(),
3857 /// Creates a new CResult_NoneAPIErrorZ in the error state.
3858 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
3859 CResult_NoneAPIErrorZ {
3860 contents: CResult_NoneAPIErrorZPtr {
3861 err: Box::into_raw(Box::new(e)),
3867 /// Frees any resources used by the CResult_NoneAPIErrorZ.
3868 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
3869 impl Drop for CResult_NoneAPIErrorZ {
3870 fn drop(&mut self) {
3873 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3874 let _ = unsafe { Box::from_raw(self.contents.err) };
3879 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
3880 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
3881 let contents = if o.result_ok {
3882 let _ = unsafe { Box::from_raw(o.contents.result) };
3883 o.contents.result = std::ptr::null_mut();
3884 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
3886 let err = unsafe { o.contents.err };
3887 unsafe { o.contents.err = std::ptr::null_mut(); }
3888 CResult_NoneAPIErrorZPtr { err }
3892 result_ok: o.result_ok,
3896 impl Clone for CResult_NoneAPIErrorZ {
3897 fn clone(&self) -> Self {
3899 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
3900 result: std::ptr::null_mut()
3903 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
3904 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
3910 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
3911 /// but with all dynamically-allocated buffers duplicated in new buffers.
3912 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
3914 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
3915 /// This corresponds to std::vector in C++
3916 pub struct CVec_CResult_NoneAPIErrorZZ {
3917 /// The elements in the array.
3918 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3919 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
3920 /// The number of elements pointed to by `data`.
3923 impl CVec_CResult_NoneAPIErrorZZ {
3924 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
3925 if self.datalen == 0 { return Vec::new(); }
3926 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3927 self.data = std::ptr::null_mut();
3931 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
3932 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3935 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
3936 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
3937 let datalen = v.len();
3938 let data = Box::into_raw(v.into_boxed_slice());
3939 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3943 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3944 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
3945 impl Drop for CVec_CResult_NoneAPIErrorZZ {
3946 fn drop(&mut self) {
3947 if self.datalen == 0 { return; }
3948 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3951 impl Clone for CVec_CResult_NoneAPIErrorZZ {
3952 fn clone(&self) -> Self {
3953 let mut res = Vec::new();
3954 if self.datalen == 0 { return Self::from(res); }
3955 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3960 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
3961 /// This corresponds to std::vector in C++
3962 pub struct CVec_APIErrorZ {
3963 /// The elements in the array.
3964 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3965 pub data: *mut crate::lightning::util::errors::APIError,
3966 /// The number of elements pointed to by `data`.
3969 impl CVec_APIErrorZ {
3970 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
3971 if self.datalen == 0 { return Vec::new(); }
3972 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3973 self.data = std::ptr::null_mut();
3977 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
3978 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3981 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
3982 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
3983 let datalen = v.len();
3984 let data = Box::into_raw(v.into_boxed_slice());
3985 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3989 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3990 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
3991 impl Drop for CVec_APIErrorZ {
3992 fn drop(&mut self) {
3993 if self.datalen == 0 { return; }
3994 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3997 impl Clone for CVec_APIErrorZ {
3998 fn clone(&self) -> Self {
3999 let mut res = Vec::new();
4000 if self.datalen == 0 { return Self::from(res); }
4001 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4006 /// The contents of CResult_NonePaymentSendFailureZ
4007 pub union CResult_NonePaymentSendFailureZPtr {
4008 /// Note that this value is always NULL, as there are no contents in the OK variant
4009 pub result: *mut std::ffi::c_void,
4010 /// A pointer to the contents in the error state.
4011 /// Reading from this pointer when `result_ok` is set is undefined.
4012 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4015 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4016 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4017 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4018 pub struct CResult_NonePaymentSendFailureZ {
4019 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4020 /// `err` or `result` depending on the state of `result_ok`.
4021 pub contents: CResult_NonePaymentSendFailureZPtr,
4022 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4023 pub result_ok: bool,
4026 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4027 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4028 CResult_NonePaymentSendFailureZ {
4029 contents: CResult_NonePaymentSendFailureZPtr {
4030 result: std::ptr::null_mut(),
4036 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4037 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4038 CResult_NonePaymentSendFailureZ {
4039 contents: CResult_NonePaymentSendFailureZPtr {
4040 err: Box::into_raw(Box::new(e)),
4046 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4047 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4048 impl Drop for CResult_NonePaymentSendFailureZ {
4049 fn drop(&mut self) {
4052 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4053 let _ = unsafe { Box::from_raw(self.contents.err) };
4058 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4059 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4060 let contents = if o.result_ok {
4061 let _ = unsafe { Box::from_raw(o.contents.result) };
4062 o.contents.result = std::ptr::null_mut();
4063 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4065 let err = unsafe { o.contents.err };
4066 unsafe { o.contents.err = std::ptr::null_mut(); }
4067 CResult_NonePaymentSendFailureZPtr { err }
4071 result_ok: o.result_ok,
4075 impl Clone for CResult_NonePaymentSendFailureZ {
4076 fn clone(&self) -> Self {
4078 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4079 result: std::ptr::null_mut()
4082 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4083 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4089 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4090 /// but with all dynamically-allocated buffers duplicated in new buffers.
4091 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4093 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4094 /// This corresponds to std::vector in C++
4095 pub struct CVec_NetAddressZ {
4096 /// The elements in the array.
4097 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4098 pub data: *mut crate::lightning::ln::msgs::NetAddress,
4099 /// The number of elements pointed to by `data`.
4102 impl CVec_NetAddressZ {
4103 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4104 if self.datalen == 0 { return Vec::new(); }
4105 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4106 self.data = std::ptr::null_mut();
4110 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4111 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4114 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4115 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4116 let datalen = v.len();
4117 let data = Box::into_raw(v.into_boxed_slice());
4118 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4122 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4123 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4124 impl Drop for CVec_NetAddressZ {
4125 fn drop(&mut self) {
4126 if self.datalen == 0 { return; }
4127 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4130 impl Clone for CVec_NetAddressZ {
4131 fn clone(&self) -> Self {
4132 let mut res = Vec::new();
4133 if self.datalen == 0 { return Self::from(res); }
4134 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4139 /// A tuple of 2 elements. See the individual fields for the types contained.
4140 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4141 /// The element at position 0
4142 pub a: crate::c_types::ThirtyTwoBytes,
4143 /// The element at position 1
4144 pub b: crate::c_types::ThirtyTwoBytes,
4146 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4147 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4154 impl C2Tuple_PaymentHashPaymentSecretZ {
4155 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4159 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4160 fn clone(&self) -> Self {
4168 /// Creates a new tuple which has the same data as `orig`
4169 /// but with all dynamically-allocated buffers duplicated in new buffers.
4170 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { orig.clone() }
4171 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4173 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4174 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4178 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4179 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4181 /// The contents of CResult_PaymentSecretAPIErrorZ
4182 pub union CResult_PaymentSecretAPIErrorZPtr {
4183 /// A pointer to the contents in the success state.
4184 /// Reading from this pointer when `result_ok` is not set is undefined.
4185 pub result: *mut crate::c_types::ThirtyTwoBytes,
4186 /// A pointer to the contents in the error state.
4187 /// Reading from this pointer when `result_ok` is set is undefined.
4188 pub err: *mut crate::lightning::util::errors::APIError,
4191 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4192 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4194 pub struct CResult_PaymentSecretAPIErrorZ {
4195 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4196 /// `err` or `result` depending on the state of `result_ok`.
4197 pub contents: CResult_PaymentSecretAPIErrorZPtr,
4198 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4199 pub result_ok: bool,
4202 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4203 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4204 CResult_PaymentSecretAPIErrorZ {
4205 contents: CResult_PaymentSecretAPIErrorZPtr {
4206 result: Box::into_raw(Box::new(o)),
4212 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4213 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4214 CResult_PaymentSecretAPIErrorZ {
4215 contents: CResult_PaymentSecretAPIErrorZPtr {
4216 err: Box::into_raw(Box::new(e)),
4222 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4223 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4224 impl Drop for CResult_PaymentSecretAPIErrorZ {
4225 fn drop(&mut self) {
4227 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4228 let _ = unsafe { Box::from_raw(self.contents.result) };
4231 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4232 let _ = unsafe { Box::from_raw(self.contents.err) };
4237 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4238 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4239 let contents = if o.result_ok {
4240 let result = unsafe { o.contents.result };
4241 unsafe { o.contents.result = std::ptr::null_mut() };
4242 CResult_PaymentSecretAPIErrorZPtr { result }
4244 let err = unsafe { o.contents.err };
4245 unsafe { o.contents.err = std::ptr::null_mut(); }
4246 CResult_PaymentSecretAPIErrorZPtr { err }
4250 result_ok: o.result_ok,
4254 impl Clone for CResult_PaymentSecretAPIErrorZ {
4255 fn clone(&self) -> Self {
4257 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4258 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4261 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4262 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4268 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4269 /// but with all dynamically-allocated buffers duplicated in new buffers.
4270 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { orig.clone() }
4272 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4273 /// This corresponds to std::vector in C++
4274 pub struct CVec_ChannelMonitorZ {
4275 /// The elements in the array.
4276 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4277 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4278 /// The number of elements pointed to by `data`.
4281 impl CVec_ChannelMonitorZ {
4282 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4283 if self.datalen == 0 { return Vec::new(); }
4284 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4285 self.data = std::ptr::null_mut();
4289 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4290 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4293 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4294 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4295 let datalen = v.len();
4296 let data = Box::into_raw(v.into_boxed_slice());
4297 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4301 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4302 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4303 impl Drop for CVec_ChannelMonitorZ {
4304 fn drop(&mut self) {
4305 if self.datalen == 0 { return; }
4306 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4310 /// A tuple of 2 elements. See the individual fields for the types contained.
4311 pub struct C2Tuple_BlockHashChannelManagerZ {
4312 /// The element at position 0
4313 pub a: crate::c_types::ThirtyTwoBytes,
4314 /// The element at position 1
4315 pub b: crate::lightning::ln::channelmanager::ChannelManager,
4317 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4318 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4325 impl C2Tuple_BlockHashChannelManagerZ {
4326 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4330 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4332 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4333 C2Tuple_BlockHashChannelManagerZ { a, b, }
4337 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4338 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4340 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4341 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4342 /// A pointer to the contents in the success state.
4343 /// Reading from this pointer when `result_ok` is not set is undefined.
4344 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4345 /// A pointer to the contents in the error state.
4346 /// Reading from this pointer when `result_ok` is set is undefined.
4347 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4350 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4351 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4352 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4353 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4354 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4355 /// `err` or `result` depending on the state of `result_ok`.
4356 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4357 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4358 pub result_ok: bool,
4361 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4362 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4363 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4364 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4365 result: Box::into_raw(Box::new(o)),
4371 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4372 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4373 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4374 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4375 err: Box::into_raw(Box::new(e)),
4381 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4382 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4383 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4384 fn drop(&mut self) {
4386 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4387 let _ = unsafe { Box::from_raw(self.contents.result) };
4390 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4391 let _ = unsafe { Box::from_raw(self.contents.err) };
4396 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4397 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4398 let contents = if o.result_ok {
4399 let result = unsafe { o.contents.result };
4400 unsafe { o.contents.result = std::ptr::null_mut() };
4401 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4403 let err = unsafe { o.contents.err };
4404 unsafe { o.contents.err = std::ptr::null_mut(); }
4405 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4409 result_ok: o.result_ok,
4414 /// The contents of CResult_ChannelConfigDecodeErrorZ
4415 pub union CResult_ChannelConfigDecodeErrorZPtr {
4416 /// A pointer to the contents in the success state.
4417 /// Reading from this pointer when `result_ok` is not set is undefined.
4418 pub result: *mut crate::lightning::util::config::ChannelConfig,
4419 /// A pointer to the contents in the error state.
4420 /// Reading from this pointer when `result_ok` is set is undefined.
4421 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4424 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4425 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4427 pub struct CResult_ChannelConfigDecodeErrorZ {
4428 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4429 /// `err` or `result` depending on the state of `result_ok`.
4430 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4431 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4432 pub result_ok: bool,
4435 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4436 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4437 CResult_ChannelConfigDecodeErrorZ {
4438 contents: CResult_ChannelConfigDecodeErrorZPtr {
4439 result: Box::into_raw(Box::new(o)),
4445 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4446 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4447 CResult_ChannelConfigDecodeErrorZ {
4448 contents: CResult_ChannelConfigDecodeErrorZPtr {
4449 err: Box::into_raw(Box::new(e)),
4455 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4456 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4457 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4458 fn drop(&mut self) {
4460 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4461 let _ = unsafe { Box::from_raw(self.contents.result) };
4464 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4465 let _ = unsafe { Box::from_raw(self.contents.err) };
4470 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4471 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4472 let contents = if o.result_ok {
4473 let result = unsafe { o.contents.result };
4474 unsafe { o.contents.result = std::ptr::null_mut() };
4475 CResult_ChannelConfigDecodeErrorZPtr { result }
4477 let err = unsafe { o.contents.err };
4478 unsafe { o.contents.err = std::ptr::null_mut(); }
4479 CResult_ChannelConfigDecodeErrorZPtr { err }
4483 result_ok: o.result_ok,
4487 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4488 fn clone(&self) -> Self {
4490 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4491 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4494 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4495 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4501 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4502 /// but with all dynamically-allocated buffers duplicated in new buffers.
4503 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
4505 /// The contents of CResult_OutPointDecodeErrorZ
4506 pub union CResult_OutPointDecodeErrorZPtr {
4507 /// A pointer to the contents in the success state.
4508 /// Reading from this pointer when `result_ok` is not set is undefined.
4509 pub result: *mut crate::lightning::chain::transaction::OutPoint,
4510 /// A pointer to the contents in the error state.
4511 /// Reading from this pointer when `result_ok` is set is undefined.
4512 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4515 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4516 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4518 pub struct CResult_OutPointDecodeErrorZ {
4519 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4520 /// `err` or `result` depending on the state of `result_ok`.
4521 pub contents: CResult_OutPointDecodeErrorZPtr,
4522 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4523 pub result_ok: bool,
4526 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4527 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4528 CResult_OutPointDecodeErrorZ {
4529 contents: CResult_OutPointDecodeErrorZPtr {
4530 result: Box::into_raw(Box::new(o)),
4536 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4537 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4538 CResult_OutPointDecodeErrorZ {
4539 contents: CResult_OutPointDecodeErrorZPtr {
4540 err: Box::into_raw(Box::new(e)),
4546 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
4547 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
4548 impl Drop for CResult_OutPointDecodeErrorZ {
4549 fn drop(&mut self) {
4551 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4552 let _ = unsafe { Box::from_raw(self.contents.result) };
4555 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4556 let _ = unsafe { Box::from_raw(self.contents.err) };
4561 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
4562 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4563 let contents = if o.result_ok {
4564 let result = unsafe { o.contents.result };
4565 unsafe { o.contents.result = std::ptr::null_mut() };
4566 CResult_OutPointDecodeErrorZPtr { result }
4568 let err = unsafe { o.contents.err };
4569 unsafe { o.contents.err = std::ptr::null_mut(); }
4570 CResult_OutPointDecodeErrorZPtr { err }
4574 result_ok: o.result_ok,
4578 impl Clone for CResult_OutPointDecodeErrorZ {
4579 fn clone(&self) -> Self {
4581 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
4582 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
4585 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
4586 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4592 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
4593 /// but with all dynamically-allocated buffers duplicated in new buffers.
4594 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
4596 /// The contents of CResult_SiPrefixNoneZ
4597 pub union CResult_SiPrefixNoneZPtr {
4598 /// A pointer to the contents in the success state.
4599 /// Reading from this pointer when `result_ok` is not set is undefined.
4600 pub result: *mut crate::lightning_invoice::SiPrefix,
4601 /// Note that this value is always NULL, as there are no contents in the Err variant
4602 pub err: *mut std::ffi::c_void,
4605 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4606 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4608 pub struct CResult_SiPrefixNoneZ {
4609 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
4610 /// `err` or `result` depending on the state of `result_ok`.
4611 pub contents: CResult_SiPrefixNoneZPtr,
4612 /// Whether this CResult_SiPrefixNoneZ represents a success state.
4613 pub result_ok: bool,
4616 /// Creates a new CResult_SiPrefixNoneZ in the success state.
4617 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
4618 CResult_SiPrefixNoneZ {
4619 contents: CResult_SiPrefixNoneZPtr {
4620 result: Box::into_raw(Box::new(o)),
4626 /// Creates a new CResult_SiPrefixNoneZ in the error state.
4627 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
4628 CResult_SiPrefixNoneZ {
4629 contents: CResult_SiPrefixNoneZPtr {
4630 err: std::ptr::null_mut(),
4636 /// Frees any resources used by the CResult_SiPrefixNoneZ.
4637 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
4638 impl Drop for CResult_SiPrefixNoneZ {
4639 fn drop(&mut self) {
4641 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4642 let _ = unsafe { Box::from_raw(self.contents.result) };
4648 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
4649 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
4650 let contents = if o.result_ok {
4651 let result = unsafe { o.contents.result };
4652 unsafe { o.contents.result = std::ptr::null_mut() };
4653 CResult_SiPrefixNoneZPtr { result }
4655 let _ = unsafe { Box::from_raw(o.contents.err) };
4656 o.contents.err = std::ptr::null_mut();
4657 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
4661 result_ok: o.result_ok,
4665 impl Clone for CResult_SiPrefixNoneZ {
4666 fn clone(&self) -> Self {
4668 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
4669 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
4672 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
4673 err: std::ptr::null_mut()
4679 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
4680 /// but with all dynamically-allocated buffers duplicated in new buffers.
4681 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
4683 /// The contents of CResult_InvoiceNoneZ
4684 pub union CResult_InvoiceNoneZPtr {
4685 /// A pointer to the contents in the success state.
4686 /// Reading from this pointer when `result_ok` is not set is undefined.
4687 pub result: *mut crate::lightning_invoice::Invoice,
4688 /// Note that this value is always NULL, as there are no contents in the Err variant
4689 pub err: *mut std::ffi::c_void,
4692 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
4693 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
4694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4695 pub struct CResult_InvoiceNoneZ {
4696 /// The contents of this CResult_InvoiceNoneZ, accessible via either
4697 /// `err` or `result` depending on the state of `result_ok`.
4698 pub contents: CResult_InvoiceNoneZPtr,
4699 /// Whether this CResult_InvoiceNoneZ represents a success state.
4700 pub result_ok: bool,
4703 /// Creates a new CResult_InvoiceNoneZ in the success state.
4704 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
4705 CResult_InvoiceNoneZ {
4706 contents: CResult_InvoiceNoneZPtr {
4707 result: Box::into_raw(Box::new(o)),
4713 /// Creates a new CResult_InvoiceNoneZ in the error state.
4714 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
4715 CResult_InvoiceNoneZ {
4716 contents: CResult_InvoiceNoneZPtr {
4717 err: std::ptr::null_mut(),
4723 /// Frees any resources used by the CResult_InvoiceNoneZ.
4724 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
4725 impl Drop for CResult_InvoiceNoneZ {
4726 fn drop(&mut self) {
4728 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4729 let _ = unsafe { Box::from_raw(self.contents.result) };
4735 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
4736 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
4737 let contents = if o.result_ok {
4738 let result = unsafe { o.contents.result };
4739 unsafe { o.contents.result = std::ptr::null_mut() };
4740 CResult_InvoiceNoneZPtr { result }
4742 let _ = unsafe { Box::from_raw(o.contents.err) };
4743 o.contents.err = std::ptr::null_mut();
4744 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
4748 result_ok: o.result_ok,
4752 impl Clone for CResult_InvoiceNoneZ {
4753 fn clone(&self) -> Self {
4755 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
4756 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
4759 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
4760 err: std::ptr::null_mut()
4766 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
4767 /// but with all dynamically-allocated buffers duplicated in new buffers.
4768 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
4770 /// The contents of CResult_SignedRawInvoiceNoneZ
4771 pub union CResult_SignedRawInvoiceNoneZPtr {
4772 /// A pointer to the contents in the success state.
4773 /// Reading from this pointer when `result_ok` is not set is undefined.
4774 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
4775 /// Note that this value is always NULL, as there are no contents in the Err variant
4776 pub err: *mut std::ffi::c_void,
4779 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4780 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4782 pub struct CResult_SignedRawInvoiceNoneZ {
4783 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4784 /// `err` or `result` depending on the state of `result_ok`.
4785 pub contents: CResult_SignedRawInvoiceNoneZPtr,
4786 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4787 pub result_ok: bool,
4790 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
4791 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
4792 CResult_SignedRawInvoiceNoneZ {
4793 contents: CResult_SignedRawInvoiceNoneZPtr {
4794 result: Box::into_raw(Box::new(o)),
4800 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
4801 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
4802 CResult_SignedRawInvoiceNoneZ {
4803 contents: CResult_SignedRawInvoiceNoneZPtr {
4804 err: std::ptr::null_mut(),
4810 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
4811 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
4812 impl Drop for CResult_SignedRawInvoiceNoneZ {
4813 fn drop(&mut self) {
4815 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4816 let _ = unsafe { Box::from_raw(self.contents.result) };
4822 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
4823 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
4824 let contents = if o.result_ok {
4825 let result = unsafe { o.contents.result };
4826 unsafe { o.contents.result = std::ptr::null_mut() };
4827 CResult_SignedRawInvoiceNoneZPtr { result }
4829 let _ = unsafe { Box::from_raw(o.contents.err) };
4830 o.contents.err = std::ptr::null_mut();
4831 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
4835 result_ok: o.result_ok,
4839 impl Clone for CResult_SignedRawInvoiceNoneZ {
4840 fn clone(&self) -> Self {
4842 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
4843 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
4846 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
4847 err: std::ptr::null_mut()
4853 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
4854 /// but with all dynamically-allocated buffers duplicated in new buffers.
4855 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
4857 /// A tuple of 3 elements. See the individual fields for the types contained.
4858 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4859 /// The element at position 0
4860 pub a: crate::lightning_invoice::RawInvoice,
4861 /// The element at position 1
4862 pub b: crate::c_types::ThirtyTwoBytes,
4863 /// The element at position 2
4864 pub c: crate::lightning_invoice::InvoiceSignature,
4866 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4867 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
4875 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4876 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
4877 (self.a, self.b, self.c)
4880 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4881 fn clone(&self) -> Self {
4890 /// Creates a new tuple which has the same data as `orig`
4891 /// but with all dynamically-allocated buffers duplicated in new buffers.
4892 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { orig.clone() }
4893 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
4895 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 {
4896 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
4900 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
4901 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
4903 /// The contents of CResult_PayeePubKeyErrorZ
4904 pub union CResult_PayeePubKeyErrorZPtr {
4905 /// A pointer to the contents in the success state.
4906 /// Reading from this pointer when `result_ok` is not set is undefined.
4907 pub result: *mut crate::lightning_invoice::PayeePubKey,
4908 /// A pointer to the contents in the error state.
4909 /// Reading from this pointer when `result_ok` is set is undefined.
4910 pub err: *mut crate::c_types::Secp256k1Error,
4913 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
4914 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
4915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4916 pub struct CResult_PayeePubKeyErrorZ {
4917 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
4918 /// `err` or `result` depending on the state of `result_ok`.
4919 pub contents: CResult_PayeePubKeyErrorZPtr,
4920 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
4921 pub result_ok: bool,
4924 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
4925 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
4926 CResult_PayeePubKeyErrorZ {
4927 contents: CResult_PayeePubKeyErrorZPtr {
4928 result: Box::into_raw(Box::new(o)),
4934 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
4935 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
4936 CResult_PayeePubKeyErrorZ {
4937 contents: CResult_PayeePubKeyErrorZPtr {
4938 err: Box::into_raw(Box::new(e)),
4944 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
4945 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
4946 impl Drop for CResult_PayeePubKeyErrorZ {
4947 fn drop(&mut self) {
4949 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4950 let _ = unsafe { Box::from_raw(self.contents.result) };
4953 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4954 let _ = unsafe { Box::from_raw(self.contents.err) };
4959 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
4960 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
4961 let contents = if o.result_ok {
4962 let result = unsafe { o.contents.result };
4963 unsafe { o.contents.result = std::ptr::null_mut() };
4964 CResult_PayeePubKeyErrorZPtr { result }
4966 let err = unsafe { o.contents.err };
4967 unsafe { o.contents.err = std::ptr::null_mut(); }
4968 CResult_PayeePubKeyErrorZPtr { err }
4972 result_ok: o.result_ok,
4976 impl Clone for CResult_PayeePubKeyErrorZ {
4977 fn clone(&self) -> Self {
4979 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
4980 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
4983 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
4984 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
4990 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
4991 /// but with all dynamically-allocated buffers duplicated in new buffers.
4992 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { orig.clone() }
4994 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
4995 /// This corresponds to std::vector in C++
4996 pub struct CVec_PrivateRouteZ {
4997 /// The elements in the array.
4998 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4999 pub data: *mut crate::lightning_invoice::PrivateRoute,
5000 /// The number of elements pointed to by `data`.
5003 impl CVec_PrivateRouteZ {
5004 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5005 if self.datalen == 0 { return Vec::new(); }
5006 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5007 self.data = std::ptr::null_mut();
5011 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5012 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5015 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5016 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5017 let datalen = v.len();
5018 let data = Box::into_raw(v.into_boxed_slice());
5019 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5023 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5024 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5025 impl Drop for CVec_PrivateRouteZ {
5026 fn drop(&mut self) {
5027 if self.datalen == 0 { return; }
5028 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5031 impl Clone for CVec_PrivateRouteZ {
5032 fn clone(&self) -> Self {
5033 let mut res = Vec::new();
5034 if self.datalen == 0 { return Self::from(res); }
5035 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5040 /// The contents of CResult_PositiveTimestampCreationErrorZ
5041 pub union CResult_PositiveTimestampCreationErrorZPtr {
5042 /// A pointer to the contents in the success state.
5043 /// Reading from this pointer when `result_ok` is not set is undefined.
5044 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5045 /// A pointer to the contents in the error state.
5046 /// Reading from this pointer when `result_ok` is set is undefined.
5047 pub err: *mut crate::lightning_invoice::CreationError,
5050 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5051 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5053 pub struct CResult_PositiveTimestampCreationErrorZ {
5054 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5055 /// `err` or `result` depending on the state of `result_ok`.
5056 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5057 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5058 pub result_ok: bool,
5061 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5062 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5063 CResult_PositiveTimestampCreationErrorZ {
5064 contents: CResult_PositiveTimestampCreationErrorZPtr {
5065 result: Box::into_raw(Box::new(o)),
5071 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5072 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5073 CResult_PositiveTimestampCreationErrorZ {
5074 contents: CResult_PositiveTimestampCreationErrorZPtr {
5075 err: Box::into_raw(Box::new(e)),
5081 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5082 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5083 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5084 fn drop(&mut self) {
5086 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5087 let _ = unsafe { Box::from_raw(self.contents.result) };
5090 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5091 let _ = unsafe { Box::from_raw(self.contents.err) };
5096 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5097 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5098 let contents = if o.result_ok {
5099 let result = unsafe { o.contents.result };
5100 unsafe { o.contents.result = std::ptr::null_mut() };
5101 CResult_PositiveTimestampCreationErrorZPtr { result }
5103 let err = unsafe { o.contents.err };
5104 unsafe { o.contents.err = std::ptr::null_mut(); }
5105 CResult_PositiveTimestampCreationErrorZPtr { err }
5109 result_ok: o.result_ok,
5113 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5114 fn clone(&self) -> Self {
5116 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5117 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5120 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5121 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5127 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5128 /// but with all dynamically-allocated buffers duplicated in new buffers.
5129 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
5131 /// The contents of CResult_NoneSemanticErrorZ
5132 pub union CResult_NoneSemanticErrorZPtr {
5133 /// Note that this value is always NULL, as there are no contents in the OK variant
5134 pub result: *mut std::ffi::c_void,
5135 /// A pointer to the contents in the error state.
5136 /// Reading from this pointer when `result_ok` is set is undefined.
5137 pub err: *mut crate::lightning_invoice::SemanticError,
5140 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5141 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5143 pub struct CResult_NoneSemanticErrorZ {
5144 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5145 /// `err` or `result` depending on the state of `result_ok`.
5146 pub contents: CResult_NoneSemanticErrorZPtr,
5147 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5148 pub result_ok: bool,
5151 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5152 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5153 CResult_NoneSemanticErrorZ {
5154 contents: CResult_NoneSemanticErrorZPtr {
5155 result: std::ptr::null_mut(),
5161 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5162 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5163 CResult_NoneSemanticErrorZ {
5164 contents: CResult_NoneSemanticErrorZPtr {
5165 err: Box::into_raw(Box::new(e)),
5171 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5172 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5173 impl Drop for CResult_NoneSemanticErrorZ {
5174 fn drop(&mut self) {
5177 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5178 let _ = unsafe { Box::from_raw(self.contents.err) };
5183 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5184 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5185 let contents = if o.result_ok {
5186 let _ = unsafe { Box::from_raw(o.contents.result) };
5187 o.contents.result = std::ptr::null_mut();
5188 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5190 let err = unsafe { o.contents.err };
5191 unsafe { o.contents.err = std::ptr::null_mut(); }
5192 CResult_NoneSemanticErrorZPtr { err }
5196 result_ok: o.result_ok,
5200 impl Clone for CResult_NoneSemanticErrorZ {
5201 fn clone(&self) -> Self {
5203 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5204 result: std::ptr::null_mut()
5207 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5208 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5214 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5215 /// but with all dynamically-allocated buffers duplicated in new buffers.
5216 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
5218 /// The contents of CResult_InvoiceSemanticErrorZ
5219 pub union CResult_InvoiceSemanticErrorZPtr {
5220 /// A pointer to the contents in the success state.
5221 /// Reading from this pointer when `result_ok` is not set is undefined.
5222 pub result: *mut crate::lightning_invoice::Invoice,
5223 /// A pointer to the contents in the error state.
5224 /// Reading from this pointer when `result_ok` is set is undefined.
5225 pub err: *mut crate::lightning_invoice::SemanticError,
5228 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5229 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5231 pub struct CResult_InvoiceSemanticErrorZ {
5232 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5233 /// `err` or `result` depending on the state of `result_ok`.
5234 pub contents: CResult_InvoiceSemanticErrorZPtr,
5235 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5236 pub result_ok: bool,
5239 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5240 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5241 CResult_InvoiceSemanticErrorZ {
5242 contents: CResult_InvoiceSemanticErrorZPtr {
5243 result: Box::into_raw(Box::new(o)),
5249 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5250 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5251 CResult_InvoiceSemanticErrorZ {
5252 contents: CResult_InvoiceSemanticErrorZPtr {
5253 err: Box::into_raw(Box::new(e)),
5259 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
5260 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5261 impl Drop for CResult_InvoiceSemanticErrorZ {
5262 fn drop(&mut self) {
5264 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5265 let _ = unsafe { Box::from_raw(self.contents.result) };
5268 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5269 let _ = unsafe { Box::from_raw(self.contents.err) };
5274 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5275 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
5276 let contents = if o.result_ok {
5277 let result = unsafe { o.contents.result };
5278 unsafe { o.contents.result = std::ptr::null_mut() };
5279 CResult_InvoiceSemanticErrorZPtr { result }
5281 let err = unsafe { o.contents.err };
5282 unsafe { o.contents.err = std::ptr::null_mut(); }
5283 CResult_InvoiceSemanticErrorZPtr { err }
5287 result_ok: o.result_ok,
5291 impl Clone for CResult_InvoiceSemanticErrorZ {
5292 fn clone(&self) -> Self {
5294 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5295 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5298 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
5299 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5305 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
5306 /// but with all dynamically-allocated buffers duplicated in new buffers.
5307 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
5309 /// The contents of CResult_DescriptionCreationErrorZ
5310 pub union CResult_DescriptionCreationErrorZPtr {
5311 /// A pointer to the contents in the success state.
5312 /// Reading from this pointer when `result_ok` is not set is undefined.
5313 pub result: *mut crate::lightning_invoice::Description,
5314 /// A pointer to the contents in the error state.
5315 /// Reading from this pointer when `result_ok` is set is undefined.
5316 pub err: *mut crate::lightning_invoice::CreationError,
5319 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5320 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5321 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5322 pub struct CResult_DescriptionCreationErrorZ {
5323 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5324 /// `err` or `result` depending on the state of `result_ok`.
5325 pub contents: CResult_DescriptionCreationErrorZPtr,
5326 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5327 pub result_ok: bool,
5330 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5331 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5332 CResult_DescriptionCreationErrorZ {
5333 contents: CResult_DescriptionCreationErrorZPtr {
5334 result: Box::into_raw(Box::new(o)),
5340 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5341 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5342 CResult_DescriptionCreationErrorZ {
5343 contents: CResult_DescriptionCreationErrorZPtr {
5344 err: Box::into_raw(Box::new(e)),
5350 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
5351 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5352 impl Drop for CResult_DescriptionCreationErrorZ {
5353 fn drop(&mut self) {
5355 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5356 let _ = unsafe { Box::from_raw(self.contents.result) };
5359 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5360 let _ = unsafe { Box::from_raw(self.contents.err) };
5365 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5366 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
5367 let contents = if o.result_ok {
5368 let result = unsafe { o.contents.result };
5369 unsafe { o.contents.result = std::ptr::null_mut() };
5370 CResult_DescriptionCreationErrorZPtr { result }
5372 let err = unsafe { o.contents.err };
5373 unsafe { o.contents.err = std::ptr::null_mut(); }
5374 CResult_DescriptionCreationErrorZPtr { err }
5378 result_ok: o.result_ok,
5382 impl Clone for CResult_DescriptionCreationErrorZ {
5383 fn clone(&self) -> Self {
5385 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5386 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5389 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5390 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5396 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5397 /// but with all dynamically-allocated buffers duplicated in new buffers.
5398 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
5400 /// The contents of CResult_ExpiryTimeCreationErrorZ
5401 pub union CResult_ExpiryTimeCreationErrorZPtr {
5402 /// A pointer to the contents in the success state.
5403 /// Reading from this pointer when `result_ok` is not set is undefined.
5404 pub result: *mut crate::lightning_invoice::ExpiryTime,
5405 /// A pointer to the contents in the error state.
5406 /// Reading from this pointer when `result_ok` is set is undefined.
5407 pub err: *mut crate::lightning_invoice::CreationError,
5410 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5411 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5412 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5413 pub struct CResult_ExpiryTimeCreationErrorZ {
5414 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5415 /// `err` or `result` depending on the state of `result_ok`.
5416 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5417 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5418 pub result_ok: bool,
5421 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5422 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5423 CResult_ExpiryTimeCreationErrorZ {
5424 contents: CResult_ExpiryTimeCreationErrorZPtr {
5425 result: Box::into_raw(Box::new(o)),
5431 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5432 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5433 CResult_ExpiryTimeCreationErrorZ {
5434 contents: CResult_ExpiryTimeCreationErrorZPtr {
5435 err: Box::into_raw(Box::new(e)),
5441 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
5442 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
5443 impl Drop for CResult_ExpiryTimeCreationErrorZ {
5444 fn drop(&mut self) {
5446 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5447 let _ = unsafe { Box::from_raw(self.contents.result) };
5450 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5451 let _ = unsafe { Box::from_raw(self.contents.err) };
5456 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
5457 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
5458 let contents = if o.result_ok {
5459 let result = unsafe { o.contents.result };
5460 unsafe { o.contents.result = std::ptr::null_mut() };
5461 CResult_ExpiryTimeCreationErrorZPtr { result }
5463 let err = unsafe { o.contents.err };
5464 unsafe { o.contents.err = std::ptr::null_mut(); }
5465 CResult_ExpiryTimeCreationErrorZPtr { err }
5469 result_ok: o.result_ok,
5473 impl Clone for CResult_ExpiryTimeCreationErrorZ {
5474 fn clone(&self) -> Self {
5476 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
5477 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
5480 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
5481 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5487 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
5488 /// but with all dynamically-allocated buffers duplicated in new buffers.
5489 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
5491 /// The contents of CResult_PrivateRouteCreationErrorZ
5492 pub union CResult_PrivateRouteCreationErrorZPtr {
5493 /// A pointer to the contents in the success state.
5494 /// Reading from this pointer when `result_ok` is not set is undefined.
5495 pub result: *mut crate::lightning_invoice::PrivateRoute,
5496 /// A pointer to the contents in the error state.
5497 /// Reading from this pointer when `result_ok` is set is undefined.
5498 pub err: *mut crate::lightning_invoice::CreationError,
5501 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5502 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5504 pub struct CResult_PrivateRouteCreationErrorZ {
5505 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5506 /// `err` or `result` depending on the state of `result_ok`.
5507 pub contents: CResult_PrivateRouteCreationErrorZPtr,
5508 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5509 pub result_ok: bool,
5512 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
5513 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
5514 CResult_PrivateRouteCreationErrorZ {
5515 contents: CResult_PrivateRouteCreationErrorZPtr {
5516 result: Box::into_raw(Box::new(o)),
5522 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
5523 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
5524 CResult_PrivateRouteCreationErrorZ {
5525 contents: CResult_PrivateRouteCreationErrorZPtr {
5526 err: Box::into_raw(Box::new(e)),
5532 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
5533 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
5534 impl Drop for CResult_PrivateRouteCreationErrorZ {
5535 fn drop(&mut self) {
5537 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5538 let _ = unsafe { Box::from_raw(self.contents.result) };
5541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5542 let _ = unsafe { Box::from_raw(self.contents.err) };
5547 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
5548 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
5549 let contents = if o.result_ok {
5550 let result = unsafe { o.contents.result };
5551 unsafe { o.contents.result = std::ptr::null_mut() };
5552 CResult_PrivateRouteCreationErrorZPtr { result }
5554 let err = unsafe { o.contents.err };
5555 unsafe { o.contents.err = std::ptr::null_mut(); }
5556 CResult_PrivateRouteCreationErrorZPtr { err }
5560 result_ok: o.result_ok,
5564 impl Clone for CResult_PrivateRouteCreationErrorZ {
5565 fn clone(&self) -> Self {
5567 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
5568 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
5571 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
5572 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5578 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
5579 /// but with all dynamically-allocated buffers duplicated in new buffers.
5580 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { orig.clone() }
5582 /// The contents of CResult_StringErrorZ
5583 pub union CResult_StringErrorZPtr {
5584 /// A pointer to the contents in the success state.
5585 /// Reading from this pointer when `result_ok` is not set is undefined.
5586 pub result: *mut crate::c_types::Str,
5587 /// A pointer to the contents in the error state.
5588 /// Reading from this pointer when `result_ok` is set is undefined.
5589 pub err: *mut crate::c_types::Secp256k1Error,
5592 /// A CResult_StringErrorZ represents the result of a fallible operation,
5593 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5595 pub struct CResult_StringErrorZ {
5596 /// The contents of this CResult_StringErrorZ, accessible via either
5597 /// `err` or `result` depending on the state of `result_ok`.
5598 pub contents: CResult_StringErrorZPtr,
5599 /// Whether this CResult_StringErrorZ represents a success state.
5600 pub result_ok: bool,
5603 /// Creates a new CResult_StringErrorZ in the success state.
5604 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
5605 CResult_StringErrorZ {
5606 contents: CResult_StringErrorZPtr {
5607 result: Box::into_raw(Box::new(o)),
5613 /// Creates a new CResult_StringErrorZ in the error state.
5614 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
5615 CResult_StringErrorZ {
5616 contents: CResult_StringErrorZPtr {
5617 err: Box::into_raw(Box::new(e)),
5623 /// Frees any resources used by the CResult_StringErrorZ.
5624 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
5625 impl Drop for CResult_StringErrorZ {
5626 fn drop(&mut self) {
5628 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5629 let _ = unsafe { Box::from_raw(self.contents.result) };
5632 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5633 let _ = unsafe { Box::from_raw(self.contents.err) };
5638 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
5639 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
5640 let contents = if o.result_ok {
5641 let result = unsafe { o.contents.result };
5642 unsafe { o.contents.result = std::ptr::null_mut() };
5643 CResult_StringErrorZPtr { result }
5645 let err = unsafe { o.contents.err };
5646 unsafe { o.contents.err = std::ptr::null_mut(); }
5647 CResult_StringErrorZPtr { err }
5651 result_ok: o.result_ok,
5656 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5657 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5658 /// A pointer to the contents in the success state.
5659 /// Reading from this pointer when `result_ok` is not set is undefined.
5660 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
5661 /// A pointer to the contents in the error state.
5662 /// Reading from this pointer when `result_ok` is set is undefined.
5663 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5666 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5667 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5669 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
5670 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5671 /// `err` or `result` depending on the state of `result_ok`.
5672 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
5673 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5674 pub result_ok: bool,
5677 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
5678 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5679 CResult_ChannelMonitorUpdateDecodeErrorZ {
5680 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5681 result: Box::into_raw(Box::new(o)),
5687 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
5688 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5689 CResult_ChannelMonitorUpdateDecodeErrorZ {
5690 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5691 err: Box::into_raw(Box::new(e)),
5697 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
5698 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
5699 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
5700 fn drop(&mut self) {
5702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5703 let _ = unsafe { Box::from_raw(self.contents.result) };
5706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5707 let _ = unsafe { Box::from_raw(self.contents.err) };
5712 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
5713 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5714 let contents = if o.result_ok {
5715 let result = unsafe { o.contents.result };
5716 unsafe { o.contents.result = std::ptr::null_mut() };
5717 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
5719 let err = unsafe { o.contents.err };
5720 unsafe { o.contents.err = std::ptr::null_mut(); }
5721 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
5725 result_ok: o.result_ok,
5729 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
5730 fn clone(&self) -> Self {
5732 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5733 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
5736 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5737 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5743 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
5744 /// but with all dynamically-allocated buffers duplicated in new buffers.
5745 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
5747 /// The contents of CResult_HTLCUpdateDecodeErrorZ
5748 pub union CResult_HTLCUpdateDecodeErrorZPtr {
5749 /// A pointer to the contents in the success state.
5750 /// Reading from this pointer when `result_ok` is not set is undefined.
5751 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
5752 /// A pointer to the contents in the error state.
5753 /// Reading from this pointer when `result_ok` is set is undefined.
5754 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5757 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5758 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5760 pub struct CResult_HTLCUpdateDecodeErrorZ {
5761 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5762 /// `err` or `result` depending on the state of `result_ok`.
5763 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
5764 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5765 pub result_ok: bool,
5768 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
5769 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
5770 CResult_HTLCUpdateDecodeErrorZ {
5771 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5772 result: Box::into_raw(Box::new(o)),
5778 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
5779 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
5780 CResult_HTLCUpdateDecodeErrorZ {
5781 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5782 err: Box::into_raw(Box::new(e)),
5788 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
5789 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
5790 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
5791 fn drop(&mut self) {
5793 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5794 let _ = unsafe { Box::from_raw(self.contents.result) };
5797 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5798 let _ = unsafe { Box::from_raw(self.contents.err) };
5803 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
5804 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5805 let contents = if o.result_ok {
5806 let result = unsafe { o.contents.result };
5807 unsafe { o.contents.result = std::ptr::null_mut() };
5808 CResult_HTLCUpdateDecodeErrorZPtr { result }
5810 let err = unsafe { o.contents.err };
5811 unsafe { o.contents.err = std::ptr::null_mut(); }
5812 CResult_HTLCUpdateDecodeErrorZPtr { err }
5816 result_ok: o.result_ok,
5820 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
5821 fn clone(&self) -> Self {
5823 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5824 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
5827 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5828 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5834 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
5835 /// but with all dynamically-allocated buffers duplicated in new buffers.
5836 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
5838 /// The contents of CResult_NoneMonitorUpdateErrorZ
5839 pub union CResult_NoneMonitorUpdateErrorZPtr {
5840 /// Note that this value is always NULL, as there are no contents in the OK variant
5841 pub result: *mut std::ffi::c_void,
5842 /// A pointer to the contents in the error state.
5843 /// Reading from this pointer when `result_ok` is set is undefined.
5844 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
5847 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5848 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5850 pub struct CResult_NoneMonitorUpdateErrorZ {
5851 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5852 /// `err` or `result` depending on the state of `result_ok`.
5853 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
5854 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5855 pub result_ok: bool,
5858 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
5859 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
5860 CResult_NoneMonitorUpdateErrorZ {
5861 contents: CResult_NoneMonitorUpdateErrorZPtr {
5862 result: std::ptr::null_mut(),
5868 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
5869 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
5870 CResult_NoneMonitorUpdateErrorZ {
5871 contents: CResult_NoneMonitorUpdateErrorZPtr {
5872 err: Box::into_raw(Box::new(e)),
5878 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
5879 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
5880 impl Drop for CResult_NoneMonitorUpdateErrorZ {
5881 fn drop(&mut self) {
5884 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5885 let _ = unsafe { Box::from_raw(self.contents.err) };
5890 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
5891 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
5892 let contents = if o.result_ok {
5893 let _ = unsafe { Box::from_raw(o.contents.result) };
5894 o.contents.result = std::ptr::null_mut();
5895 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
5897 let err = unsafe { o.contents.err };
5898 unsafe { o.contents.err = std::ptr::null_mut(); }
5899 CResult_NoneMonitorUpdateErrorZPtr { err }
5903 result_ok: o.result_ok,
5907 impl Clone for CResult_NoneMonitorUpdateErrorZ {
5908 fn clone(&self) -> Self {
5910 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
5911 result: std::ptr::null_mut()
5914 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
5915 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
5921 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
5922 /// but with all dynamically-allocated buffers duplicated in new buffers.
5923 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
5925 /// A tuple of 2 elements. See the individual fields for the types contained.
5926 pub struct C2Tuple_OutPointScriptZ {
5927 /// The element at position 0
5928 pub a: crate::lightning::chain::transaction::OutPoint,
5929 /// The element at position 1
5930 pub b: crate::c_types::derived::CVec_u8Z,
5932 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
5933 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
5940 impl C2Tuple_OutPointScriptZ {
5941 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
5945 impl Clone for C2Tuple_OutPointScriptZ {
5946 fn clone(&self) -> Self {
5954 /// Creates a new tuple which has the same data as `orig`
5955 /// but with all dynamically-allocated buffers duplicated in new buffers.
5956 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
5957 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
5959 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
5960 C2Tuple_OutPointScriptZ { a, b, }
5964 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
5965 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
5967 /// A tuple of 2 elements. See the individual fields for the types contained.
5968 pub struct C2Tuple_u32ScriptZ {
5969 /// The element at position 0
5971 /// The element at position 1
5972 pub b: crate::c_types::derived::CVec_u8Z,
5974 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
5975 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
5982 impl C2Tuple_u32ScriptZ {
5983 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
5987 impl Clone for C2Tuple_u32ScriptZ {
5988 fn clone(&self) -> Self {
5996 /// Creates a new tuple which has the same data as `orig`
5997 /// but with all dynamically-allocated buffers duplicated in new buffers.
5998 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
5999 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6001 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6002 C2Tuple_u32ScriptZ { a, b, }
6006 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6007 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6009 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6010 /// This corresponds to std::vector in C++
6011 pub struct CVec_C2Tuple_u32ScriptZZ {
6012 /// The elements in the array.
6013 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6014 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6015 /// The number of elements pointed to by `data`.
6018 impl CVec_C2Tuple_u32ScriptZZ {
6019 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6020 if self.datalen == 0 { return Vec::new(); }
6021 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6022 self.data = std::ptr::null_mut();
6026 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6027 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6030 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6031 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6032 let datalen = v.len();
6033 let data = Box::into_raw(v.into_boxed_slice());
6034 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6038 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6039 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6040 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6041 fn drop(&mut self) {
6042 if self.datalen == 0 { return; }
6043 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6046 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6047 fn clone(&self) -> Self {
6048 let mut res = Vec::new();
6049 if self.datalen == 0 { return Self::from(res); }
6050 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6055 /// A tuple of 2 elements. See the individual fields for the types contained.
6056 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6057 /// The element at position 0
6058 pub a: crate::c_types::ThirtyTwoBytes,
6059 /// The element at position 1
6060 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6062 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6063 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6070 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6071 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6075 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6076 fn clone(&self) -> Self {
6084 /// Creates a new tuple which has the same data as `orig`
6085 /// but with all dynamically-allocated buffers duplicated in new buffers.
6086 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { orig.clone() }
6087 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6089 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 {
6090 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6094 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6095 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6097 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6098 /// This corresponds to std::vector in C++
6099 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6100 /// The elements in the array.
6101 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6102 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6103 /// The number of elements pointed to by `data`.
6106 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6107 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6108 if self.datalen == 0 { return Vec::new(); }
6109 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6110 self.data = std::ptr::null_mut();
6114 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6115 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6118 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6119 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6120 let datalen = v.len();
6121 let data = Box::into_raw(v.into_boxed_slice());
6122 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6126 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6127 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6128 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6129 fn drop(&mut self) {
6130 if self.datalen == 0 { return; }
6131 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6134 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6135 fn clone(&self) -> Self {
6136 let mut res = Vec::new();
6137 if self.datalen == 0 { return Self::from(res); }
6138 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6143 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6144 /// This corresponds to std::vector in C++
6145 pub struct CVec_EventZ {
6146 /// The elements in the array.
6147 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6148 pub data: *mut crate::lightning::util::events::Event,
6149 /// The number of elements pointed to by `data`.
6153 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6154 if self.datalen == 0 { return Vec::new(); }
6155 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6156 self.data = std::ptr::null_mut();
6160 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6161 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6164 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6165 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6166 let datalen = v.len();
6167 let data = Box::into_raw(v.into_boxed_slice());
6168 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6172 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6173 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6174 impl Drop for CVec_EventZ {
6175 fn drop(&mut self) {
6176 if self.datalen == 0 { return; }
6177 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6180 impl Clone for CVec_EventZ {
6181 fn clone(&self) -> Self {
6182 let mut res = Vec::new();
6183 if self.datalen == 0 { return Self::from(res); }
6184 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6189 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6190 /// This corresponds to std::vector in C++
6191 pub struct CVec_TransactionZ {
6192 /// The elements in the array.
6193 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6194 pub data: *mut crate::c_types::Transaction,
6195 /// The number of elements pointed to by `data`.
6198 impl CVec_TransactionZ {
6199 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6200 if self.datalen == 0 { return Vec::new(); }
6201 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6202 self.data = std::ptr::null_mut();
6206 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6207 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6210 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6211 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6212 let datalen = v.len();
6213 let data = Box::into_raw(v.into_boxed_slice());
6214 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6219 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6220 impl Drop for CVec_TransactionZ {
6221 fn drop(&mut self) {
6222 if self.datalen == 0 { return; }
6223 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6226 impl Clone for CVec_TransactionZ {
6227 fn clone(&self) -> Self {
6228 let mut res = Vec::new();
6229 if self.datalen == 0 { return Self::from(res); }
6230 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6235 /// A tuple of 2 elements. See the individual fields for the types contained.
6236 pub struct C2Tuple_u32TxOutZ {
6237 /// The element at position 0
6239 /// The element at position 1
6240 pub b: crate::c_types::TxOut,
6242 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6243 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6250 impl C2Tuple_u32TxOutZ {
6251 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6255 impl Clone for C2Tuple_u32TxOutZ {
6256 fn clone(&self) -> Self {
6264 /// Creates a new tuple which has the same data as `orig`
6265 /// but with all dynamically-allocated buffers duplicated in new buffers.
6266 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
6267 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6269 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6270 C2Tuple_u32TxOutZ { a, b, }
6274 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6275 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6277 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6278 /// This corresponds to std::vector in C++
6279 pub struct CVec_C2Tuple_u32TxOutZZ {
6280 /// The elements in the array.
6281 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6282 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6283 /// The number of elements pointed to by `data`.
6286 impl CVec_C2Tuple_u32TxOutZZ {
6287 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6288 if self.datalen == 0 { return Vec::new(); }
6289 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6290 self.data = std::ptr::null_mut();
6294 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6295 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6298 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6299 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6300 let datalen = v.len();
6301 let data = Box::into_raw(v.into_boxed_slice());
6302 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6306 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6307 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6308 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6309 fn drop(&mut self) {
6310 if self.datalen == 0 { return; }
6311 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6314 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6315 fn clone(&self) -> Self {
6316 let mut res = Vec::new();
6317 if self.datalen == 0 { return Self::from(res); }
6318 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6323 /// A tuple of 2 elements. See the individual fields for the types contained.
6324 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6325 /// The element at position 0
6326 pub a: crate::c_types::ThirtyTwoBytes,
6327 /// The element at position 1
6328 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6330 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6331 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6338 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6339 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6343 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6344 fn clone(&self) -> Self {
6352 /// Creates a new tuple which has the same data as `orig`
6353 /// but with all dynamically-allocated buffers duplicated in new buffers.
6354 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { orig.clone() }
6355 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6357 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 {
6358 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6362 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6363 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6365 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6366 /// This corresponds to std::vector in C++
6367 pub struct CVec_TransactionOutputsZ {
6368 /// The elements in the array.
6369 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6370 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6371 /// The number of elements pointed to by `data`.
6374 impl CVec_TransactionOutputsZ {
6375 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6376 if self.datalen == 0 { return Vec::new(); }
6377 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6378 self.data = std::ptr::null_mut();
6382 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6383 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6386 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6387 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6388 let datalen = v.len();
6389 let data = Box::into_raw(v.into_boxed_slice());
6390 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6394 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6395 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6396 impl Drop for CVec_TransactionOutputsZ {
6397 fn drop(&mut self) {
6398 if self.datalen == 0 { return; }
6399 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6402 impl Clone for CVec_TransactionOutputsZ {
6403 fn clone(&self) -> Self {
6404 let mut res = Vec::new();
6405 if self.datalen == 0 { return Self::from(res); }
6406 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6411 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6412 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6413 /// A pointer to the contents in the success state.
6414 /// Reading from this pointer when `result_ok` is not set is undefined.
6415 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
6416 /// A pointer to the contents in the error state.
6417 /// Reading from this pointer when `result_ok` is set is undefined.
6418 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6421 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6422 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6424 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6425 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6426 /// `err` or `result` depending on the state of `result_ok`.
6427 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
6428 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6429 pub result_ok: bool,
6432 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
6433 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6434 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6435 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6436 result: Box::into_raw(Box::new(o)),
6442 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
6443 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6444 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6445 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6446 err: Box::into_raw(Box::new(e)),
6452 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
6453 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
6454 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6455 fn drop(&mut self) {
6457 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6458 let _ = unsafe { Box::from_raw(self.contents.result) };
6461 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6462 let _ = unsafe { Box::from_raw(self.contents.err) };
6467 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6468 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6469 let contents = if o.result_ok {
6470 let result = unsafe { o.contents.result };
6471 unsafe { o.contents.result = std::ptr::null_mut() };
6472 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
6474 let err = unsafe { o.contents.err };
6475 unsafe { o.contents.err = std::ptr::null_mut(); }
6476 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
6480 result_ok: o.result_ok,
6485 /// The contents of CResult_boolLightningErrorZ
6486 pub union CResult_boolLightningErrorZPtr {
6487 /// A pointer to the contents in the success state.
6488 /// Reading from this pointer when `result_ok` is not set is undefined.
6489 pub result: *mut bool,
6490 /// A pointer to the contents in the error state.
6491 /// Reading from this pointer when `result_ok` is set is undefined.
6492 pub err: *mut crate::lightning::ln::msgs::LightningError,
6495 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6496 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6497 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6498 pub struct CResult_boolLightningErrorZ {
6499 /// The contents of this CResult_boolLightningErrorZ, accessible via either
6500 /// `err` or `result` depending on the state of `result_ok`.
6501 pub contents: CResult_boolLightningErrorZPtr,
6502 /// Whether this CResult_boolLightningErrorZ represents a success state.
6503 pub result_ok: bool,
6506 /// Creates a new CResult_boolLightningErrorZ in the success state.
6507 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6508 CResult_boolLightningErrorZ {
6509 contents: CResult_boolLightningErrorZPtr {
6510 result: Box::into_raw(Box::new(o)),
6516 /// Creates a new CResult_boolLightningErrorZ in the error state.
6517 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6518 CResult_boolLightningErrorZ {
6519 contents: CResult_boolLightningErrorZPtr {
6520 err: Box::into_raw(Box::new(e)),
6526 /// Frees any resources used by the CResult_boolLightningErrorZ.
6527 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6528 impl Drop for CResult_boolLightningErrorZ {
6529 fn drop(&mut self) {
6531 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6532 let _ = unsafe { Box::from_raw(self.contents.result) };
6535 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6536 let _ = unsafe { Box::from_raw(self.contents.err) };
6541 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6542 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6543 let contents = if o.result_ok {
6544 let result = unsafe { o.contents.result };
6545 unsafe { o.contents.result = std::ptr::null_mut() };
6546 CResult_boolLightningErrorZPtr { result }
6548 let err = unsafe { o.contents.err };
6549 unsafe { o.contents.err = std::ptr::null_mut(); }
6550 CResult_boolLightningErrorZPtr { err }
6554 result_ok: o.result_ok,
6558 impl Clone for CResult_boolLightningErrorZ {
6559 fn clone(&self) -> Self {
6561 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6562 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6565 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6566 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6572 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6573 /// but with all dynamically-allocated buffers duplicated in new buffers.
6574 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
6576 /// A tuple of 3 elements. See the individual fields for the types contained.
6577 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6578 /// The element at position 0
6579 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6580 /// The element at position 1
6581 pub b: crate::lightning::ln::msgs::ChannelUpdate,
6582 /// The element at position 2
6583 pub c: crate::lightning::ln::msgs::ChannelUpdate,
6585 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6586 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6594 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6595 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6596 (self.a, self.b, self.c)
6599 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6600 fn clone(&self) -> Self {
6609 /// Creates a new tuple which has the same data as `orig`
6610 /// but with all dynamically-allocated buffers duplicated in new buffers.
6611 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
6612 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6614 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 {
6615 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6619 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6620 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6622 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6623 /// This corresponds to std::vector in C++
6624 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6625 /// The elements in the array.
6626 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6627 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
6628 /// The number of elements pointed to by `data`.
6631 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6632 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
6633 if self.datalen == 0 { return Vec::new(); }
6634 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6635 self.data = std::ptr::null_mut();
6639 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
6640 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6643 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6644 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
6645 let datalen = v.len();
6646 let data = Box::into_raw(v.into_boxed_slice());
6647 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6651 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6652 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6653 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6654 fn drop(&mut self) {
6655 if self.datalen == 0 { return; }
6656 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6659 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6660 fn clone(&self) -> Self {
6661 let mut res = Vec::new();
6662 if self.datalen == 0 { return Self::from(res); }
6663 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6668 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6669 /// This corresponds to std::vector in C++
6670 pub struct CVec_NodeAnnouncementZ {
6671 /// The elements in the array.
6672 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6673 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
6674 /// The number of elements pointed to by `data`.
6677 impl CVec_NodeAnnouncementZ {
6678 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
6679 if self.datalen == 0 { return Vec::new(); }
6680 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6681 self.data = std::ptr::null_mut();
6685 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
6686 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6689 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
6690 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
6691 let datalen = v.len();
6692 let data = Box::into_raw(v.into_boxed_slice());
6693 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6697 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6698 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
6699 impl Drop for CVec_NodeAnnouncementZ {
6700 fn drop(&mut self) {
6701 if self.datalen == 0 { return; }
6702 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6705 impl Clone for CVec_NodeAnnouncementZ {
6706 fn clone(&self) -> Self {
6707 let mut res = Vec::new();
6708 if self.datalen == 0 { return Self::from(res); }
6709 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6714 /// The contents of CResult_NoneLightningErrorZ
6715 pub union CResult_NoneLightningErrorZPtr {
6716 /// Note that this value is always NULL, as there are no contents in the OK variant
6717 pub result: *mut std::ffi::c_void,
6718 /// A pointer to the contents in the error state.
6719 /// Reading from this pointer when `result_ok` is set is undefined.
6720 pub err: *mut crate::lightning::ln::msgs::LightningError,
6723 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6724 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6726 pub struct CResult_NoneLightningErrorZ {
6727 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6728 /// `err` or `result` depending on the state of `result_ok`.
6729 pub contents: CResult_NoneLightningErrorZPtr,
6730 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6731 pub result_ok: bool,
6734 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6735 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6736 CResult_NoneLightningErrorZ {
6737 contents: CResult_NoneLightningErrorZPtr {
6738 result: std::ptr::null_mut(),
6744 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6745 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6746 CResult_NoneLightningErrorZ {
6747 contents: CResult_NoneLightningErrorZPtr {
6748 err: Box::into_raw(Box::new(e)),
6754 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6755 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6756 impl Drop for CResult_NoneLightningErrorZ {
6757 fn drop(&mut self) {
6760 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6761 let _ = unsafe { Box::from_raw(self.contents.err) };
6766 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6767 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6768 let contents = if o.result_ok {
6769 let _ = unsafe { Box::from_raw(o.contents.result) };
6770 o.contents.result = std::ptr::null_mut();
6771 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
6773 let err = unsafe { o.contents.err };
6774 unsafe { o.contents.err = std::ptr::null_mut(); }
6775 CResult_NoneLightningErrorZPtr { err }
6779 result_ok: o.result_ok,
6783 impl Clone for CResult_NoneLightningErrorZ {
6784 fn clone(&self) -> Self {
6786 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6787 result: std::ptr::null_mut()
6790 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6791 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6797 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6798 /// but with all dynamically-allocated buffers duplicated in new buffers.
6799 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
6801 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
6802 /// This corresponds to std::vector in C++
6803 pub struct CVec_PublicKeyZ {
6804 /// The elements in the array.
6805 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6806 pub data: *mut crate::c_types::PublicKey,
6807 /// The number of elements pointed to by `data`.
6810 impl CVec_PublicKeyZ {
6811 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
6812 if self.datalen == 0 { return Vec::new(); }
6813 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6814 self.data = std::ptr::null_mut();
6818 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
6819 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6822 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
6823 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
6824 let datalen = v.len();
6825 let data = Box::into_raw(v.into_boxed_slice());
6826 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6830 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6831 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
6832 impl Drop for CVec_PublicKeyZ {
6833 fn drop(&mut self) {
6834 if self.datalen == 0 { return; }
6835 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6838 impl Clone for CVec_PublicKeyZ {
6839 fn clone(&self) -> Self {
6840 let mut res = Vec::new();
6841 if self.datalen == 0 { return Self::from(res); }
6842 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6847 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
6848 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
6849 /// A pointer to the contents in the success state.
6850 /// Reading from this pointer when `result_ok` is not set is undefined.
6851 pub result: *mut crate::c_types::derived::CVec_u8Z,
6852 /// A pointer to the contents in the error state.
6853 /// Reading from this pointer when `result_ok` is set is undefined.
6854 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6857 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
6858 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6860 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
6861 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
6862 /// `err` or `result` depending on the state of `result_ok`.
6863 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
6864 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
6865 pub result_ok: bool,
6868 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
6869 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
6870 CResult_CVec_u8ZPeerHandleErrorZ {
6871 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6872 result: Box::into_raw(Box::new(o)),
6878 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
6879 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
6880 CResult_CVec_u8ZPeerHandleErrorZ {
6881 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6882 err: Box::into_raw(Box::new(e)),
6888 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
6889 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
6890 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
6891 fn drop(&mut self) {
6893 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6894 let _ = unsafe { Box::from_raw(self.contents.result) };
6897 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6898 let _ = unsafe { Box::from_raw(self.contents.err) };
6903 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
6904 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6905 let contents = if o.result_ok {
6906 let result = unsafe { o.contents.result };
6907 unsafe { o.contents.result = std::ptr::null_mut() };
6908 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
6910 let err = unsafe { o.contents.err };
6911 unsafe { o.contents.err = std::ptr::null_mut(); }
6912 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
6916 result_ok: o.result_ok,
6920 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
6921 fn clone(&self) -> Self {
6923 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6924 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
6927 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6928 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
6934 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
6935 /// but with all dynamically-allocated buffers duplicated in new buffers.
6936 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
6938 /// The contents of CResult_NonePeerHandleErrorZ
6939 pub union CResult_NonePeerHandleErrorZPtr {
6940 /// Note that this value is always NULL, as there are no contents in the OK variant
6941 pub result: *mut std::ffi::c_void,
6942 /// A pointer to the contents in the error state.
6943 /// Reading from this pointer when `result_ok` is set is undefined.
6944 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6947 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
6948 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6950 pub struct CResult_NonePeerHandleErrorZ {
6951 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
6952 /// `err` or `result` depending on the state of `result_ok`.
6953 pub contents: CResult_NonePeerHandleErrorZPtr,
6954 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
6955 pub result_ok: bool,
6958 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
6959 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
6960 CResult_NonePeerHandleErrorZ {
6961 contents: CResult_NonePeerHandleErrorZPtr {
6962 result: std::ptr::null_mut(),
6968 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
6969 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
6970 CResult_NonePeerHandleErrorZ {
6971 contents: CResult_NonePeerHandleErrorZPtr {
6972 err: Box::into_raw(Box::new(e)),
6978 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
6979 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
6980 impl Drop for CResult_NonePeerHandleErrorZ {
6981 fn drop(&mut self) {
6984 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6985 let _ = unsafe { Box::from_raw(self.contents.err) };
6990 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
6991 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6992 let contents = if o.result_ok {
6993 let _ = unsafe { Box::from_raw(o.contents.result) };
6994 o.contents.result = std::ptr::null_mut();
6995 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
6997 let err = unsafe { o.contents.err };
6998 unsafe { o.contents.err = std::ptr::null_mut(); }
6999 CResult_NonePeerHandleErrorZPtr { err }
7003 result_ok: o.result_ok,
7007 impl Clone for CResult_NonePeerHandleErrorZ {
7008 fn clone(&self) -> Self {
7010 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
7011 result: std::ptr::null_mut()
7014 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
7015 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7021 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
7022 /// but with all dynamically-allocated buffers duplicated in new buffers.
7023 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
7025 /// The contents of CResult_boolPeerHandleErrorZ
7026 pub union CResult_boolPeerHandleErrorZPtr {
7027 /// A pointer to the contents in the success state.
7028 /// Reading from this pointer when `result_ok` is not set is undefined.
7029 pub result: *mut bool,
7030 /// A pointer to the contents in the error state.
7031 /// Reading from this pointer when `result_ok` is set is undefined.
7032 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7035 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7036 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7038 pub struct CResult_boolPeerHandleErrorZ {
7039 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7040 /// `err` or `result` depending on the state of `result_ok`.
7041 pub contents: CResult_boolPeerHandleErrorZPtr,
7042 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7043 pub result_ok: bool,
7046 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7047 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7048 CResult_boolPeerHandleErrorZ {
7049 contents: CResult_boolPeerHandleErrorZPtr {
7050 result: Box::into_raw(Box::new(o)),
7056 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7057 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7058 CResult_boolPeerHandleErrorZ {
7059 contents: CResult_boolPeerHandleErrorZPtr {
7060 err: Box::into_raw(Box::new(e)),
7066 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7067 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7068 impl Drop for CResult_boolPeerHandleErrorZ {
7069 fn drop(&mut self) {
7071 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7072 let _ = unsafe { Box::from_raw(self.contents.result) };
7075 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7076 let _ = unsafe { Box::from_raw(self.contents.err) };
7081 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7082 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7083 let contents = if o.result_ok {
7084 let result = unsafe { o.contents.result };
7085 unsafe { o.contents.result = std::ptr::null_mut() };
7086 CResult_boolPeerHandleErrorZPtr { result }
7088 let err = unsafe { o.contents.err };
7089 unsafe { o.contents.err = std::ptr::null_mut(); }
7090 CResult_boolPeerHandleErrorZPtr { err }
7094 result_ok: o.result_ok,
7098 impl Clone for CResult_boolPeerHandleErrorZ {
7099 fn clone(&self) -> Self {
7101 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7102 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7105 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
7106 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7112 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7113 /// but with all dynamically-allocated buffers duplicated in new buffers.
7114 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
7116 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7117 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
7118 /// A pointer to the contents in the success state.
7119 /// Reading from this pointer when `result_ok` is not set is undefined.
7120 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
7121 /// A pointer to the contents in the error state.
7122 /// Reading from this pointer when `result_ok` is set is undefined.
7123 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7126 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7127 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7129 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7130 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7131 /// `err` or `result` depending on the state of `result_ok`.
7132 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7133 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7134 pub result_ok: bool,
7137 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7138 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7139 CResult_DirectionalChannelInfoDecodeErrorZ {
7140 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7141 result: Box::into_raw(Box::new(o)),
7147 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7148 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7149 CResult_DirectionalChannelInfoDecodeErrorZ {
7150 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7151 err: Box::into_raw(Box::new(e)),
7157 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
7158 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7159 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
7160 fn drop(&mut self) {
7162 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7163 let _ = unsafe { Box::from_raw(self.contents.result) };
7166 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7167 let _ = unsafe { Box::from_raw(self.contents.err) };
7172 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7173 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7174 let contents = if o.result_ok {
7175 let result = unsafe { o.contents.result };
7176 unsafe { o.contents.result = std::ptr::null_mut() };
7177 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
7179 let err = unsafe { o.contents.err };
7180 unsafe { o.contents.err = std::ptr::null_mut(); }
7181 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7185 result_ok: o.result_ok,
7189 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7190 fn clone(&self) -> Self {
7192 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7193 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7196 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7197 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7203 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7204 /// but with all dynamically-allocated buffers duplicated in new buffers.
7205 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
7207 /// The contents of CResult_ChannelInfoDecodeErrorZ
7208 pub union CResult_ChannelInfoDecodeErrorZPtr {
7209 /// A pointer to the contents in the success state.
7210 /// Reading from this pointer when `result_ok` is not set is undefined.
7211 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
7212 /// A pointer to the contents in the error state.
7213 /// Reading from this pointer when `result_ok` is set is undefined.
7214 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7217 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7218 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7219 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7220 pub struct CResult_ChannelInfoDecodeErrorZ {
7221 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7222 /// `err` or `result` depending on the state of `result_ok`.
7223 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7224 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7225 pub result_ok: bool,
7228 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7229 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7230 CResult_ChannelInfoDecodeErrorZ {
7231 contents: CResult_ChannelInfoDecodeErrorZPtr {
7232 result: Box::into_raw(Box::new(o)),
7238 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7239 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7240 CResult_ChannelInfoDecodeErrorZ {
7241 contents: CResult_ChannelInfoDecodeErrorZPtr {
7242 err: Box::into_raw(Box::new(e)),
7248 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7249 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7250 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7251 fn drop(&mut self) {
7253 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7254 let _ = unsafe { Box::from_raw(self.contents.result) };
7257 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7258 let _ = unsafe { Box::from_raw(self.contents.err) };
7263 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7264 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7265 let contents = if o.result_ok {
7266 let result = unsafe { o.contents.result };
7267 unsafe { o.contents.result = std::ptr::null_mut() };
7268 CResult_ChannelInfoDecodeErrorZPtr { result }
7270 let err = unsafe { o.contents.err };
7271 unsafe { o.contents.err = std::ptr::null_mut(); }
7272 CResult_ChannelInfoDecodeErrorZPtr { err }
7276 result_ok: o.result_ok,
7280 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7281 fn clone(&self) -> Self {
7283 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7284 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7287 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7288 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7294 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7295 /// but with all dynamically-allocated buffers duplicated in new buffers.
7296 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
7298 /// The contents of CResult_RoutingFeesDecodeErrorZ
7299 pub union CResult_RoutingFeesDecodeErrorZPtr {
7300 /// A pointer to the contents in the success state.
7301 /// Reading from this pointer when `result_ok` is not set is undefined.
7302 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
7303 /// A pointer to the contents in the error state.
7304 /// Reading from this pointer when `result_ok` is set is undefined.
7305 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7308 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7309 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7310 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7311 pub struct CResult_RoutingFeesDecodeErrorZ {
7312 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7313 /// `err` or `result` depending on the state of `result_ok`.
7314 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7315 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7316 pub result_ok: bool,
7319 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7320 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7321 CResult_RoutingFeesDecodeErrorZ {
7322 contents: CResult_RoutingFeesDecodeErrorZPtr {
7323 result: Box::into_raw(Box::new(o)),
7329 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7330 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7331 CResult_RoutingFeesDecodeErrorZ {
7332 contents: CResult_RoutingFeesDecodeErrorZPtr {
7333 err: Box::into_raw(Box::new(e)),
7339 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7340 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7341 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7342 fn drop(&mut self) {
7344 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7345 let _ = unsafe { Box::from_raw(self.contents.result) };
7348 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7349 let _ = unsafe { Box::from_raw(self.contents.err) };
7354 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7355 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7356 let contents = if o.result_ok {
7357 let result = unsafe { o.contents.result };
7358 unsafe { o.contents.result = std::ptr::null_mut() };
7359 CResult_RoutingFeesDecodeErrorZPtr { result }
7361 let err = unsafe { o.contents.err };
7362 unsafe { o.contents.err = std::ptr::null_mut(); }
7363 CResult_RoutingFeesDecodeErrorZPtr { err }
7367 result_ok: o.result_ok,
7371 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7372 fn clone(&self) -> Self {
7374 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7375 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
7378 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7379 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7385 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7386 /// but with all dynamically-allocated buffers duplicated in new buffers.
7387 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
7389 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7390 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7391 /// A pointer to the contents in the success state.
7392 /// Reading from this pointer when `result_ok` is not set is undefined.
7393 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
7394 /// A pointer to the contents in the error state.
7395 /// Reading from this pointer when `result_ok` is set is undefined.
7396 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7399 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7400 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7402 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7403 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7404 /// `err` or `result` depending on the state of `result_ok`.
7405 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7406 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7407 pub result_ok: bool,
7410 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7411 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7412 CResult_NodeAnnouncementInfoDecodeErrorZ {
7413 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7414 result: Box::into_raw(Box::new(o)),
7420 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7421 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7422 CResult_NodeAnnouncementInfoDecodeErrorZ {
7423 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7424 err: Box::into_raw(Box::new(e)),
7430 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7431 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7432 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7433 fn drop(&mut self) {
7435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7436 let _ = unsafe { Box::from_raw(self.contents.result) };
7439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7440 let _ = unsafe { Box::from_raw(self.contents.err) };
7445 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7446 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7447 let contents = if o.result_ok {
7448 let result = unsafe { o.contents.result };
7449 unsafe { o.contents.result = std::ptr::null_mut() };
7450 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7452 let err = unsafe { o.contents.err };
7453 unsafe { o.contents.err = std::ptr::null_mut(); }
7454 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7458 result_ok: o.result_ok,
7462 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7463 fn clone(&self) -> Self {
7465 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7466 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7469 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7470 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7476 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7477 /// but with all dynamically-allocated buffers duplicated in new buffers.
7478 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
7480 /// A dynamically-allocated array of u64s of arbitrary size.
7481 /// This corresponds to std::vector in C++
7482 pub struct CVec_u64Z {
7483 /// The elements in the array.
7484 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7486 /// The number of elements pointed to by `data`.
7490 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
7491 if self.datalen == 0 { return Vec::new(); }
7492 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7493 self.data = std::ptr::null_mut();
7497 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
7498 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7501 impl From<Vec<u64>> for CVec_u64Z {
7502 fn from(v: Vec<u64>) -> Self {
7503 let datalen = v.len();
7504 let data = Box::into_raw(v.into_boxed_slice());
7505 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7509 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7510 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
7511 impl Drop for CVec_u64Z {
7512 fn drop(&mut self) {
7513 if self.datalen == 0 { return; }
7514 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7517 impl Clone for CVec_u64Z {
7518 fn clone(&self) -> Self {
7519 let mut res = Vec::new();
7520 if self.datalen == 0 { return Self::from(res); }
7521 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7526 /// The contents of CResult_NodeInfoDecodeErrorZ
7527 pub union CResult_NodeInfoDecodeErrorZPtr {
7528 /// A pointer to the contents in the success state.
7529 /// Reading from this pointer when `result_ok` is not set is undefined.
7530 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
7531 /// A pointer to the contents in the error state.
7532 /// Reading from this pointer when `result_ok` is set is undefined.
7533 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7536 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7537 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7538 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7539 pub struct CResult_NodeInfoDecodeErrorZ {
7540 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7541 /// `err` or `result` depending on the state of `result_ok`.
7542 pub contents: CResult_NodeInfoDecodeErrorZPtr,
7543 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7544 pub result_ok: bool,
7547 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7548 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7549 CResult_NodeInfoDecodeErrorZ {
7550 contents: CResult_NodeInfoDecodeErrorZPtr {
7551 result: Box::into_raw(Box::new(o)),
7557 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7558 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7559 CResult_NodeInfoDecodeErrorZ {
7560 contents: CResult_NodeInfoDecodeErrorZPtr {
7561 err: Box::into_raw(Box::new(e)),
7567 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7568 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7569 impl Drop for CResult_NodeInfoDecodeErrorZ {
7570 fn drop(&mut self) {
7572 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7573 let _ = unsafe { Box::from_raw(self.contents.result) };
7576 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7577 let _ = unsafe { Box::from_raw(self.contents.err) };
7582 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7583 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7584 let contents = if o.result_ok {
7585 let result = unsafe { o.contents.result };
7586 unsafe { o.contents.result = std::ptr::null_mut() };
7587 CResult_NodeInfoDecodeErrorZPtr { result }
7589 let err = unsafe { o.contents.err };
7590 unsafe { o.contents.err = std::ptr::null_mut(); }
7591 CResult_NodeInfoDecodeErrorZPtr { err }
7595 result_ok: o.result_ok,
7599 impl Clone for CResult_NodeInfoDecodeErrorZ {
7600 fn clone(&self) -> Self {
7602 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7603 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
7606 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7607 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7613 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7614 /// but with all dynamically-allocated buffers duplicated in new buffers.
7615 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
7617 /// The contents of CResult_NetworkGraphDecodeErrorZ
7618 pub union CResult_NetworkGraphDecodeErrorZPtr {
7619 /// A pointer to the contents in the success state.
7620 /// Reading from this pointer when `result_ok` is not set is undefined.
7621 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
7622 /// A pointer to the contents in the error state.
7623 /// Reading from this pointer when `result_ok` is set is undefined.
7624 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7627 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7628 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7629 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7630 pub struct CResult_NetworkGraphDecodeErrorZ {
7631 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7632 /// `err` or `result` depending on the state of `result_ok`.
7633 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7634 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7635 pub result_ok: bool,
7638 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7639 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7640 CResult_NetworkGraphDecodeErrorZ {
7641 contents: CResult_NetworkGraphDecodeErrorZPtr {
7642 result: Box::into_raw(Box::new(o)),
7648 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7649 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7650 CResult_NetworkGraphDecodeErrorZ {
7651 contents: CResult_NetworkGraphDecodeErrorZPtr {
7652 err: Box::into_raw(Box::new(e)),
7658 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7659 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7660 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7661 fn drop(&mut self) {
7663 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7664 let _ = unsafe { Box::from_raw(self.contents.result) };
7667 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7668 let _ = unsafe { Box::from_raw(self.contents.err) };
7673 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7674 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7675 let contents = if o.result_ok {
7676 let result = unsafe { o.contents.result };
7677 unsafe { o.contents.result = std::ptr::null_mut() };
7678 CResult_NetworkGraphDecodeErrorZPtr { result }
7680 let err = unsafe { o.contents.err };
7681 unsafe { o.contents.err = std::ptr::null_mut(); }
7682 CResult_NetworkGraphDecodeErrorZPtr { err }
7686 result_ok: o.result_ok,
7690 impl Clone for CResult_NetworkGraphDecodeErrorZ {
7691 fn clone(&self) -> Self {
7693 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
7694 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
7697 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
7698 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7704 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
7705 /// but with all dynamically-allocated buffers duplicated in new buffers.
7706 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
7708 /// The contents of CResult_NetAddressu8Z
7709 pub union CResult_NetAddressu8ZPtr {
7710 /// A pointer to the contents in the success state.
7711 /// Reading from this pointer when `result_ok` is not set is undefined.
7712 pub result: *mut crate::lightning::ln::msgs::NetAddress,
7713 /// A pointer to the contents in the error state.
7714 /// Reading from this pointer when `result_ok` is set is undefined.
7718 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
7719 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7721 pub struct CResult_NetAddressu8Z {
7722 /// The contents of this CResult_NetAddressu8Z, accessible via either
7723 /// `err` or `result` depending on the state of `result_ok`.
7724 pub contents: CResult_NetAddressu8ZPtr,
7725 /// Whether this CResult_NetAddressu8Z represents a success state.
7726 pub result_ok: bool,
7729 /// Creates a new CResult_NetAddressu8Z in the success state.
7730 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
7731 CResult_NetAddressu8Z {
7732 contents: CResult_NetAddressu8ZPtr {
7733 result: Box::into_raw(Box::new(o)),
7739 /// Creates a new CResult_NetAddressu8Z in the error state.
7740 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
7741 CResult_NetAddressu8Z {
7742 contents: CResult_NetAddressu8ZPtr {
7743 err: Box::into_raw(Box::new(e)),
7749 /// Frees any resources used by the CResult_NetAddressu8Z.
7750 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
7751 impl Drop for CResult_NetAddressu8Z {
7752 fn drop(&mut self) {
7754 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7755 let _ = unsafe { Box::from_raw(self.contents.result) };
7758 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7759 let _ = unsafe { Box::from_raw(self.contents.err) };
7764 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
7765 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
7766 let contents = if o.result_ok {
7767 let result = unsafe { o.contents.result };
7768 unsafe { o.contents.result = std::ptr::null_mut() };
7769 CResult_NetAddressu8ZPtr { result }
7771 let err = unsafe { o.contents.err };
7772 unsafe { o.contents.err = std::ptr::null_mut(); }
7773 CResult_NetAddressu8ZPtr { err }
7777 result_ok: o.result_ok,
7781 impl Clone for CResult_NetAddressu8Z {
7782 fn clone(&self) -> Self {
7784 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
7785 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7788 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
7789 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
7795 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
7796 /// but with all dynamically-allocated buffers duplicated in new buffers.
7797 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
7799 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
7800 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7801 /// A pointer to the contents in the success state.
7802 /// Reading from this pointer when `result_ok` is not set is undefined.
7803 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
7804 /// A pointer to the contents in the error state.
7805 /// Reading from this pointer when `result_ok` is set is undefined.
7806 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7809 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
7810 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
7811 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7812 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
7813 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
7814 /// `err` or `result` depending on the state of `result_ok`.
7815 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
7816 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
7817 pub result_ok: bool,
7820 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
7821 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7822 CResult_CResult_NetAddressu8ZDecodeErrorZ {
7823 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7824 result: Box::into_raw(Box::new(o)),
7830 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
7831 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7832 CResult_CResult_NetAddressu8ZDecodeErrorZ {
7833 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7834 err: Box::into_raw(Box::new(e)),
7840 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
7841 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
7842 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7843 fn drop(&mut self) {
7845 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7846 let _ = unsafe { Box::from_raw(self.contents.result) };
7849 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7850 let _ = unsafe { Box::from_raw(self.contents.err) };
7855 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7856 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
7857 let contents = if o.result_ok {
7858 let result = unsafe { o.contents.result };
7859 unsafe { o.contents.result = std::ptr::null_mut() };
7860 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
7862 let err = unsafe { o.contents.err };
7863 unsafe { o.contents.err = std::ptr::null_mut(); }
7864 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
7868 result_ok: o.result_ok,
7872 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7873 fn clone(&self) -> Self {
7875 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7876 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
7879 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7880 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7886 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
7887 /// but with all dynamically-allocated buffers duplicated in new buffers.
7888 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
7890 /// The contents of CResult_NetAddressDecodeErrorZ
7891 pub union CResult_NetAddressDecodeErrorZPtr {
7892 /// A pointer to the contents in the success state.
7893 /// Reading from this pointer when `result_ok` is not set is undefined.
7894 pub result: *mut crate::lightning::ln::msgs::NetAddress,
7895 /// A pointer to the contents in the error state.
7896 /// Reading from this pointer when `result_ok` is set is undefined.
7897 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7900 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
7901 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
7902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7903 pub struct CResult_NetAddressDecodeErrorZ {
7904 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7905 /// `err` or `result` depending on the state of `result_ok`.
7906 pub contents: CResult_NetAddressDecodeErrorZPtr,
7907 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7908 pub result_ok: bool,
7911 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
7912 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
7913 CResult_NetAddressDecodeErrorZ {
7914 contents: CResult_NetAddressDecodeErrorZPtr {
7915 result: Box::into_raw(Box::new(o)),
7921 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
7922 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
7923 CResult_NetAddressDecodeErrorZ {
7924 contents: CResult_NetAddressDecodeErrorZPtr {
7925 err: Box::into_raw(Box::new(e)),
7931 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
7932 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
7933 impl Drop for CResult_NetAddressDecodeErrorZ {
7934 fn drop(&mut self) {
7936 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7937 let _ = unsafe { Box::from_raw(self.contents.result) };
7940 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7941 let _ = unsafe { Box::from_raw(self.contents.err) };
7946 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
7947 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
7948 let contents = if o.result_ok {
7949 let result = unsafe { o.contents.result };
7950 unsafe { o.contents.result = std::ptr::null_mut() };
7951 CResult_NetAddressDecodeErrorZPtr { result }
7953 let err = unsafe { o.contents.err };
7954 unsafe { o.contents.err = std::ptr::null_mut(); }
7955 CResult_NetAddressDecodeErrorZPtr { err }
7959 result_ok: o.result_ok,
7963 impl Clone for CResult_NetAddressDecodeErrorZ {
7964 fn clone(&self) -> Self {
7966 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
7967 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7970 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
7971 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7977 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
7978 /// but with all dynamically-allocated buffers duplicated in new buffers.
7979 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
7981 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
7982 /// This corresponds to std::vector in C++
7983 pub struct CVec_UpdateAddHTLCZ {
7984 /// The elements in the array.
7985 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7986 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
7987 /// The number of elements pointed to by `data`.
7990 impl CVec_UpdateAddHTLCZ {
7991 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
7992 if self.datalen == 0 { return Vec::new(); }
7993 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7994 self.data = std::ptr::null_mut();
7998 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
7999 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8002 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
8003 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
8004 let datalen = v.len();
8005 let data = Box::into_raw(v.into_boxed_slice());
8006 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8010 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8011 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
8012 impl Drop for CVec_UpdateAddHTLCZ {
8013 fn drop(&mut self) {
8014 if self.datalen == 0 { return; }
8015 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8018 impl Clone for CVec_UpdateAddHTLCZ {
8019 fn clone(&self) -> Self {
8020 let mut res = Vec::new();
8021 if self.datalen == 0 { return Self::from(res); }
8022 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8027 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8028 /// This corresponds to std::vector in C++
8029 pub struct CVec_UpdateFulfillHTLCZ {
8030 /// The elements in the array.
8031 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8032 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
8033 /// The number of elements pointed to by `data`.
8036 impl CVec_UpdateFulfillHTLCZ {
8037 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8038 if self.datalen == 0 { return Vec::new(); }
8039 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8040 self.data = std::ptr::null_mut();
8044 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8045 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8048 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8049 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8050 let datalen = v.len();
8051 let data = Box::into_raw(v.into_boxed_slice());
8052 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8056 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8057 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8058 impl Drop for CVec_UpdateFulfillHTLCZ {
8059 fn drop(&mut self) {
8060 if self.datalen == 0 { return; }
8061 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8064 impl Clone for CVec_UpdateFulfillHTLCZ {
8065 fn clone(&self) -> Self {
8066 let mut res = Vec::new();
8067 if self.datalen == 0 { return Self::from(res); }
8068 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8073 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8074 /// This corresponds to std::vector in C++
8075 pub struct CVec_UpdateFailHTLCZ {
8076 /// The elements in the array.
8077 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8078 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8079 /// The number of elements pointed to by `data`.
8082 impl CVec_UpdateFailHTLCZ {
8083 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8084 if self.datalen == 0 { return Vec::new(); }
8085 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8086 self.data = std::ptr::null_mut();
8090 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8091 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8094 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8095 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8096 let datalen = v.len();
8097 let data = Box::into_raw(v.into_boxed_slice());
8098 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8102 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8103 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8104 impl Drop for CVec_UpdateFailHTLCZ {
8105 fn drop(&mut self) {
8106 if self.datalen == 0 { return; }
8107 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8110 impl Clone for CVec_UpdateFailHTLCZ {
8111 fn clone(&self) -> Self {
8112 let mut res = Vec::new();
8113 if self.datalen == 0 { return Self::from(res); }
8114 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8119 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8120 /// This corresponds to std::vector in C++
8121 pub struct CVec_UpdateFailMalformedHTLCZ {
8122 /// The elements in the array.
8123 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8124 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8125 /// The number of elements pointed to by `data`.
8128 impl CVec_UpdateFailMalformedHTLCZ {
8129 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8130 if self.datalen == 0 { return Vec::new(); }
8131 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8132 self.data = std::ptr::null_mut();
8136 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8137 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8140 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8141 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8142 let datalen = v.len();
8143 let data = Box::into_raw(v.into_boxed_slice());
8144 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8148 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8149 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8150 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8151 fn drop(&mut self) {
8152 if self.datalen == 0 { return; }
8153 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8156 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8157 fn clone(&self) -> Self {
8158 let mut res = Vec::new();
8159 if self.datalen == 0 { return Self::from(res); }
8160 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8165 /// The contents of CResult_AcceptChannelDecodeErrorZ
8166 pub union CResult_AcceptChannelDecodeErrorZPtr {
8167 /// A pointer to the contents in the success state.
8168 /// Reading from this pointer when `result_ok` is not set is undefined.
8169 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8170 /// A pointer to the contents in the error state.
8171 /// Reading from this pointer when `result_ok` is set is undefined.
8172 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8175 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8176 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8178 pub struct CResult_AcceptChannelDecodeErrorZ {
8179 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8180 /// `err` or `result` depending on the state of `result_ok`.
8181 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8182 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8183 pub result_ok: bool,
8186 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8187 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8188 CResult_AcceptChannelDecodeErrorZ {
8189 contents: CResult_AcceptChannelDecodeErrorZPtr {
8190 result: Box::into_raw(Box::new(o)),
8196 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8197 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8198 CResult_AcceptChannelDecodeErrorZ {
8199 contents: CResult_AcceptChannelDecodeErrorZPtr {
8200 err: Box::into_raw(Box::new(e)),
8206 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8207 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8208 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8209 fn drop(&mut self) {
8211 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8212 let _ = unsafe { Box::from_raw(self.contents.result) };
8215 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8216 let _ = unsafe { Box::from_raw(self.contents.err) };
8221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8222 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8223 let contents = if o.result_ok {
8224 let result = unsafe { o.contents.result };
8225 unsafe { o.contents.result = std::ptr::null_mut() };
8226 CResult_AcceptChannelDecodeErrorZPtr { result }
8228 let err = unsafe { o.contents.err };
8229 unsafe { o.contents.err = std::ptr::null_mut(); }
8230 CResult_AcceptChannelDecodeErrorZPtr { err }
8234 result_ok: o.result_ok,
8238 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8239 fn clone(&self) -> Self {
8241 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8242 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8245 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8246 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8252 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8253 /// but with all dynamically-allocated buffers duplicated in new buffers.
8254 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
8256 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8257 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8258 /// A pointer to the contents in the success state.
8259 /// Reading from this pointer when `result_ok` is not set is undefined.
8260 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8261 /// A pointer to the contents in the error state.
8262 /// Reading from this pointer when `result_ok` is set is undefined.
8263 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8266 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8267 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8269 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8270 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8271 /// `err` or `result` depending on the state of `result_ok`.
8272 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8273 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8274 pub result_ok: bool,
8277 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8278 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8279 CResult_AnnouncementSignaturesDecodeErrorZ {
8280 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8281 result: Box::into_raw(Box::new(o)),
8287 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8288 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8289 CResult_AnnouncementSignaturesDecodeErrorZ {
8290 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8291 err: Box::into_raw(Box::new(e)),
8297 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8298 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
8299 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
8300 fn drop(&mut self) {
8302 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8303 let _ = unsafe { Box::from_raw(self.contents.result) };
8306 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8307 let _ = unsafe { Box::from_raw(self.contents.err) };
8312 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
8313 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
8314 let contents = if o.result_ok {
8315 let result = unsafe { o.contents.result };
8316 unsafe { o.contents.result = std::ptr::null_mut() };
8317 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
8319 let err = unsafe { o.contents.err };
8320 unsafe { o.contents.err = std::ptr::null_mut(); }
8321 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
8325 result_ok: o.result_ok,
8329 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
8330 fn clone(&self) -> Self {
8332 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8333 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
8336 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8337 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8343 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8344 /// but with all dynamically-allocated buffers duplicated in new buffers.
8345 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
8347 /// The contents of CResult_ChannelReestablishDecodeErrorZ
8348 pub union CResult_ChannelReestablishDecodeErrorZPtr {
8349 /// A pointer to the contents in the success state.
8350 /// Reading from this pointer when `result_ok` is not set is undefined.
8351 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
8352 /// A pointer to the contents in the error state.
8353 /// Reading from this pointer when `result_ok` is set is undefined.
8354 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8357 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8358 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8360 pub struct CResult_ChannelReestablishDecodeErrorZ {
8361 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8362 /// `err` or `result` depending on the state of `result_ok`.
8363 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
8364 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8365 pub result_ok: bool,
8368 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8369 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
8370 CResult_ChannelReestablishDecodeErrorZ {
8371 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8372 result: Box::into_raw(Box::new(o)),
8378 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8379 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
8380 CResult_ChannelReestablishDecodeErrorZ {
8381 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8382 err: Box::into_raw(Box::new(e)),
8388 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8389 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
8390 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
8391 fn drop(&mut self) {
8393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8394 let _ = unsafe { Box::from_raw(self.contents.result) };
8397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8398 let _ = unsafe { Box::from_raw(self.contents.err) };
8403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
8404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
8405 let contents = if o.result_ok {
8406 let result = unsafe { o.contents.result };
8407 unsafe { o.contents.result = std::ptr::null_mut() };
8408 CResult_ChannelReestablishDecodeErrorZPtr { result }
8410 let err = unsafe { o.contents.err };
8411 unsafe { o.contents.err = std::ptr::null_mut(); }
8412 CResult_ChannelReestablishDecodeErrorZPtr { err }
8416 result_ok: o.result_ok,
8420 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
8421 fn clone(&self) -> Self {
8423 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8424 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
8427 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8434 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8435 /// but with all dynamically-allocated buffers duplicated in new buffers.
8436 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
8438 /// The contents of CResult_ClosingSignedDecodeErrorZ
8439 pub union CResult_ClosingSignedDecodeErrorZPtr {
8440 /// A pointer to the contents in the success state.
8441 /// Reading from this pointer when `result_ok` is not set is undefined.
8442 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
8443 /// A pointer to the contents in the error state.
8444 /// Reading from this pointer when `result_ok` is set is undefined.
8445 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8448 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8449 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8450 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8451 pub struct CResult_ClosingSignedDecodeErrorZ {
8452 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8453 /// `err` or `result` depending on the state of `result_ok`.
8454 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
8455 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8456 pub result_ok: bool,
8459 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8460 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
8461 CResult_ClosingSignedDecodeErrorZ {
8462 contents: CResult_ClosingSignedDecodeErrorZPtr {
8463 result: Box::into_raw(Box::new(o)),
8469 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8470 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
8471 CResult_ClosingSignedDecodeErrorZ {
8472 contents: CResult_ClosingSignedDecodeErrorZPtr {
8473 err: Box::into_raw(Box::new(e)),
8479 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8480 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
8481 impl Drop for CResult_ClosingSignedDecodeErrorZ {
8482 fn drop(&mut self) {
8484 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8485 let _ = unsafe { Box::from_raw(self.contents.result) };
8488 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8489 let _ = unsafe { Box::from_raw(self.contents.err) };
8494 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
8495 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8496 let contents = if o.result_ok {
8497 let result = unsafe { o.contents.result };
8498 unsafe { o.contents.result = std::ptr::null_mut() };
8499 CResult_ClosingSignedDecodeErrorZPtr { result }
8501 let err = unsafe { o.contents.err };
8502 unsafe { o.contents.err = std::ptr::null_mut(); }
8503 CResult_ClosingSignedDecodeErrorZPtr { err }
8507 result_ok: o.result_ok,
8511 impl Clone for CResult_ClosingSignedDecodeErrorZ {
8512 fn clone(&self) -> Self {
8514 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
8515 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
8518 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
8519 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8525 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8526 /// but with all dynamically-allocated buffers duplicated in new buffers.
8527 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
8529 /// The contents of CResult_CommitmentSignedDecodeErrorZ
8530 pub union CResult_CommitmentSignedDecodeErrorZPtr {
8531 /// A pointer to the contents in the success state.
8532 /// Reading from this pointer when `result_ok` is not set is undefined.
8533 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
8534 /// A pointer to the contents in the error state.
8535 /// Reading from this pointer when `result_ok` is set is undefined.
8536 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8539 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8540 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8541 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8542 pub struct CResult_CommitmentSignedDecodeErrorZ {
8543 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8544 /// `err` or `result` depending on the state of `result_ok`.
8545 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
8546 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8547 pub result_ok: bool,
8550 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8551 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
8552 CResult_CommitmentSignedDecodeErrorZ {
8553 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8554 result: Box::into_raw(Box::new(o)),
8560 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8561 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
8562 CResult_CommitmentSignedDecodeErrorZ {
8563 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8564 err: Box::into_raw(Box::new(e)),
8570 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8571 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
8572 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
8573 fn drop(&mut self) {
8575 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8576 let _ = unsafe { Box::from_raw(self.contents.result) };
8579 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8580 let _ = unsafe { Box::from_raw(self.contents.err) };
8585 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
8586 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8587 let contents = if o.result_ok {
8588 let result = unsafe { o.contents.result };
8589 unsafe { o.contents.result = std::ptr::null_mut() };
8590 CResult_CommitmentSignedDecodeErrorZPtr { result }
8592 let err = unsafe { o.contents.err };
8593 unsafe { o.contents.err = std::ptr::null_mut(); }
8594 CResult_CommitmentSignedDecodeErrorZPtr { err }
8598 result_ok: o.result_ok,
8602 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
8603 fn clone(&self) -> Self {
8605 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8606 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
8609 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8610 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8616 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8617 /// but with all dynamically-allocated buffers duplicated in new buffers.
8618 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
8620 /// The contents of CResult_FundingCreatedDecodeErrorZ
8621 pub union CResult_FundingCreatedDecodeErrorZPtr {
8622 /// A pointer to the contents in the success state.
8623 /// Reading from this pointer when `result_ok` is not set is undefined.
8624 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
8625 /// A pointer to the contents in the error state.
8626 /// Reading from this pointer when `result_ok` is set is undefined.
8627 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8630 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8631 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8632 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8633 pub struct CResult_FundingCreatedDecodeErrorZ {
8634 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8635 /// `err` or `result` depending on the state of `result_ok`.
8636 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
8637 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8638 pub result_ok: bool,
8641 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8642 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
8643 CResult_FundingCreatedDecodeErrorZ {
8644 contents: CResult_FundingCreatedDecodeErrorZPtr {
8645 result: Box::into_raw(Box::new(o)),
8651 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8652 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
8653 CResult_FundingCreatedDecodeErrorZ {
8654 contents: CResult_FundingCreatedDecodeErrorZPtr {
8655 err: Box::into_raw(Box::new(e)),
8661 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8662 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
8663 impl Drop for CResult_FundingCreatedDecodeErrorZ {
8664 fn drop(&mut self) {
8666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8667 let _ = unsafe { Box::from_raw(self.contents.result) };
8670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8671 let _ = unsafe { Box::from_raw(self.contents.err) };
8676 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
8677 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
8678 let contents = if o.result_ok {
8679 let result = unsafe { o.contents.result };
8680 unsafe { o.contents.result = std::ptr::null_mut() };
8681 CResult_FundingCreatedDecodeErrorZPtr { result }
8683 let err = unsafe { o.contents.err };
8684 unsafe { o.contents.err = std::ptr::null_mut(); }
8685 CResult_FundingCreatedDecodeErrorZPtr { err }
8689 result_ok: o.result_ok,
8693 impl Clone for CResult_FundingCreatedDecodeErrorZ {
8694 fn clone(&self) -> Self {
8696 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
8697 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
8700 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
8701 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8707 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8708 /// but with all dynamically-allocated buffers duplicated in new buffers.
8709 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
8711 /// The contents of CResult_FundingSignedDecodeErrorZ
8712 pub union CResult_FundingSignedDecodeErrorZPtr {
8713 /// A pointer to the contents in the success state.
8714 /// Reading from this pointer when `result_ok` is not set is undefined.
8715 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
8716 /// A pointer to the contents in the error state.
8717 /// Reading from this pointer when `result_ok` is set is undefined.
8718 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8721 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8722 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8724 pub struct CResult_FundingSignedDecodeErrorZ {
8725 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8726 /// `err` or `result` depending on the state of `result_ok`.
8727 pub contents: CResult_FundingSignedDecodeErrorZPtr,
8728 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8729 pub result_ok: bool,
8732 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8733 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
8734 CResult_FundingSignedDecodeErrorZ {
8735 contents: CResult_FundingSignedDecodeErrorZPtr {
8736 result: Box::into_raw(Box::new(o)),
8742 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8743 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
8744 CResult_FundingSignedDecodeErrorZ {
8745 contents: CResult_FundingSignedDecodeErrorZPtr {
8746 err: Box::into_raw(Box::new(e)),
8752 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8753 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
8754 impl Drop for CResult_FundingSignedDecodeErrorZ {
8755 fn drop(&mut self) {
8757 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8758 let _ = unsafe { Box::from_raw(self.contents.result) };
8761 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8762 let _ = unsafe { Box::from_raw(self.contents.err) };
8767 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
8768 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8769 let contents = if o.result_ok {
8770 let result = unsafe { o.contents.result };
8771 unsafe { o.contents.result = std::ptr::null_mut() };
8772 CResult_FundingSignedDecodeErrorZPtr { result }
8774 let err = unsafe { o.contents.err };
8775 unsafe { o.contents.err = std::ptr::null_mut(); }
8776 CResult_FundingSignedDecodeErrorZPtr { err }
8780 result_ok: o.result_ok,
8784 impl Clone for CResult_FundingSignedDecodeErrorZ {
8785 fn clone(&self) -> Self {
8787 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
8788 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
8791 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
8792 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8798 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
8799 /// but with all dynamically-allocated buffers duplicated in new buffers.
8800 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
8802 /// The contents of CResult_FundingLockedDecodeErrorZ
8803 pub union CResult_FundingLockedDecodeErrorZPtr {
8804 /// A pointer to the contents in the success state.
8805 /// Reading from this pointer when `result_ok` is not set is undefined.
8806 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
8807 /// A pointer to the contents in the error state.
8808 /// Reading from this pointer when `result_ok` is set is undefined.
8809 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8812 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8813 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
8814 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8815 pub struct CResult_FundingLockedDecodeErrorZ {
8816 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8817 /// `err` or `result` depending on the state of `result_ok`.
8818 pub contents: CResult_FundingLockedDecodeErrorZPtr,
8819 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8820 pub result_ok: bool,
8823 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8824 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
8825 CResult_FundingLockedDecodeErrorZ {
8826 contents: CResult_FundingLockedDecodeErrorZPtr {
8827 result: Box::into_raw(Box::new(o)),
8833 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8834 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
8835 CResult_FundingLockedDecodeErrorZ {
8836 contents: CResult_FundingLockedDecodeErrorZPtr {
8837 err: Box::into_raw(Box::new(e)),
8843 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
8844 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
8845 impl Drop for CResult_FundingLockedDecodeErrorZ {
8846 fn drop(&mut self) {
8848 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8849 let _ = unsafe { Box::from_raw(self.contents.result) };
8852 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8853 let _ = unsafe { Box::from_raw(self.contents.err) };
8858 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
8859 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
8860 let contents = if o.result_ok {
8861 let result = unsafe { o.contents.result };
8862 unsafe { o.contents.result = std::ptr::null_mut() };
8863 CResult_FundingLockedDecodeErrorZPtr { result }
8865 let err = unsafe { o.contents.err };
8866 unsafe { o.contents.err = std::ptr::null_mut(); }
8867 CResult_FundingLockedDecodeErrorZPtr { err }
8871 result_ok: o.result_ok,
8875 impl Clone for CResult_FundingLockedDecodeErrorZ {
8876 fn clone(&self) -> Self {
8878 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
8879 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
8882 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
8883 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8889 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
8890 /// but with all dynamically-allocated buffers duplicated in new buffers.
8891 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
8893 /// The contents of CResult_InitDecodeErrorZ
8894 pub union CResult_InitDecodeErrorZPtr {
8895 /// A pointer to the contents in the success state.
8896 /// Reading from this pointer when `result_ok` is not set is undefined.
8897 pub result: *mut crate::lightning::ln::msgs::Init,
8898 /// A pointer to the contents in the error state.
8899 /// Reading from this pointer when `result_ok` is set is undefined.
8900 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8903 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
8904 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
8905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8906 pub struct CResult_InitDecodeErrorZ {
8907 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
8908 /// `err` or `result` depending on the state of `result_ok`.
8909 pub contents: CResult_InitDecodeErrorZPtr,
8910 /// Whether this CResult_InitDecodeErrorZ represents a success state.
8911 pub result_ok: bool,
8914 /// Creates a new CResult_InitDecodeErrorZ in the success state.
8915 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
8916 CResult_InitDecodeErrorZ {
8917 contents: CResult_InitDecodeErrorZPtr {
8918 result: Box::into_raw(Box::new(o)),
8924 /// Creates a new CResult_InitDecodeErrorZ in the error state.
8925 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
8926 CResult_InitDecodeErrorZ {
8927 contents: CResult_InitDecodeErrorZPtr {
8928 err: Box::into_raw(Box::new(e)),
8934 /// Frees any resources used by the CResult_InitDecodeErrorZ.
8935 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
8936 impl Drop for CResult_InitDecodeErrorZ {
8937 fn drop(&mut self) {
8939 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8940 let _ = unsafe { Box::from_raw(self.contents.result) };
8943 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8944 let _ = unsafe { Box::from_raw(self.contents.err) };
8949 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
8950 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
8951 let contents = if o.result_ok {
8952 let result = unsafe { o.contents.result };
8953 unsafe { o.contents.result = std::ptr::null_mut() };
8954 CResult_InitDecodeErrorZPtr { result }
8956 let err = unsafe { o.contents.err };
8957 unsafe { o.contents.err = std::ptr::null_mut(); }
8958 CResult_InitDecodeErrorZPtr { err }
8962 result_ok: o.result_ok,
8966 impl Clone for CResult_InitDecodeErrorZ {
8967 fn clone(&self) -> Self {
8969 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
8970 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
8973 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
8974 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8980 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
8981 /// but with all dynamically-allocated buffers duplicated in new buffers.
8982 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
8984 /// The contents of CResult_OpenChannelDecodeErrorZ
8985 pub union CResult_OpenChannelDecodeErrorZPtr {
8986 /// A pointer to the contents in the success state.
8987 /// Reading from this pointer when `result_ok` is not set is undefined.
8988 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
8989 /// A pointer to the contents in the error state.
8990 /// Reading from this pointer when `result_ok` is set is undefined.
8991 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8994 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
8995 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8996 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8997 pub struct CResult_OpenChannelDecodeErrorZ {
8998 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
8999 /// `err` or `result` depending on the state of `result_ok`.
9000 pub contents: CResult_OpenChannelDecodeErrorZPtr,
9001 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9002 pub result_ok: bool,
9005 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9006 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
9007 CResult_OpenChannelDecodeErrorZ {
9008 contents: CResult_OpenChannelDecodeErrorZPtr {
9009 result: Box::into_raw(Box::new(o)),
9015 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9016 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
9017 CResult_OpenChannelDecodeErrorZ {
9018 contents: CResult_OpenChannelDecodeErrorZPtr {
9019 err: Box::into_raw(Box::new(e)),
9025 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9026 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
9027 impl Drop for CResult_OpenChannelDecodeErrorZ {
9028 fn drop(&mut self) {
9030 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9031 let _ = unsafe { Box::from_raw(self.contents.result) };
9034 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9035 let _ = unsafe { Box::from_raw(self.contents.err) };
9040 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9041 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9042 let contents = if o.result_ok {
9043 let result = unsafe { o.contents.result };
9044 unsafe { o.contents.result = std::ptr::null_mut() };
9045 CResult_OpenChannelDecodeErrorZPtr { result }
9047 let err = unsafe { o.contents.err };
9048 unsafe { o.contents.err = std::ptr::null_mut(); }
9049 CResult_OpenChannelDecodeErrorZPtr { err }
9053 result_ok: o.result_ok,
9057 impl Clone for CResult_OpenChannelDecodeErrorZ {
9058 fn clone(&self) -> Self {
9060 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9061 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9064 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9065 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9071 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9072 /// but with all dynamically-allocated buffers duplicated in new buffers.
9073 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
9075 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9076 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9077 /// A pointer to the contents in the success state.
9078 /// Reading from this pointer when `result_ok` is not set is undefined.
9079 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9080 /// A pointer to the contents in the error state.
9081 /// Reading from this pointer when `result_ok` is set is undefined.
9082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9085 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9086 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9088 pub struct CResult_RevokeAndACKDecodeErrorZ {
9089 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9090 /// `err` or `result` depending on the state of `result_ok`.
9091 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9092 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9093 pub result_ok: bool,
9096 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9097 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9098 CResult_RevokeAndACKDecodeErrorZ {
9099 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9100 result: Box::into_raw(Box::new(o)),
9106 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9107 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9108 CResult_RevokeAndACKDecodeErrorZ {
9109 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9110 err: Box::into_raw(Box::new(e)),
9116 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9117 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9118 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9119 fn drop(&mut self) {
9121 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9122 let _ = unsafe { Box::from_raw(self.contents.result) };
9125 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9126 let _ = unsafe { Box::from_raw(self.contents.err) };
9131 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9132 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9133 let contents = if o.result_ok {
9134 let result = unsafe { o.contents.result };
9135 unsafe { o.contents.result = std::ptr::null_mut() };
9136 CResult_RevokeAndACKDecodeErrorZPtr { result }
9138 let err = unsafe { o.contents.err };
9139 unsafe { o.contents.err = std::ptr::null_mut(); }
9140 CResult_RevokeAndACKDecodeErrorZPtr { err }
9144 result_ok: o.result_ok,
9148 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9149 fn clone(&self) -> Self {
9151 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9152 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9155 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9156 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9162 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9163 /// but with all dynamically-allocated buffers duplicated in new buffers.
9164 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
9166 /// The contents of CResult_ShutdownDecodeErrorZ
9167 pub union CResult_ShutdownDecodeErrorZPtr {
9168 /// A pointer to the contents in the success state.
9169 /// Reading from this pointer when `result_ok` is not set is undefined.
9170 pub result: *mut crate::lightning::ln::msgs::Shutdown,
9171 /// A pointer to the contents in the error state.
9172 /// Reading from this pointer when `result_ok` is set is undefined.
9173 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9176 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9177 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9179 pub struct CResult_ShutdownDecodeErrorZ {
9180 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9181 /// `err` or `result` depending on the state of `result_ok`.
9182 pub contents: CResult_ShutdownDecodeErrorZPtr,
9183 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9184 pub result_ok: bool,
9187 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9188 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9189 CResult_ShutdownDecodeErrorZ {
9190 contents: CResult_ShutdownDecodeErrorZPtr {
9191 result: Box::into_raw(Box::new(o)),
9197 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9198 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
9199 CResult_ShutdownDecodeErrorZ {
9200 contents: CResult_ShutdownDecodeErrorZPtr {
9201 err: Box::into_raw(Box::new(e)),
9207 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9208 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
9209 impl Drop for CResult_ShutdownDecodeErrorZ {
9210 fn drop(&mut self) {
9212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9213 let _ = unsafe { Box::from_raw(self.contents.result) };
9216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9217 let _ = unsafe { Box::from_raw(self.contents.err) };
9222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
9223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
9224 let contents = if o.result_ok {
9225 let result = unsafe { o.contents.result };
9226 unsafe { o.contents.result = std::ptr::null_mut() };
9227 CResult_ShutdownDecodeErrorZPtr { result }
9229 let err = unsafe { o.contents.err };
9230 unsafe { o.contents.err = std::ptr::null_mut(); }
9231 CResult_ShutdownDecodeErrorZPtr { err }
9235 result_ok: o.result_ok,
9239 impl Clone for CResult_ShutdownDecodeErrorZ {
9240 fn clone(&self) -> Self {
9242 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
9243 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
9246 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
9247 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9253 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9254 /// but with all dynamically-allocated buffers duplicated in new buffers.
9255 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
9257 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
9258 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
9259 /// A pointer to the contents in the success state.
9260 /// Reading from this pointer when `result_ok` is not set is undefined.
9261 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9262 /// A pointer to the contents in the error state.
9263 /// Reading from this pointer when `result_ok` is set is undefined.
9264 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9267 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9268 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9270 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
9271 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9272 /// `err` or `result` depending on the state of `result_ok`.
9273 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
9274 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9275 pub result_ok: bool,
9278 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9279 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
9280 CResult_UpdateFailHTLCDecodeErrorZ {
9281 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9282 result: Box::into_raw(Box::new(o)),
9288 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9289 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
9290 CResult_UpdateFailHTLCDecodeErrorZ {
9291 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9292 err: Box::into_raw(Box::new(e)),
9298 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9299 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
9300 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
9301 fn drop(&mut self) {
9303 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9304 let _ = unsafe { Box::from_raw(self.contents.result) };
9307 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9308 let _ = unsafe { Box::from_raw(self.contents.err) };
9313 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
9314 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9315 let contents = if o.result_ok {
9316 let result = unsafe { o.contents.result };
9317 unsafe { o.contents.result = std::ptr::null_mut() };
9318 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
9320 let err = unsafe { o.contents.err };
9321 unsafe { o.contents.err = std::ptr::null_mut(); }
9322 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
9326 result_ok: o.result_ok,
9330 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
9331 fn clone(&self) -> Self {
9333 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9334 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
9337 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9338 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9344 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9345 /// but with all dynamically-allocated buffers duplicated in new buffers.
9346 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
9348 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9349 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9350 /// A pointer to the contents in the success state.
9351 /// Reading from this pointer when `result_ok` is not set is undefined.
9352 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9353 /// A pointer to the contents in the error state.
9354 /// Reading from this pointer when `result_ok` is set is undefined.
9355 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9358 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9359 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9360 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9361 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9362 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9363 /// `err` or `result` depending on the state of `result_ok`.
9364 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
9365 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9366 pub result_ok: bool,
9369 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9370 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9371 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9372 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9373 result: Box::into_raw(Box::new(o)),
9379 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9380 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9381 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9382 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9383 err: Box::into_raw(Box::new(e)),
9389 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9390 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
9391 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9392 fn drop(&mut self) {
9394 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9395 let _ = unsafe { Box::from_raw(self.contents.result) };
9398 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9399 let _ = unsafe { Box::from_raw(self.contents.err) };
9404 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9405 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9406 let contents = if o.result_ok {
9407 let result = unsafe { o.contents.result };
9408 unsafe { o.contents.result = std::ptr::null_mut() };
9409 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
9411 let err = unsafe { o.contents.err };
9412 unsafe { o.contents.err = std::ptr::null_mut(); }
9413 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
9417 result_ok: o.result_ok,
9421 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9422 fn clone(&self) -> Self {
9424 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9425 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
9428 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9429 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9435 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9436 /// but with all dynamically-allocated buffers duplicated in new buffers.
9437 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
9439 /// The contents of CResult_UpdateFeeDecodeErrorZ
9440 pub union CResult_UpdateFeeDecodeErrorZPtr {
9441 /// A pointer to the contents in the success state.
9442 /// Reading from this pointer when `result_ok` is not set is undefined.
9443 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
9444 /// A pointer to the contents in the error state.
9445 /// Reading from this pointer when `result_ok` is set is undefined.
9446 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9449 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9450 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9452 pub struct CResult_UpdateFeeDecodeErrorZ {
9453 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9454 /// `err` or `result` depending on the state of `result_ok`.
9455 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
9456 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9457 pub result_ok: bool,
9460 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9461 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
9462 CResult_UpdateFeeDecodeErrorZ {
9463 contents: CResult_UpdateFeeDecodeErrorZPtr {
9464 result: Box::into_raw(Box::new(o)),
9470 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9471 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
9472 CResult_UpdateFeeDecodeErrorZ {
9473 contents: CResult_UpdateFeeDecodeErrorZPtr {
9474 err: Box::into_raw(Box::new(e)),
9480 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9481 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
9482 impl Drop for CResult_UpdateFeeDecodeErrorZ {
9483 fn drop(&mut self) {
9485 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9486 let _ = unsafe { Box::from_raw(self.contents.result) };
9489 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9490 let _ = unsafe { Box::from_raw(self.contents.err) };
9495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
9496 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
9497 let contents = if o.result_ok {
9498 let result = unsafe { o.contents.result };
9499 unsafe { o.contents.result = std::ptr::null_mut() };
9500 CResult_UpdateFeeDecodeErrorZPtr { result }
9502 let err = unsafe { o.contents.err };
9503 unsafe { o.contents.err = std::ptr::null_mut(); }
9504 CResult_UpdateFeeDecodeErrorZPtr { err }
9508 result_ok: o.result_ok,
9512 impl Clone for CResult_UpdateFeeDecodeErrorZ {
9513 fn clone(&self) -> Self {
9515 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
9516 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
9519 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
9520 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9526 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9527 /// but with all dynamically-allocated buffers duplicated in new buffers.
9528 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
9530 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9531 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9532 /// A pointer to the contents in the success state.
9533 /// Reading from this pointer when `result_ok` is not set is undefined.
9534 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9535 /// A pointer to the contents in the error state.
9536 /// Reading from this pointer when `result_ok` is set is undefined.
9537 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9540 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9541 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9542 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9543 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
9544 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9545 /// `err` or `result` depending on the state of `result_ok`.
9546 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
9547 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9548 pub result_ok: bool,
9551 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9552 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9553 CResult_UpdateFulfillHTLCDecodeErrorZ {
9554 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9555 result: Box::into_raw(Box::new(o)),
9561 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9562 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9563 CResult_UpdateFulfillHTLCDecodeErrorZ {
9564 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9565 err: Box::into_raw(Box::new(e)),
9571 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9572 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
9573 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
9574 fn drop(&mut self) {
9576 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9577 let _ = unsafe { Box::from_raw(self.contents.result) };
9580 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9581 let _ = unsafe { Box::from_raw(self.contents.err) };
9586 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
9587 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9588 let contents = if o.result_ok {
9589 let result = unsafe { o.contents.result };
9590 unsafe { o.contents.result = std::ptr::null_mut() };
9591 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
9593 let err = unsafe { o.contents.err };
9594 unsafe { o.contents.err = std::ptr::null_mut(); }
9595 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
9599 result_ok: o.result_ok,
9603 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
9604 fn clone(&self) -> Self {
9606 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9607 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
9610 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9611 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9617 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9618 /// but with all dynamically-allocated buffers duplicated in new buffers.
9619 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
9621 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
9622 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
9623 /// A pointer to the contents in the success state.
9624 /// Reading from this pointer when `result_ok` is not set is undefined.
9625 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9626 /// A pointer to the contents in the error state.
9627 /// Reading from this pointer when `result_ok` is set is undefined.
9628 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9631 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9632 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9633 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9634 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
9635 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9636 /// `err` or `result` depending on the state of `result_ok`.
9637 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
9638 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9639 pub result_ok: bool,
9642 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9643 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
9644 CResult_UpdateAddHTLCDecodeErrorZ {
9645 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9646 result: Box::into_raw(Box::new(o)),
9652 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9653 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
9654 CResult_UpdateAddHTLCDecodeErrorZ {
9655 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9656 err: Box::into_raw(Box::new(e)),
9662 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
9663 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
9664 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
9665 fn drop(&mut self) {
9667 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9668 let _ = unsafe { Box::from_raw(self.contents.result) };
9671 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9672 let _ = unsafe { Box::from_raw(self.contents.err) };
9677 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
9678 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9679 let contents = if o.result_ok {
9680 let result = unsafe { o.contents.result };
9681 unsafe { o.contents.result = std::ptr::null_mut() };
9682 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
9684 let err = unsafe { o.contents.err };
9685 unsafe { o.contents.err = std::ptr::null_mut(); }
9686 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
9690 result_ok: o.result_ok,
9694 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
9695 fn clone(&self) -> Self {
9697 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9698 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
9701 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9702 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9708 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9709 /// but with all dynamically-allocated buffers duplicated in new buffers.
9710 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
9712 /// The contents of CResult_PingDecodeErrorZ
9713 pub union CResult_PingDecodeErrorZPtr {
9714 /// A pointer to the contents in the success state.
9715 /// Reading from this pointer when `result_ok` is not set is undefined.
9716 pub result: *mut crate::lightning::ln::msgs::Ping,
9717 /// A pointer to the contents in the error state.
9718 /// Reading from this pointer when `result_ok` is set is undefined.
9719 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9722 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9723 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9725 pub struct CResult_PingDecodeErrorZ {
9726 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
9727 /// `err` or `result` depending on the state of `result_ok`.
9728 pub contents: CResult_PingDecodeErrorZPtr,
9729 /// Whether this CResult_PingDecodeErrorZ represents a success state.
9730 pub result_ok: bool,
9733 /// Creates a new CResult_PingDecodeErrorZ in the success state.
9734 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
9735 CResult_PingDecodeErrorZ {
9736 contents: CResult_PingDecodeErrorZPtr {
9737 result: Box::into_raw(Box::new(o)),
9743 /// Creates a new CResult_PingDecodeErrorZ in the error state.
9744 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
9745 CResult_PingDecodeErrorZ {
9746 contents: CResult_PingDecodeErrorZPtr {
9747 err: Box::into_raw(Box::new(e)),
9753 /// Frees any resources used by the CResult_PingDecodeErrorZ.
9754 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
9755 impl Drop for CResult_PingDecodeErrorZ {
9756 fn drop(&mut self) {
9758 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9759 let _ = unsafe { Box::from_raw(self.contents.result) };
9762 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9763 let _ = unsafe { Box::from_raw(self.contents.err) };
9768 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
9769 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
9770 let contents = if o.result_ok {
9771 let result = unsafe { o.contents.result };
9772 unsafe { o.contents.result = std::ptr::null_mut() };
9773 CResult_PingDecodeErrorZPtr { result }
9775 let err = unsafe { o.contents.err };
9776 unsafe { o.contents.err = std::ptr::null_mut(); }
9777 CResult_PingDecodeErrorZPtr { err }
9781 result_ok: o.result_ok,
9785 impl Clone for CResult_PingDecodeErrorZ {
9786 fn clone(&self) -> Self {
9788 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
9789 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
9792 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
9793 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9799 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
9800 /// but with all dynamically-allocated buffers duplicated in new buffers.
9801 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
9803 /// The contents of CResult_PongDecodeErrorZ
9804 pub union CResult_PongDecodeErrorZPtr {
9805 /// A pointer to the contents in the success state.
9806 /// Reading from this pointer when `result_ok` is not set is undefined.
9807 pub result: *mut crate::lightning::ln::msgs::Pong,
9808 /// A pointer to the contents in the error state.
9809 /// Reading from this pointer when `result_ok` is set is undefined.
9810 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9813 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9814 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9816 pub struct CResult_PongDecodeErrorZ {
9817 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
9818 /// `err` or `result` depending on the state of `result_ok`.
9819 pub contents: CResult_PongDecodeErrorZPtr,
9820 /// Whether this CResult_PongDecodeErrorZ represents a success state.
9821 pub result_ok: bool,
9824 /// Creates a new CResult_PongDecodeErrorZ in the success state.
9825 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
9826 CResult_PongDecodeErrorZ {
9827 contents: CResult_PongDecodeErrorZPtr {
9828 result: Box::into_raw(Box::new(o)),
9834 /// Creates a new CResult_PongDecodeErrorZ in the error state.
9835 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
9836 CResult_PongDecodeErrorZ {
9837 contents: CResult_PongDecodeErrorZPtr {
9838 err: Box::into_raw(Box::new(e)),
9844 /// Frees any resources used by the CResult_PongDecodeErrorZ.
9845 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
9846 impl Drop for CResult_PongDecodeErrorZ {
9847 fn drop(&mut self) {
9849 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9850 let _ = unsafe { Box::from_raw(self.contents.result) };
9853 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9854 let _ = unsafe { Box::from_raw(self.contents.err) };
9859 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
9860 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
9861 let contents = if o.result_ok {
9862 let result = unsafe { o.contents.result };
9863 unsafe { o.contents.result = std::ptr::null_mut() };
9864 CResult_PongDecodeErrorZPtr { result }
9866 let err = unsafe { o.contents.err };
9867 unsafe { o.contents.err = std::ptr::null_mut(); }
9868 CResult_PongDecodeErrorZPtr { err }
9872 result_ok: o.result_ok,
9876 impl Clone for CResult_PongDecodeErrorZ {
9877 fn clone(&self) -> Self {
9879 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
9880 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
9883 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
9884 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9890 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
9891 /// but with all dynamically-allocated buffers duplicated in new buffers.
9892 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
9894 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9895 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9896 /// A pointer to the contents in the success state.
9897 /// Reading from this pointer when `result_ok` is not set is undefined.
9898 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
9899 /// A pointer to the contents in the error state.
9900 /// Reading from this pointer when `result_ok` is set is undefined.
9901 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9904 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9905 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9907 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9908 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
9909 /// `err` or `result` depending on the state of `result_ok`.
9910 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
9911 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
9912 pub result_ok: bool,
9915 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
9916 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9917 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9918 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9919 result: Box::into_raw(Box::new(o)),
9925 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
9926 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9927 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9928 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9929 err: Box::into_raw(Box::new(e)),
9935 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
9936 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
9937 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9938 fn drop(&mut self) {
9940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9941 let _ = unsafe { Box::from_raw(self.contents.result) };
9944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9945 let _ = unsafe { Box::from_raw(self.contents.err) };
9950 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
9952 let contents = if o.result_ok {
9953 let result = unsafe { o.contents.result };
9954 unsafe { o.contents.result = std::ptr::null_mut() };
9955 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
9957 let err = unsafe { o.contents.err };
9958 unsafe { o.contents.err = std::ptr::null_mut(); }
9959 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
9963 result_ok: o.result_ok,
9967 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9968 fn clone(&self) -> Self {
9970 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9971 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
9974 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9981 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9982 /// but with all dynamically-allocated buffers duplicated in new buffers.
9983 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
9985 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
9986 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
9987 /// A pointer to the contents in the success state.
9988 /// Reading from this pointer when `result_ok` is not set is undefined.
9989 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
9990 /// A pointer to the contents in the error state.
9991 /// Reading from this pointer when `result_ok` is set is undefined.
9992 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9995 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9996 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9997 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9998 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
9999 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10000 /// `err` or `result` depending on the state of `result_ok`.
10001 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
10002 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10003 pub result_ok: bool,
10006 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10007 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
10008 CResult_ChannelAnnouncementDecodeErrorZ {
10009 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10010 result: Box::into_raw(Box::new(o)),
10016 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10017 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
10018 CResult_ChannelAnnouncementDecodeErrorZ {
10019 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10020 err: Box::into_raw(Box::new(e)),
10026 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10027 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
10028 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
10029 fn drop(&mut self) {
10030 if self.result_ok {
10031 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10032 let _ = unsafe { Box::from_raw(self.contents.result) };
10035 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10036 let _ = unsafe { Box::from_raw(self.contents.err) };
10041 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10042 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10043 let contents = if o.result_ok {
10044 let result = unsafe { o.contents.result };
10045 unsafe { o.contents.result = std::ptr::null_mut() };
10046 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10048 let err = unsafe { o.contents.err };
10049 unsafe { o.contents.err = std::ptr::null_mut(); }
10050 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10054 result_ok: o.result_ok,
10058 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10059 fn clone(&self) -> Self {
10060 if self.result_ok {
10061 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10062 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10065 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10066 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10072 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10073 /// but with all dynamically-allocated buffers duplicated in new buffers.
10074 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
10076 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10077 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10078 /// A pointer to the contents in the success state.
10079 /// Reading from this pointer when `result_ok` is not set is undefined.
10080 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10081 /// A pointer to the contents in the error state.
10082 /// Reading from this pointer when `result_ok` is set is undefined.
10083 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10086 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10087 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10089 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10090 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10091 /// `err` or `result` depending on the state of `result_ok`.
10092 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10093 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10094 pub result_ok: bool,
10097 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10098 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10099 CResult_UnsignedChannelUpdateDecodeErrorZ {
10100 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10101 result: Box::into_raw(Box::new(o)),
10107 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10108 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10109 CResult_UnsignedChannelUpdateDecodeErrorZ {
10110 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10111 err: Box::into_raw(Box::new(e)),
10117 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10118 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10119 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10120 fn drop(&mut self) {
10121 if self.result_ok {
10122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10123 let _ = unsafe { Box::from_raw(self.contents.result) };
10126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10127 let _ = unsafe { Box::from_raw(self.contents.err) };
10132 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10133 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10134 let contents = if o.result_ok {
10135 let result = unsafe { o.contents.result };
10136 unsafe { o.contents.result = std::ptr::null_mut() };
10137 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10139 let err = unsafe { o.contents.err };
10140 unsafe { o.contents.err = std::ptr::null_mut(); }
10141 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10145 result_ok: o.result_ok,
10149 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10150 fn clone(&self) -> Self {
10151 if self.result_ok {
10152 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10153 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10156 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10157 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10163 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10164 /// but with all dynamically-allocated buffers duplicated in new buffers.
10165 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
10167 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10168 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10169 /// A pointer to the contents in the success state.
10170 /// Reading from this pointer when `result_ok` is not set is undefined.
10171 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10172 /// A pointer to the contents in the error state.
10173 /// Reading from this pointer when `result_ok` is set is undefined.
10174 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10177 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10178 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10180 pub struct CResult_ChannelUpdateDecodeErrorZ {
10181 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10182 /// `err` or `result` depending on the state of `result_ok`.
10183 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10184 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10185 pub result_ok: bool,
10188 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10189 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10190 CResult_ChannelUpdateDecodeErrorZ {
10191 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10192 result: Box::into_raw(Box::new(o)),
10198 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10199 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
10200 CResult_ChannelUpdateDecodeErrorZ {
10201 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10202 err: Box::into_raw(Box::new(e)),
10208 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10209 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
10210 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
10211 fn drop(&mut self) {
10212 if self.result_ok {
10213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10214 let _ = unsafe { Box::from_raw(self.contents.result) };
10217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10218 let _ = unsafe { Box::from_raw(self.contents.err) };
10223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
10224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10225 let contents = if o.result_ok {
10226 let result = unsafe { o.contents.result };
10227 unsafe { o.contents.result = std::ptr::null_mut() };
10228 CResult_ChannelUpdateDecodeErrorZPtr { result }
10230 let err = unsafe { o.contents.err };
10231 unsafe { o.contents.err = std::ptr::null_mut(); }
10232 CResult_ChannelUpdateDecodeErrorZPtr { err }
10236 result_ok: o.result_ok,
10240 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
10241 fn clone(&self) -> Self {
10242 if self.result_ok {
10243 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10244 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
10247 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10254 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10255 /// but with all dynamically-allocated buffers duplicated in new buffers.
10256 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
10258 /// The contents of CResult_ErrorMessageDecodeErrorZ
10259 pub union CResult_ErrorMessageDecodeErrorZPtr {
10260 /// A pointer to the contents in the success state.
10261 /// Reading from this pointer when `result_ok` is not set is undefined.
10262 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
10263 /// A pointer to the contents in the error state.
10264 /// Reading from this pointer when `result_ok` is set is undefined.
10265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10268 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10269 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10271 pub struct CResult_ErrorMessageDecodeErrorZ {
10272 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10273 /// `err` or `result` depending on the state of `result_ok`.
10274 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
10275 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10276 pub result_ok: bool,
10279 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10280 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
10281 CResult_ErrorMessageDecodeErrorZ {
10282 contents: CResult_ErrorMessageDecodeErrorZPtr {
10283 result: Box::into_raw(Box::new(o)),
10289 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10290 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
10291 CResult_ErrorMessageDecodeErrorZ {
10292 contents: CResult_ErrorMessageDecodeErrorZPtr {
10293 err: Box::into_raw(Box::new(e)),
10299 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10300 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
10301 impl Drop for CResult_ErrorMessageDecodeErrorZ {
10302 fn drop(&mut self) {
10303 if self.result_ok {
10304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10305 let _ = unsafe { Box::from_raw(self.contents.result) };
10308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10309 let _ = unsafe { Box::from_raw(self.contents.err) };
10314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
10315 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
10316 let contents = if o.result_ok {
10317 let result = unsafe { o.contents.result };
10318 unsafe { o.contents.result = std::ptr::null_mut() };
10319 CResult_ErrorMessageDecodeErrorZPtr { result }
10321 let err = unsafe { o.contents.err };
10322 unsafe { o.contents.err = std::ptr::null_mut(); }
10323 CResult_ErrorMessageDecodeErrorZPtr { err }
10327 result_ok: o.result_ok,
10331 impl Clone for CResult_ErrorMessageDecodeErrorZ {
10332 fn clone(&self) -> Self {
10333 if self.result_ok {
10334 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
10335 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
10338 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
10339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10345 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10346 /// but with all dynamically-allocated buffers duplicated in new buffers.
10347 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
10349 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10350 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10351 /// A pointer to the contents in the success state.
10352 /// Reading from this pointer when `result_ok` is not set is undefined.
10353 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
10354 /// A pointer to the contents in the error state.
10355 /// Reading from this pointer when `result_ok` is set is undefined.
10356 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10359 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10360 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10362 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10363 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10364 /// `err` or `result` depending on the state of `result_ok`.
10365 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
10366 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10367 pub result_ok: bool,
10370 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10371 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10372 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10373 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10374 result: Box::into_raw(Box::new(o)),
10380 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10381 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10382 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10383 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10384 err: Box::into_raw(Box::new(e)),
10390 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10391 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
10392 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10393 fn drop(&mut self) {
10394 if self.result_ok {
10395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10396 let _ = unsafe { Box::from_raw(self.contents.result) };
10399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10400 let _ = unsafe { Box::from_raw(self.contents.err) };
10405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10407 let contents = if o.result_ok {
10408 let result = unsafe { o.contents.result };
10409 unsafe { o.contents.result = std::ptr::null_mut() };
10410 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
10412 let err = unsafe { o.contents.err };
10413 unsafe { o.contents.err = std::ptr::null_mut(); }
10414 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
10418 result_ok: o.result_ok,
10422 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10423 fn clone(&self) -> Self {
10424 if self.result_ok {
10425 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10426 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10429 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10430 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10436 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10437 /// but with all dynamically-allocated buffers duplicated in new buffers.
10438 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
10440 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
10441 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
10442 /// A pointer to the contents in the success state.
10443 /// Reading from this pointer when `result_ok` is not set is undefined.
10444 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10445 /// A pointer to the contents in the error state.
10446 /// Reading from this pointer when `result_ok` is set is undefined.
10447 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10450 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10451 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10453 pub struct CResult_NodeAnnouncementDecodeErrorZ {
10454 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10455 /// `err` or `result` depending on the state of `result_ok`.
10456 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
10457 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10458 pub result_ok: bool,
10461 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10462 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
10463 CResult_NodeAnnouncementDecodeErrorZ {
10464 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10465 result: Box::into_raw(Box::new(o)),
10471 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10472 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
10473 CResult_NodeAnnouncementDecodeErrorZ {
10474 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10475 err: Box::into_raw(Box::new(e)),
10481 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10482 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
10483 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
10484 fn drop(&mut self) {
10485 if self.result_ok {
10486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10487 let _ = unsafe { Box::from_raw(self.contents.result) };
10490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10491 let _ = unsafe { Box::from_raw(self.contents.err) };
10496 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
10497 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10498 let contents = if o.result_ok {
10499 let result = unsafe { o.contents.result };
10500 unsafe { o.contents.result = std::ptr::null_mut() };
10501 CResult_NodeAnnouncementDecodeErrorZPtr { result }
10503 let err = unsafe { o.contents.err };
10504 unsafe { o.contents.err = std::ptr::null_mut(); }
10505 CResult_NodeAnnouncementDecodeErrorZPtr { err }
10509 result_ok: o.result_ok,
10513 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
10514 fn clone(&self) -> Self {
10515 if self.result_ok {
10516 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10517 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10520 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10521 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10527 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10528 /// but with all dynamically-allocated buffers duplicated in new buffers.
10529 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
10531 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10532 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
10533 /// A pointer to the contents in the success state.
10534 /// Reading from this pointer when `result_ok` is not set is undefined.
10535 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
10536 /// A pointer to the contents in the error state.
10537 /// Reading from this pointer when `result_ok` is set is undefined.
10538 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10541 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10542 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10544 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
10545 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10546 /// `err` or `result` depending on the state of `result_ok`.
10547 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
10548 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10549 pub result_ok: bool,
10552 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10553 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10554 CResult_QueryShortChannelIdsDecodeErrorZ {
10555 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10556 result: Box::into_raw(Box::new(o)),
10562 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10563 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10564 CResult_QueryShortChannelIdsDecodeErrorZ {
10565 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10566 err: Box::into_raw(Box::new(e)),
10572 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10573 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
10574 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
10575 fn drop(&mut self) {
10576 if self.result_ok {
10577 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10578 let _ = unsafe { Box::from_raw(self.contents.result) };
10581 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10582 let _ = unsafe { Box::from_raw(self.contents.err) };
10587 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
10588 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
10589 let contents = if o.result_ok {
10590 let result = unsafe { o.contents.result };
10591 unsafe { o.contents.result = std::ptr::null_mut() };
10592 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
10594 let err = unsafe { o.contents.err };
10595 unsafe { o.contents.err = std::ptr::null_mut(); }
10596 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
10600 result_ok: o.result_ok,
10604 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
10605 fn clone(&self) -> Self {
10606 if self.result_ok {
10607 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10608 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
10611 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10612 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10618 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10619 /// but with all dynamically-allocated buffers duplicated in new buffers.
10620 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
10622 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10623 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10624 /// A pointer to the contents in the success state.
10625 /// Reading from this pointer when `result_ok` is not set is undefined.
10626 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
10627 /// A pointer to the contents in the error state.
10628 /// Reading from this pointer when `result_ok` is set is undefined.
10629 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10632 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10633 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10635 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10636 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10637 /// `err` or `result` depending on the state of `result_ok`.
10638 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
10639 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10640 pub result_ok: bool,
10643 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10644 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10645 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10646 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10647 result: Box::into_raw(Box::new(o)),
10653 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10654 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10655 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10656 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10657 err: Box::into_raw(Box::new(e)),
10663 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10664 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
10665 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10666 fn drop(&mut self) {
10667 if self.result_ok {
10668 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10669 let _ = unsafe { Box::from_raw(self.contents.result) };
10672 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10673 let _ = unsafe { Box::from_raw(self.contents.err) };
10678 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10679 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
10680 let contents = if o.result_ok {
10681 let result = unsafe { o.contents.result };
10682 unsafe { o.contents.result = std::ptr::null_mut() };
10683 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
10685 let err = unsafe { o.contents.err };
10686 unsafe { o.contents.err = std::ptr::null_mut(); }
10687 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
10691 result_ok: o.result_ok,
10695 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10696 fn clone(&self) -> Self {
10697 if self.result_ok {
10698 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10699 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
10702 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10703 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10709 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10710 /// but with all dynamically-allocated buffers duplicated in new buffers.
10711 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
10713 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
10714 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
10715 /// A pointer to the contents in the success state.
10716 /// Reading from this pointer when `result_ok` is not set is undefined.
10717 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
10718 /// A pointer to the contents in the error state.
10719 /// Reading from this pointer when `result_ok` is set is undefined.
10720 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10723 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10724 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10726 pub struct CResult_QueryChannelRangeDecodeErrorZ {
10727 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10728 /// `err` or `result` depending on the state of `result_ok`.
10729 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
10730 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10731 pub result_ok: bool,
10734 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10735 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
10736 CResult_QueryChannelRangeDecodeErrorZ {
10737 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10738 result: Box::into_raw(Box::new(o)),
10744 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10745 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
10746 CResult_QueryChannelRangeDecodeErrorZ {
10747 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10748 err: Box::into_raw(Box::new(e)),
10754 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10755 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
10756 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
10757 fn drop(&mut self) {
10758 if self.result_ok {
10759 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10760 let _ = unsafe { Box::from_raw(self.contents.result) };
10763 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10764 let _ = unsafe { Box::from_raw(self.contents.err) };
10769 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
10770 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10771 let contents = if o.result_ok {
10772 let result = unsafe { o.contents.result };
10773 unsafe { o.contents.result = std::ptr::null_mut() };
10774 CResult_QueryChannelRangeDecodeErrorZPtr { result }
10776 let err = unsafe { o.contents.err };
10777 unsafe { o.contents.err = std::ptr::null_mut(); }
10778 CResult_QueryChannelRangeDecodeErrorZPtr { err }
10782 result_ok: o.result_ok,
10786 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
10787 fn clone(&self) -> Self {
10788 if self.result_ok {
10789 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10790 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
10793 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10794 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10800 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10801 /// but with all dynamically-allocated buffers duplicated in new buffers.
10802 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
10804 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
10805 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
10806 /// A pointer to the contents in the success state.
10807 /// Reading from this pointer when `result_ok` is not set is undefined.
10808 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
10809 /// A pointer to the contents in the error state.
10810 /// Reading from this pointer when `result_ok` is set is undefined.
10811 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10814 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10815 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10816 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10817 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
10818 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10819 /// `err` or `result` depending on the state of `result_ok`.
10820 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
10821 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10822 pub result_ok: bool,
10825 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10826 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
10827 CResult_ReplyChannelRangeDecodeErrorZ {
10828 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10829 result: Box::into_raw(Box::new(o)),
10835 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10836 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
10837 CResult_ReplyChannelRangeDecodeErrorZ {
10838 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10839 err: Box::into_raw(Box::new(e)),
10845 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10846 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
10847 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
10848 fn drop(&mut self) {
10849 if self.result_ok {
10850 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10851 let _ = unsafe { Box::from_raw(self.contents.result) };
10854 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10855 let _ = unsafe { Box::from_raw(self.contents.err) };
10860 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
10861 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10862 let contents = if o.result_ok {
10863 let result = unsafe { o.contents.result };
10864 unsafe { o.contents.result = std::ptr::null_mut() };
10865 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
10867 let err = unsafe { o.contents.err };
10868 unsafe { o.contents.err = std::ptr::null_mut(); }
10869 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
10873 result_ok: o.result_ok,
10877 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
10878 fn clone(&self) -> Self {
10879 if self.result_ok {
10880 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10881 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
10884 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10885 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10891 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10892 /// but with all dynamically-allocated buffers duplicated in new buffers.
10893 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
10895 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
10896 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
10897 /// A pointer to the contents in the success state.
10898 /// Reading from this pointer when `result_ok` is not set is undefined.
10899 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
10900 /// A pointer to the contents in the error state.
10901 /// Reading from this pointer when `result_ok` is set is undefined.
10902 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10905 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10906 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10907 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10908 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
10909 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10910 /// `err` or `result` depending on the state of `result_ok`.
10911 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
10912 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10913 pub result_ok: bool,
10916 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10917 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
10918 CResult_GossipTimestampFilterDecodeErrorZ {
10919 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10920 result: Box::into_raw(Box::new(o)),
10926 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10927 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
10928 CResult_GossipTimestampFilterDecodeErrorZ {
10929 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10930 err: Box::into_raw(Box::new(e)),
10936 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
10937 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
10938 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
10939 fn drop(&mut self) {
10940 if self.result_ok {
10941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10942 let _ = unsafe { Box::from_raw(self.contents.result) };
10945 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10946 let _ = unsafe { Box::from_raw(self.contents.err) };
10951 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
10952 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
10953 let contents = if o.result_ok {
10954 let result = unsafe { o.contents.result };
10955 unsafe { o.contents.result = std::ptr::null_mut() };
10956 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
10958 let err = unsafe { o.contents.err };
10959 unsafe { o.contents.err = std::ptr::null_mut(); }
10960 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
10964 result_ok: o.result_ok,
10968 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
10969 fn clone(&self) -> Self {
10970 if self.result_ok {
10971 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10972 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
10975 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10976 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10982 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10983 /// but with all dynamically-allocated buffers duplicated in new buffers.
10984 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
10986 /// The contents of CResult_InvoiceSignOrCreationErrorZ
10987 pub union CResult_InvoiceSignOrCreationErrorZPtr {
10988 /// A pointer to the contents in the success state.
10989 /// Reading from this pointer when `result_ok` is not set is undefined.
10990 pub result: *mut crate::lightning_invoice::Invoice,
10991 /// A pointer to the contents in the error state.
10992 /// Reading from this pointer when `result_ok` is set is undefined.
10993 pub err: *mut crate::lightning_invoice::SignOrCreationError,
10996 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10997 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10999 pub struct CResult_InvoiceSignOrCreationErrorZ {
11000 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11001 /// `err` or `result` depending on the state of `result_ok`.
11002 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
11003 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11004 pub result_ok: bool,
11007 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11008 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
11009 CResult_InvoiceSignOrCreationErrorZ {
11010 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11011 result: Box::into_raw(Box::new(o)),
11017 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11018 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
11019 CResult_InvoiceSignOrCreationErrorZ {
11020 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11021 err: Box::into_raw(Box::new(e)),
11027 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11028 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
11029 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
11030 fn drop(&mut self) {
11031 if self.result_ok {
11032 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11033 let _ = unsafe { Box::from_raw(self.contents.result) };
11036 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11037 let _ = unsafe { Box::from_raw(self.contents.err) };
11042 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11043 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11044 let contents = if o.result_ok {
11045 let result = unsafe { o.contents.result };
11046 unsafe { o.contents.result = std::ptr::null_mut() };
11047 CResult_InvoiceSignOrCreationErrorZPtr { result }
11049 let err = unsafe { o.contents.err };
11050 unsafe { o.contents.err = std::ptr::null_mut(); }
11051 CResult_InvoiceSignOrCreationErrorZPtr { err }
11055 result_ok: o.result_ok,
11059 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11060 fn clone(&self) -> Self {
11061 if self.result_ok {
11062 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11063 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11066 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11067 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11073 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11074 /// but with all dynamically-allocated buffers duplicated in new buffers.
11075 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }