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,
3793 /// The contents of CResult_NoneAPIErrorZ
3794 pub union CResult_NoneAPIErrorZPtr {
3795 /// Note that this value is always NULL, as there are no contents in the OK variant
3796 pub result: *mut std::ffi::c_void,
3797 /// A pointer to the contents in the error state.
3798 /// Reading from this pointer when `result_ok` is set is undefined.
3799 pub err: *mut crate::lightning::util::errors::APIError,
3802 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
3803 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
3804 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3805 pub struct CResult_NoneAPIErrorZ {
3806 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
3807 /// `err` or `result` depending on the state of `result_ok`.
3808 pub contents: CResult_NoneAPIErrorZPtr,
3809 /// Whether this CResult_NoneAPIErrorZ represents a success state.
3810 pub result_ok: bool,
3813 /// Creates a new CResult_NoneAPIErrorZ in the success state.
3814 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
3815 CResult_NoneAPIErrorZ {
3816 contents: CResult_NoneAPIErrorZPtr {
3817 result: std::ptr::null_mut(),
3823 /// Creates a new CResult_NoneAPIErrorZ in the error state.
3824 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
3825 CResult_NoneAPIErrorZ {
3826 contents: CResult_NoneAPIErrorZPtr {
3827 err: Box::into_raw(Box::new(e)),
3833 /// Frees any resources used by the CResult_NoneAPIErrorZ.
3834 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
3835 impl Drop for CResult_NoneAPIErrorZ {
3836 fn drop(&mut self) {
3839 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3840 let _ = unsafe { Box::from_raw(self.contents.err) };
3845 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
3846 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
3847 let contents = if o.result_ok {
3848 let _ = unsafe { Box::from_raw(o.contents.result) };
3849 o.contents.result = std::ptr::null_mut();
3850 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
3852 let err = unsafe { o.contents.err };
3853 unsafe { o.contents.err = std::ptr::null_mut(); }
3854 CResult_NoneAPIErrorZPtr { err }
3858 result_ok: o.result_ok,
3862 impl Clone for CResult_NoneAPIErrorZ {
3863 fn clone(&self) -> Self {
3865 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
3866 result: std::ptr::null_mut()
3869 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
3870 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
3876 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
3877 /// but with all dynamically-allocated buffers duplicated in new buffers.
3878 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
3880 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
3881 /// This corresponds to std::vector in C++
3882 pub struct CVec_CResult_NoneAPIErrorZZ {
3883 /// The elements in the array.
3884 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3885 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
3886 /// The number of elements pointed to by `data`.
3889 impl CVec_CResult_NoneAPIErrorZZ {
3890 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
3891 if self.datalen == 0 { return Vec::new(); }
3892 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3893 self.data = std::ptr::null_mut();
3897 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
3898 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3901 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
3902 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
3903 let datalen = v.len();
3904 let data = Box::into_raw(v.into_boxed_slice());
3905 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3910 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
3911 impl Drop for CVec_CResult_NoneAPIErrorZZ {
3912 fn drop(&mut self) {
3913 if self.datalen == 0 { return; }
3914 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3917 impl Clone for CVec_CResult_NoneAPIErrorZZ {
3918 fn clone(&self) -> Self {
3919 let mut res = Vec::new();
3920 if self.datalen == 0 { return Self::from(res); }
3921 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3926 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
3927 /// This corresponds to std::vector in C++
3928 pub struct CVec_APIErrorZ {
3929 /// The elements in the array.
3930 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3931 pub data: *mut crate::lightning::util::errors::APIError,
3932 /// The number of elements pointed to by `data`.
3935 impl CVec_APIErrorZ {
3936 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
3937 if self.datalen == 0 { return Vec::new(); }
3938 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3939 self.data = std::ptr::null_mut();
3943 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
3944 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3947 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
3948 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
3949 let datalen = v.len();
3950 let data = Box::into_raw(v.into_boxed_slice());
3951 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3955 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3956 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
3957 impl Drop for CVec_APIErrorZ {
3958 fn drop(&mut self) {
3959 if self.datalen == 0 { return; }
3960 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3963 impl Clone for CVec_APIErrorZ {
3964 fn clone(&self) -> Self {
3965 let mut res = Vec::new();
3966 if self.datalen == 0 { return Self::from(res); }
3967 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3972 /// The contents of CResult_NonePaymentSendFailureZ
3973 pub union CResult_NonePaymentSendFailureZPtr {
3974 /// Note that this value is always NULL, as there are no contents in the OK variant
3975 pub result: *mut std::ffi::c_void,
3976 /// A pointer to the contents in the error state.
3977 /// Reading from this pointer when `result_ok` is set is undefined.
3978 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
3981 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
3982 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
3983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3984 pub struct CResult_NonePaymentSendFailureZ {
3985 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
3986 /// `err` or `result` depending on the state of `result_ok`.
3987 pub contents: CResult_NonePaymentSendFailureZPtr,
3988 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
3989 pub result_ok: bool,
3992 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
3993 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
3994 CResult_NonePaymentSendFailureZ {
3995 contents: CResult_NonePaymentSendFailureZPtr {
3996 result: std::ptr::null_mut(),
4002 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4003 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4004 CResult_NonePaymentSendFailureZ {
4005 contents: CResult_NonePaymentSendFailureZPtr {
4006 err: Box::into_raw(Box::new(e)),
4012 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4013 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4014 impl Drop for CResult_NonePaymentSendFailureZ {
4015 fn drop(&mut self) {
4018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4019 let _ = unsafe { Box::from_raw(self.contents.err) };
4024 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4025 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4026 let contents = if o.result_ok {
4027 let _ = unsafe { Box::from_raw(o.contents.result) };
4028 o.contents.result = std::ptr::null_mut();
4029 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4031 let err = unsafe { o.contents.err };
4032 unsafe { o.contents.err = std::ptr::null_mut(); }
4033 CResult_NonePaymentSendFailureZPtr { err }
4037 result_ok: o.result_ok,
4041 impl Clone for CResult_NonePaymentSendFailureZ {
4042 fn clone(&self) -> Self {
4044 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4045 result: std::ptr::null_mut()
4048 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4049 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4055 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4056 /// but with all dynamically-allocated buffers duplicated in new buffers.
4057 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4059 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4060 /// This corresponds to std::vector in C++
4061 pub struct CVec_NetAddressZ {
4062 /// The elements in the array.
4063 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4064 pub data: *mut crate::lightning::ln::msgs::NetAddress,
4065 /// The number of elements pointed to by `data`.
4068 impl CVec_NetAddressZ {
4069 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4070 if self.datalen == 0 { return Vec::new(); }
4071 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4072 self.data = std::ptr::null_mut();
4076 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4077 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4080 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4081 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4082 let datalen = v.len();
4083 let data = Box::into_raw(v.into_boxed_slice());
4084 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4088 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4089 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4090 impl Drop for CVec_NetAddressZ {
4091 fn drop(&mut self) {
4092 if self.datalen == 0 { return; }
4093 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4096 impl Clone for CVec_NetAddressZ {
4097 fn clone(&self) -> Self {
4098 let mut res = Vec::new();
4099 if self.datalen == 0 { return Self::from(res); }
4100 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4105 /// A tuple of 2 elements. See the individual fields for the types contained.
4106 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4107 /// The element at position 0
4108 pub a: crate::c_types::ThirtyTwoBytes,
4109 /// The element at position 1
4110 pub b: crate::c_types::ThirtyTwoBytes,
4112 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4113 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4120 impl C2Tuple_PaymentHashPaymentSecretZ {
4121 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4125 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4126 fn clone(&self) -> Self {
4134 /// Creates a new tuple which has the same data as `orig`
4135 /// but with all dynamically-allocated buffers duplicated in new buffers.
4136 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { orig.clone() }
4137 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4139 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4140 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4144 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4145 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4147 /// The contents of CResult_PaymentSecretAPIErrorZ
4148 pub union CResult_PaymentSecretAPIErrorZPtr {
4149 /// A pointer to the contents in the success state.
4150 /// Reading from this pointer when `result_ok` is not set is undefined.
4151 pub result: *mut crate::c_types::ThirtyTwoBytes,
4152 /// A pointer to the contents in the error state.
4153 /// Reading from this pointer when `result_ok` is set is undefined.
4154 pub err: *mut crate::lightning::util::errors::APIError,
4157 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4158 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4160 pub struct CResult_PaymentSecretAPIErrorZ {
4161 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4162 /// `err` or `result` depending on the state of `result_ok`.
4163 pub contents: CResult_PaymentSecretAPIErrorZPtr,
4164 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4165 pub result_ok: bool,
4168 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4169 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4170 CResult_PaymentSecretAPIErrorZ {
4171 contents: CResult_PaymentSecretAPIErrorZPtr {
4172 result: Box::into_raw(Box::new(o)),
4178 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4179 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4180 CResult_PaymentSecretAPIErrorZ {
4181 contents: CResult_PaymentSecretAPIErrorZPtr {
4182 err: Box::into_raw(Box::new(e)),
4188 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4189 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4190 impl Drop for CResult_PaymentSecretAPIErrorZ {
4191 fn drop(&mut self) {
4193 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4194 let _ = unsafe { Box::from_raw(self.contents.result) };
4197 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4198 let _ = unsafe { Box::from_raw(self.contents.err) };
4203 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4204 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4205 let contents = if o.result_ok {
4206 let result = unsafe { o.contents.result };
4207 unsafe { o.contents.result = std::ptr::null_mut() };
4208 CResult_PaymentSecretAPIErrorZPtr { result }
4210 let err = unsafe { o.contents.err };
4211 unsafe { o.contents.err = std::ptr::null_mut(); }
4212 CResult_PaymentSecretAPIErrorZPtr { err }
4216 result_ok: o.result_ok,
4220 impl Clone for CResult_PaymentSecretAPIErrorZ {
4221 fn clone(&self) -> Self {
4223 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4224 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4227 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4228 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4234 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4235 /// but with all dynamically-allocated buffers duplicated in new buffers.
4236 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { orig.clone() }
4238 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4239 /// This corresponds to std::vector in C++
4240 pub struct CVec_ChannelMonitorZ {
4241 /// The elements in the array.
4242 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4243 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4244 /// The number of elements pointed to by `data`.
4247 impl CVec_ChannelMonitorZ {
4248 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4249 if self.datalen == 0 { return Vec::new(); }
4250 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4251 self.data = std::ptr::null_mut();
4255 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4256 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4259 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4260 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4261 let datalen = v.len();
4262 let data = Box::into_raw(v.into_boxed_slice());
4263 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4267 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4268 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4269 impl Drop for CVec_ChannelMonitorZ {
4270 fn drop(&mut self) {
4271 if self.datalen == 0 { return; }
4272 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4276 /// A tuple of 2 elements. See the individual fields for the types contained.
4277 pub struct C2Tuple_BlockHashChannelManagerZ {
4278 /// The element at position 0
4279 pub a: crate::c_types::ThirtyTwoBytes,
4280 /// The element at position 1
4281 pub b: crate::lightning::ln::channelmanager::ChannelManager,
4283 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4284 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4291 impl C2Tuple_BlockHashChannelManagerZ {
4292 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4296 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4298 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4299 C2Tuple_BlockHashChannelManagerZ { a, b, }
4303 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4304 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4306 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4307 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4308 /// A pointer to the contents in the success state.
4309 /// Reading from this pointer when `result_ok` is not set is undefined.
4310 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4311 /// A pointer to the contents in the error state.
4312 /// Reading from this pointer when `result_ok` is set is undefined.
4313 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4316 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4317 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4319 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4320 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4321 /// `err` or `result` depending on the state of `result_ok`.
4322 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4323 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4324 pub result_ok: bool,
4327 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4328 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4329 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4330 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4331 result: Box::into_raw(Box::new(o)),
4337 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4338 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4339 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4340 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4341 err: Box::into_raw(Box::new(e)),
4347 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4348 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4349 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4350 fn drop(&mut self) {
4352 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4353 let _ = unsafe { Box::from_raw(self.contents.result) };
4356 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4357 let _ = unsafe { Box::from_raw(self.contents.err) };
4362 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4363 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4364 let contents = if o.result_ok {
4365 let result = unsafe { o.contents.result };
4366 unsafe { o.contents.result = std::ptr::null_mut() };
4367 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4369 let err = unsafe { o.contents.err };
4370 unsafe { o.contents.err = std::ptr::null_mut(); }
4371 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4375 result_ok: o.result_ok,
4380 /// The contents of CResult_ChannelConfigDecodeErrorZ
4381 pub union CResult_ChannelConfigDecodeErrorZPtr {
4382 /// A pointer to the contents in the success state.
4383 /// Reading from this pointer when `result_ok` is not set is undefined.
4384 pub result: *mut crate::lightning::util::config::ChannelConfig,
4385 /// A pointer to the contents in the error state.
4386 /// Reading from this pointer when `result_ok` is set is undefined.
4387 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4390 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4391 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4393 pub struct CResult_ChannelConfigDecodeErrorZ {
4394 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4395 /// `err` or `result` depending on the state of `result_ok`.
4396 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4397 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4398 pub result_ok: bool,
4401 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4402 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4403 CResult_ChannelConfigDecodeErrorZ {
4404 contents: CResult_ChannelConfigDecodeErrorZPtr {
4405 result: Box::into_raw(Box::new(o)),
4411 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4412 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4413 CResult_ChannelConfigDecodeErrorZ {
4414 contents: CResult_ChannelConfigDecodeErrorZPtr {
4415 err: Box::into_raw(Box::new(e)),
4421 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4422 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4423 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4424 fn drop(&mut self) {
4426 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4427 let _ = unsafe { Box::from_raw(self.contents.result) };
4430 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4431 let _ = unsafe { Box::from_raw(self.contents.err) };
4436 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4437 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4438 let contents = if o.result_ok {
4439 let result = unsafe { o.contents.result };
4440 unsafe { o.contents.result = std::ptr::null_mut() };
4441 CResult_ChannelConfigDecodeErrorZPtr { result }
4443 let err = unsafe { o.contents.err };
4444 unsafe { o.contents.err = std::ptr::null_mut(); }
4445 CResult_ChannelConfigDecodeErrorZPtr { err }
4449 result_ok: o.result_ok,
4453 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4454 fn clone(&self) -> Self {
4456 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4457 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4460 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4461 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4467 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4468 /// but with all dynamically-allocated buffers duplicated in new buffers.
4469 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
4471 /// The contents of CResult_OutPointDecodeErrorZ
4472 pub union CResult_OutPointDecodeErrorZPtr {
4473 /// A pointer to the contents in the success state.
4474 /// Reading from this pointer when `result_ok` is not set is undefined.
4475 pub result: *mut crate::lightning::chain::transaction::OutPoint,
4476 /// A pointer to the contents in the error state.
4477 /// Reading from this pointer when `result_ok` is set is undefined.
4478 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4481 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4482 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4483 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4484 pub struct CResult_OutPointDecodeErrorZ {
4485 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4486 /// `err` or `result` depending on the state of `result_ok`.
4487 pub contents: CResult_OutPointDecodeErrorZPtr,
4488 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4489 pub result_ok: bool,
4492 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4493 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4494 CResult_OutPointDecodeErrorZ {
4495 contents: CResult_OutPointDecodeErrorZPtr {
4496 result: Box::into_raw(Box::new(o)),
4502 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4503 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4504 CResult_OutPointDecodeErrorZ {
4505 contents: CResult_OutPointDecodeErrorZPtr {
4506 err: Box::into_raw(Box::new(e)),
4512 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
4513 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
4514 impl Drop for CResult_OutPointDecodeErrorZ {
4515 fn drop(&mut self) {
4517 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4518 let _ = unsafe { Box::from_raw(self.contents.result) };
4521 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4522 let _ = unsafe { Box::from_raw(self.contents.err) };
4527 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
4528 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4529 let contents = if o.result_ok {
4530 let result = unsafe { o.contents.result };
4531 unsafe { o.contents.result = std::ptr::null_mut() };
4532 CResult_OutPointDecodeErrorZPtr { result }
4534 let err = unsafe { o.contents.err };
4535 unsafe { o.contents.err = std::ptr::null_mut(); }
4536 CResult_OutPointDecodeErrorZPtr { err }
4540 result_ok: o.result_ok,
4544 impl Clone for CResult_OutPointDecodeErrorZ {
4545 fn clone(&self) -> Self {
4547 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
4548 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
4551 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
4552 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4558 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
4559 /// but with all dynamically-allocated buffers duplicated in new buffers.
4560 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
4562 /// The contents of CResult_SiPrefixNoneZ
4563 pub union CResult_SiPrefixNoneZPtr {
4564 /// A pointer to the contents in the success state.
4565 /// Reading from this pointer when `result_ok` is not set is undefined.
4566 pub result: *mut crate::lightning_invoice::SiPrefix,
4567 /// Note that this value is always NULL, as there are no contents in the Err variant
4568 pub err: *mut std::ffi::c_void,
4571 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4572 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4574 pub struct CResult_SiPrefixNoneZ {
4575 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
4576 /// `err` or `result` depending on the state of `result_ok`.
4577 pub contents: CResult_SiPrefixNoneZPtr,
4578 /// Whether this CResult_SiPrefixNoneZ represents a success state.
4579 pub result_ok: bool,
4582 /// Creates a new CResult_SiPrefixNoneZ in the success state.
4583 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
4584 CResult_SiPrefixNoneZ {
4585 contents: CResult_SiPrefixNoneZPtr {
4586 result: Box::into_raw(Box::new(o)),
4592 /// Creates a new CResult_SiPrefixNoneZ in the error state.
4593 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
4594 CResult_SiPrefixNoneZ {
4595 contents: CResult_SiPrefixNoneZPtr {
4596 err: std::ptr::null_mut(),
4602 /// Frees any resources used by the CResult_SiPrefixNoneZ.
4603 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
4604 impl Drop for CResult_SiPrefixNoneZ {
4605 fn drop(&mut self) {
4607 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4608 let _ = unsafe { Box::from_raw(self.contents.result) };
4614 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
4615 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
4616 let contents = if o.result_ok {
4617 let result = unsafe { o.contents.result };
4618 unsafe { o.contents.result = std::ptr::null_mut() };
4619 CResult_SiPrefixNoneZPtr { result }
4621 let _ = unsafe { Box::from_raw(o.contents.err) };
4622 o.contents.err = std::ptr::null_mut();
4623 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
4627 result_ok: o.result_ok,
4631 impl Clone for CResult_SiPrefixNoneZ {
4632 fn clone(&self) -> Self {
4634 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
4635 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
4638 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
4639 err: std::ptr::null_mut()
4645 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
4646 /// but with all dynamically-allocated buffers duplicated in new buffers.
4647 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
4649 /// The contents of CResult_InvoiceNoneZ
4650 pub union CResult_InvoiceNoneZPtr {
4651 /// A pointer to the contents in the success state.
4652 /// Reading from this pointer when `result_ok` is not set is undefined.
4653 pub result: *mut crate::lightning_invoice::Invoice,
4654 /// Note that this value is always NULL, as there are no contents in the Err variant
4655 pub err: *mut std::ffi::c_void,
4658 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
4659 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
4660 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4661 pub struct CResult_InvoiceNoneZ {
4662 /// The contents of this CResult_InvoiceNoneZ, accessible via either
4663 /// `err` or `result` depending on the state of `result_ok`.
4664 pub contents: CResult_InvoiceNoneZPtr,
4665 /// Whether this CResult_InvoiceNoneZ represents a success state.
4666 pub result_ok: bool,
4669 /// Creates a new CResult_InvoiceNoneZ in the success state.
4670 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
4671 CResult_InvoiceNoneZ {
4672 contents: CResult_InvoiceNoneZPtr {
4673 result: Box::into_raw(Box::new(o)),
4679 /// Creates a new CResult_InvoiceNoneZ in the error state.
4680 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
4681 CResult_InvoiceNoneZ {
4682 contents: CResult_InvoiceNoneZPtr {
4683 err: std::ptr::null_mut(),
4689 /// Frees any resources used by the CResult_InvoiceNoneZ.
4690 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
4691 impl Drop for CResult_InvoiceNoneZ {
4692 fn drop(&mut self) {
4694 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4695 let _ = unsafe { Box::from_raw(self.contents.result) };
4701 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
4702 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
4703 let contents = if o.result_ok {
4704 let result = unsafe { o.contents.result };
4705 unsafe { o.contents.result = std::ptr::null_mut() };
4706 CResult_InvoiceNoneZPtr { result }
4708 let _ = unsafe { Box::from_raw(o.contents.err) };
4709 o.contents.err = std::ptr::null_mut();
4710 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
4714 result_ok: o.result_ok,
4718 impl Clone for CResult_InvoiceNoneZ {
4719 fn clone(&self) -> Self {
4721 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
4722 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
4725 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
4726 err: std::ptr::null_mut()
4732 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
4733 /// but with all dynamically-allocated buffers duplicated in new buffers.
4734 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
4736 /// The contents of CResult_SignedRawInvoiceNoneZ
4737 pub union CResult_SignedRawInvoiceNoneZPtr {
4738 /// A pointer to the contents in the success state.
4739 /// Reading from this pointer when `result_ok` is not set is undefined.
4740 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
4741 /// Note that this value is always NULL, as there are no contents in the Err variant
4742 pub err: *mut std::ffi::c_void,
4745 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4746 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4748 pub struct CResult_SignedRawInvoiceNoneZ {
4749 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4750 /// `err` or `result` depending on the state of `result_ok`.
4751 pub contents: CResult_SignedRawInvoiceNoneZPtr,
4752 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4753 pub result_ok: bool,
4756 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
4757 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
4758 CResult_SignedRawInvoiceNoneZ {
4759 contents: CResult_SignedRawInvoiceNoneZPtr {
4760 result: Box::into_raw(Box::new(o)),
4766 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
4767 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
4768 CResult_SignedRawInvoiceNoneZ {
4769 contents: CResult_SignedRawInvoiceNoneZPtr {
4770 err: std::ptr::null_mut(),
4776 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
4777 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
4778 impl Drop for CResult_SignedRawInvoiceNoneZ {
4779 fn drop(&mut self) {
4781 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4782 let _ = unsafe { Box::from_raw(self.contents.result) };
4788 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
4789 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
4790 let contents = if o.result_ok {
4791 let result = unsafe { o.contents.result };
4792 unsafe { o.contents.result = std::ptr::null_mut() };
4793 CResult_SignedRawInvoiceNoneZPtr { result }
4795 let _ = unsafe { Box::from_raw(o.contents.err) };
4796 o.contents.err = std::ptr::null_mut();
4797 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
4801 result_ok: o.result_ok,
4805 impl Clone for CResult_SignedRawInvoiceNoneZ {
4806 fn clone(&self) -> Self {
4808 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
4809 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
4812 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
4813 err: std::ptr::null_mut()
4819 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
4820 /// but with all dynamically-allocated buffers duplicated in new buffers.
4821 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
4823 /// A tuple of 3 elements. See the individual fields for the types contained.
4824 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4825 /// The element at position 0
4826 pub a: crate::lightning_invoice::RawInvoice,
4827 /// The element at position 1
4828 pub b: crate::c_types::ThirtyTwoBytes,
4829 /// The element at position 2
4830 pub c: crate::lightning_invoice::InvoiceSignature,
4832 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4833 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
4841 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4842 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
4843 (self.a, self.b, self.c)
4846 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4847 fn clone(&self) -> Self {
4856 /// Creates a new tuple which has the same data as `orig`
4857 /// but with all dynamically-allocated buffers duplicated in new buffers.
4858 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { orig.clone() }
4859 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
4861 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 {
4862 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
4866 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
4867 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
4869 /// The contents of CResult_PayeePubKeyErrorZ
4870 pub union CResult_PayeePubKeyErrorZPtr {
4871 /// A pointer to the contents in the success state.
4872 /// Reading from this pointer when `result_ok` is not set is undefined.
4873 pub result: *mut crate::lightning_invoice::PayeePubKey,
4874 /// A pointer to the contents in the error state.
4875 /// Reading from this pointer when `result_ok` is set is undefined.
4876 pub err: *mut crate::c_types::Secp256k1Error,
4879 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
4880 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
4881 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4882 pub struct CResult_PayeePubKeyErrorZ {
4883 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
4884 /// `err` or `result` depending on the state of `result_ok`.
4885 pub contents: CResult_PayeePubKeyErrorZPtr,
4886 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
4887 pub result_ok: bool,
4890 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
4891 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
4892 CResult_PayeePubKeyErrorZ {
4893 contents: CResult_PayeePubKeyErrorZPtr {
4894 result: Box::into_raw(Box::new(o)),
4900 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
4901 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
4902 CResult_PayeePubKeyErrorZ {
4903 contents: CResult_PayeePubKeyErrorZPtr {
4904 err: Box::into_raw(Box::new(e)),
4910 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
4911 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
4912 impl Drop for CResult_PayeePubKeyErrorZ {
4913 fn drop(&mut self) {
4915 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4916 let _ = unsafe { Box::from_raw(self.contents.result) };
4919 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4920 let _ = unsafe { Box::from_raw(self.contents.err) };
4925 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
4926 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
4927 let contents = if o.result_ok {
4928 let result = unsafe { o.contents.result };
4929 unsafe { o.contents.result = std::ptr::null_mut() };
4930 CResult_PayeePubKeyErrorZPtr { result }
4932 let err = unsafe { o.contents.err };
4933 unsafe { o.contents.err = std::ptr::null_mut(); }
4934 CResult_PayeePubKeyErrorZPtr { err }
4938 result_ok: o.result_ok,
4942 impl Clone for CResult_PayeePubKeyErrorZ {
4943 fn clone(&self) -> Self {
4945 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
4946 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
4949 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
4950 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
4956 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
4957 /// but with all dynamically-allocated buffers duplicated in new buffers.
4958 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { orig.clone() }
4960 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
4961 /// This corresponds to std::vector in C++
4962 pub struct CVec_PrivateRouteZ {
4963 /// The elements in the array.
4964 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4965 pub data: *mut crate::lightning_invoice::PrivateRoute,
4966 /// The number of elements pointed to by `data`.
4969 impl CVec_PrivateRouteZ {
4970 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
4971 if self.datalen == 0 { return Vec::new(); }
4972 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4973 self.data = std::ptr::null_mut();
4977 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
4978 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4981 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
4982 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
4983 let datalen = v.len();
4984 let data = Box::into_raw(v.into_boxed_slice());
4985 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4989 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4990 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
4991 impl Drop for CVec_PrivateRouteZ {
4992 fn drop(&mut self) {
4993 if self.datalen == 0 { return; }
4994 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4997 impl Clone for CVec_PrivateRouteZ {
4998 fn clone(&self) -> Self {
4999 let mut res = Vec::new();
5000 if self.datalen == 0 { return Self::from(res); }
5001 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5006 /// The contents of CResult_PositiveTimestampCreationErrorZ
5007 pub union CResult_PositiveTimestampCreationErrorZPtr {
5008 /// A pointer to the contents in the success state.
5009 /// Reading from this pointer when `result_ok` is not set is undefined.
5010 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5011 /// A pointer to the contents in the error state.
5012 /// Reading from this pointer when `result_ok` is set is undefined.
5013 pub err: *mut crate::lightning_invoice::CreationError,
5016 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5017 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5018 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5019 pub struct CResult_PositiveTimestampCreationErrorZ {
5020 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5021 /// `err` or `result` depending on the state of `result_ok`.
5022 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5023 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5024 pub result_ok: bool,
5027 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5028 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5029 CResult_PositiveTimestampCreationErrorZ {
5030 contents: CResult_PositiveTimestampCreationErrorZPtr {
5031 result: Box::into_raw(Box::new(o)),
5037 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5038 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5039 CResult_PositiveTimestampCreationErrorZ {
5040 contents: CResult_PositiveTimestampCreationErrorZPtr {
5041 err: Box::into_raw(Box::new(e)),
5047 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5048 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5049 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5050 fn drop(&mut self) {
5052 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5053 let _ = unsafe { Box::from_raw(self.contents.result) };
5056 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5057 let _ = unsafe { Box::from_raw(self.contents.err) };
5062 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5063 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5064 let contents = if o.result_ok {
5065 let result = unsafe { o.contents.result };
5066 unsafe { o.contents.result = std::ptr::null_mut() };
5067 CResult_PositiveTimestampCreationErrorZPtr { result }
5069 let err = unsafe { o.contents.err };
5070 unsafe { o.contents.err = std::ptr::null_mut(); }
5071 CResult_PositiveTimestampCreationErrorZPtr { err }
5075 result_ok: o.result_ok,
5079 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5080 fn clone(&self) -> Self {
5082 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5083 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5086 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5087 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5093 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5094 /// but with all dynamically-allocated buffers duplicated in new buffers.
5095 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
5097 /// The contents of CResult_NoneSemanticErrorZ
5098 pub union CResult_NoneSemanticErrorZPtr {
5099 /// Note that this value is always NULL, as there are no contents in the OK variant
5100 pub result: *mut std::ffi::c_void,
5101 /// A pointer to the contents in the error state.
5102 /// Reading from this pointer when `result_ok` is set is undefined.
5103 pub err: *mut crate::lightning_invoice::SemanticError,
5106 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5107 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5109 pub struct CResult_NoneSemanticErrorZ {
5110 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5111 /// `err` or `result` depending on the state of `result_ok`.
5112 pub contents: CResult_NoneSemanticErrorZPtr,
5113 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5114 pub result_ok: bool,
5117 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5118 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5119 CResult_NoneSemanticErrorZ {
5120 contents: CResult_NoneSemanticErrorZPtr {
5121 result: std::ptr::null_mut(),
5127 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5128 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5129 CResult_NoneSemanticErrorZ {
5130 contents: CResult_NoneSemanticErrorZPtr {
5131 err: Box::into_raw(Box::new(e)),
5137 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5138 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5139 impl Drop for CResult_NoneSemanticErrorZ {
5140 fn drop(&mut self) {
5143 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5144 let _ = unsafe { Box::from_raw(self.contents.err) };
5149 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5150 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5151 let contents = if o.result_ok {
5152 let _ = unsafe { Box::from_raw(o.contents.result) };
5153 o.contents.result = std::ptr::null_mut();
5154 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5156 let err = unsafe { o.contents.err };
5157 unsafe { o.contents.err = std::ptr::null_mut(); }
5158 CResult_NoneSemanticErrorZPtr { err }
5162 result_ok: o.result_ok,
5166 impl Clone for CResult_NoneSemanticErrorZ {
5167 fn clone(&self) -> Self {
5169 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5170 result: std::ptr::null_mut()
5173 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5174 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5180 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5181 /// but with all dynamically-allocated buffers duplicated in new buffers.
5182 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
5184 /// The contents of CResult_InvoiceSemanticErrorZ
5185 pub union CResult_InvoiceSemanticErrorZPtr {
5186 /// A pointer to the contents in the success state.
5187 /// Reading from this pointer when `result_ok` is not set is undefined.
5188 pub result: *mut crate::lightning_invoice::Invoice,
5189 /// A pointer to the contents in the error state.
5190 /// Reading from this pointer when `result_ok` is set is undefined.
5191 pub err: *mut crate::lightning_invoice::SemanticError,
5194 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5195 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5197 pub struct CResult_InvoiceSemanticErrorZ {
5198 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5199 /// `err` or `result` depending on the state of `result_ok`.
5200 pub contents: CResult_InvoiceSemanticErrorZPtr,
5201 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5202 pub result_ok: bool,
5205 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5206 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5207 CResult_InvoiceSemanticErrorZ {
5208 contents: CResult_InvoiceSemanticErrorZPtr {
5209 result: Box::into_raw(Box::new(o)),
5215 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5216 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5217 CResult_InvoiceSemanticErrorZ {
5218 contents: CResult_InvoiceSemanticErrorZPtr {
5219 err: Box::into_raw(Box::new(e)),
5225 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
5226 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5227 impl Drop for CResult_InvoiceSemanticErrorZ {
5228 fn drop(&mut self) {
5230 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5231 let _ = unsafe { Box::from_raw(self.contents.result) };
5234 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5235 let _ = unsafe { Box::from_raw(self.contents.err) };
5240 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5241 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
5242 let contents = if o.result_ok {
5243 let result = unsafe { o.contents.result };
5244 unsafe { o.contents.result = std::ptr::null_mut() };
5245 CResult_InvoiceSemanticErrorZPtr { result }
5247 let err = unsafe { o.contents.err };
5248 unsafe { o.contents.err = std::ptr::null_mut(); }
5249 CResult_InvoiceSemanticErrorZPtr { err }
5253 result_ok: o.result_ok,
5257 impl Clone for CResult_InvoiceSemanticErrorZ {
5258 fn clone(&self) -> Self {
5260 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5261 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5264 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
5265 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5271 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
5272 /// but with all dynamically-allocated buffers duplicated in new buffers.
5273 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
5275 /// The contents of CResult_DescriptionCreationErrorZ
5276 pub union CResult_DescriptionCreationErrorZPtr {
5277 /// A pointer to the contents in the success state.
5278 /// Reading from this pointer when `result_ok` is not set is undefined.
5279 pub result: *mut crate::lightning_invoice::Description,
5280 /// A pointer to the contents in the error state.
5281 /// Reading from this pointer when `result_ok` is set is undefined.
5282 pub err: *mut crate::lightning_invoice::CreationError,
5285 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5286 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5288 pub struct CResult_DescriptionCreationErrorZ {
5289 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5290 /// `err` or `result` depending on the state of `result_ok`.
5291 pub contents: CResult_DescriptionCreationErrorZPtr,
5292 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5293 pub result_ok: bool,
5296 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5297 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5298 CResult_DescriptionCreationErrorZ {
5299 contents: CResult_DescriptionCreationErrorZPtr {
5300 result: Box::into_raw(Box::new(o)),
5306 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5307 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5308 CResult_DescriptionCreationErrorZ {
5309 contents: CResult_DescriptionCreationErrorZPtr {
5310 err: Box::into_raw(Box::new(e)),
5316 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
5317 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5318 impl Drop for CResult_DescriptionCreationErrorZ {
5319 fn drop(&mut self) {
5321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5322 let _ = unsafe { Box::from_raw(self.contents.result) };
5325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5326 let _ = unsafe { Box::from_raw(self.contents.err) };
5331 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5332 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
5333 let contents = if o.result_ok {
5334 let result = unsafe { o.contents.result };
5335 unsafe { o.contents.result = std::ptr::null_mut() };
5336 CResult_DescriptionCreationErrorZPtr { result }
5338 let err = unsafe { o.contents.err };
5339 unsafe { o.contents.err = std::ptr::null_mut(); }
5340 CResult_DescriptionCreationErrorZPtr { err }
5344 result_ok: o.result_ok,
5348 impl Clone for CResult_DescriptionCreationErrorZ {
5349 fn clone(&self) -> Self {
5351 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5352 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5355 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5356 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5362 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5363 /// but with all dynamically-allocated buffers duplicated in new buffers.
5364 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
5366 /// The contents of CResult_ExpiryTimeCreationErrorZ
5367 pub union CResult_ExpiryTimeCreationErrorZPtr {
5368 /// A pointer to the contents in the success state.
5369 /// Reading from this pointer when `result_ok` is not set is undefined.
5370 pub result: *mut crate::lightning_invoice::ExpiryTime,
5371 /// A pointer to the contents in the error state.
5372 /// Reading from this pointer when `result_ok` is set is undefined.
5373 pub err: *mut crate::lightning_invoice::CreationError,
5376 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5377 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5379 pub struct CResult_ExpiryTimeCreationErrorZ {
5380 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5381 /// `err` or `result` depending on the state of `result_ok`.
5382 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5383 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5384 pub result_ok: bool,
5387 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5388 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5389 CResult_ExpiryTimeCreationErrorZ {
5390 contents: CResult_ExpiryTimeCreationErrorZPtr {
5391 result: Box::into_raw(Box::new(o)),
5397 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5398 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5399 CResult_ExpiryTimeCreationErrorZ {
5400 contents: CResult_ExpiryTimeCreationErrorZPtr {
5401 err: Box::into_raw(Box::new(e)),
5407 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
5408 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
5409 impl Drop for CResult_ExpiryTimeCreationErrorZ {
5410 fn drop(&mut self) {
5412 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5413 let _ = unsafe { Box::from_raw(self.contents.result) };
5416 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5417 let _ = unsafe { Box::from_raw(self.contents.err) };
5422 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
5423 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
5424 let contents = if o.result_ok {
5425 let result = unsafe { o.contents.result };
5426 unsafe { o.contents.result = std::ptr::null_mut() };
5427 CResult_ExpiryTimeCreationErrorZPtr { result }
5429 let err = unsafe { o.contents.err };
5430 unsafe { o.contents.err = std::ptr::null_mut(); }
5431 CResult_ExpiryTimeCreationErrorZPtr { err }
5435 result_ok: o.result_ok,
5439 impl Clone for CResult_ExpiryTimeCreationErrorZ {
5440 fn clone(&self) -> Self {
5442 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
5443 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
5446 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
5447 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5453 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
5454 /// but with all dynamically-allocated buffers duplicated in new buffers.
5455 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
5457 /// The contents of CResult_PrivateRouteCreationErrorZ
5458 pub union CResult_PrivateRouteCreationErrorZPtr {
5459 /// A pointer to the contents in the success state.
5460 /// Reading from this pointer when `result_ok` is not set is undefined.
5461 pub result: *mut crate::lightning_invoice::PrivateRoute,
5462 /// A pointer to the contents in the error state.
5463 /// Reading from this pointer when `result_ok` is set is undefined.
5464 pub err: *mut crate::lightning_invoice::CreationError,
5467 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5468 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5470 pub struct CResult_PrivateRouteCreationErrorZ {
5471 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5472 /// `err` or `result` depending on the state of `result_ok`.
5473 pub contents: CResult_PrivateRouteCreationErrorZPtr,
5474 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5475 pub result_ok: bool,
5478 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
5479 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
5480 CResult_PrivateRouteCreationErrorZ {
5481 contents: CResult_PrivateRouteCreationErrorZPtr {
5482 result: Box::into_raw(Box::new(o)),
5488 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
5489 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
5490 CResult_PrivateRouteCreationErrorZ {
5491 contents: CResult_PrivateRouteCreationErrorZPtr {
5492 err: Box::into_raw(Box::new(e)),
5498 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
5499 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
5500 impl Drop for CResult_PrivateRouteCreationErrorZ {
5501 fn drop(&mut self) {
5503 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5504 let _ = unsafe { Box::from_raw(self.contents.result) };
5507 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5508 let _ = unsafe { Box::from_raw(self.contents.err) };
5513 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
5514 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
5515 let contents = if o.result_ok {
5516 let result = unsafe { o.contents.result };
5517 unsafe { o.contents.result = std::ptr::null_mut() };
5518 CResult_PrivateRouteCreationErrorZPtr { result }
5520 let err = unsafe { o.contents.err };
5521 unsafe { o.contents.err = std::ptr::null_mut(); }
5522 CResult_PrivateRouteCreationErrorZPtr { err }
5526 result_ok: o.result_ok,
5530 impl Clone for CResult_PrivateRouteCreationErrorZ {
5531 fn clone(&self) -> Self {
5533 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
5534 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
5537 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
5538 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5544 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
5545 /// but with all dynamically-allocated buffers duplicated in new buffers.
5546 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { orig.clone() }
5548 /// The contents of CResult_StringErrorZ
5549 pub union CResult_StringErrorZPtr {
5550 /// A pointer to the contents in the success state.
5551 /// Reading from this pointer when `result_ok` is not set is undefined.
5552 pub result: *mut crate::c_types::Str,
5553 /// A pointer to the contents in the error state.
5554 /// Reading from this pointer when `result_ok` is set is undefined.
5555 pub err: *mut crate::c_types::Secp256k1Error,
5558 /// A CResult_StringErrorZ represents the result of a fallible operation,
5559 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5561 pub struct CResult_StringErrorZ {
5562 /// The contents of this CResult_StringErrorZ, accessible via either
5563 /// `err` or `result` depending on the state of `result_ok`.
5564 pub contents: CResult_StringErrorZPtr,
5565 /// Whether this CResult_StringErrorZ represents a success state.
5566 pub result_ok: bool,
5569 /// Creates a new CResult_StringErrorZ in the success state.
5570 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
5571 CResult_StringErrorZ {
5572 contents: CResult_StringErrorZPtr {
5573 result: Box::into_raw(Box::new(o)),
5579 /// Creates a new CResult_StringErrorZ in the error state.
5580 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
5581 CResult_StringErrorZ {
5582 contents: CResult_StringErrorZPtr {
5583 err: Box::into_raw(Box::new(e)),
5589 /// Frees any resources used by the CResult_StringErrorZ.
5590 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
5591 impl Drop for CResult_StringErrorZ {
5592 fn drop(&mut self) {
5594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5595 let _ = unsafe { Box::from_raw(self.contents.result) };
5598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5599 let _ = unsafe { Box::from_raw(self.contents.err) };
5604 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
5605 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
5606 let contents = if o.result_ok {
5607 let result = unsafe { o.contents.result };
5608 unsafe { o.contents.result = std::ptr::null_mut() };
5609 CResult_StringErrorZPtr { result }
5611 let err = unsafe { o.contents.err };
5612 unsafe { o.contents.err = std::ptr::null_mut(); }
5613 CResult_StringErrorZPtr { err }
5617 result_ok: o.result_ok,
5622 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5623 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5624 /// A pointer to the contents in the success state.
5625 /// Reading from this pointer when `result_ok` is not set is undefined.
5626 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
5627 /// A pointer to the contents in the error state.
5628 /// Reading from this pointer when `result_ok` is set is undefined.
5629 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5632 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5633 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5635 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
5636 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5637 /// `err` or `result` depending on the state of `result_ok`.
5638 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
5639 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5640 pub result_ok: bool,
5643 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
5644 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5645 CResult_ChannelMonitorUpdateDecodeErrorZ {
5646 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5647 result: Box::into_raw(Box::new(o)),
5653 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
5654 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5655 CResult_ChannelMonitorUpdateDecodeErrorZ {
5656 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5657 err: Box::into_raw(Box::new(e)),
5663 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
5664 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
5665 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
5666 fn drop(&mut self) {
5668 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5669 let _ = unsafe { Box::from_raw(self.contents.result) };
5672 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5673 let _ = unsafe { Box::from_raw(self.contents.err) };
5678 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
5679 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5680 let contents = if o.result_ok {
5681 let result = unsafe { o.contents.result };
5682 unsafe { o.contents.result = std::ptr::null_mut() };
5683 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
5685 let err = unsafe { o.contents.err };
5686 unsafe { o.contents.err = std::ptr::null_mut(); }
5687 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
5691 result_ok: o.result_ok,
5695 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
5696 fn clone(&self) -> Self {
5698 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5699 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
5702 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5703 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5709 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
5710 /// but with all dynamically-allocated buffers duplicated in new buffers.
5711 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
5713 /// The contents of CResult_HTLCUpdateDecodeErrorZ
5714 pub union CResult_HTLCUpdateDecodeErrorZPtr {
5715 /// A pointer to the contents in the success state.
5716 /// Reading from this pointer when `result_ok` is not set is undefined.
5717 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
5718 /// A pointer to the contents in the error state.
5719 /// Reading from this pointer when `result_ok` is set is undefined.
5720 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5723 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5724 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5726 pub struct CResult_HTLCUpdateDecodeErrorZ {
5727 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5728 /// `err` or `result` depending on the state of `result_ok`.
5729 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
5730 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5731 pub result_ok: bool,
5734 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
5735 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
5736 CResult_HTLCUpdateDecodeErrorZ {
5737 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5738 result: Box::into_raw(Box::new(o)),
5744 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
5745 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
5746 CResult_HTLCUpdateDecodeErrorZ {
5747 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5748 err: Box::into_raw(Box::new(e)),
5754 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
5755 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
5756 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
5757 fn drop(&mut self) {
5759 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5760 let _ = unsafe { Box::from_raw(self.contents.result) };
5763 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5764 let _ = unsafe { Box::from_raw(self.contents.err) };
5769 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
5770 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5771 let contents = if o.result_ok {
5772 let result = unsafe { o.contents.result };
5773 unsafe { o.contents.result = std::ptr::null_mut() };
5774 CResult_HTLCUpdateDecodeErrorZPtr { result }
5776 let err = unsafe { o.contents.err };
5777 unsafe { o.contents.err = std::ptr::null_mut(); }
5778 CResult_HTLCUpdateDecodeErrorZPtr { err }
5782 result_ok: o.result_ok,
5786 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
5787 fn clone(&self) -> Self {
5789 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5790 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
5793 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5794 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5800 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
5801 /// but with all dynamically-allocated buffers duplicated in new buffers.
5802 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
5804 /// The contents of CResult_NoneMonitorUpdateErrorZ
5805 pub union CResult_NoneMonitorUpdateErrorZPtr {
5806 /// Note that this value is always NULL, as there are no contents in the OK variant
5807 pub result: *mut std::ffi::c_void,
5808 /// A pointer to the contents in the error state.
5809 /// Reading from this pointer when `result_ok` is set is undefined.
5810 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
5813 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5814 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5816 pub struct CResult_NoneMonitorUpdateErrorZ {
5817 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5818 /// `err` or `result` depending on the state of `result_ok`.
5819 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
5820 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5821 pub result_ok: bool,
5824 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
5825 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
5826 CResult_NoneMonitorUpdateErrorZ {
5827 contents: CResult_NoneMonitorUpdateErrorZPtr {
5828 result: std::ptr::null_mut(),
5834 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
5835 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
5836 CResult_NoneMonitorUpdateErrorZ {
5837 contents: CResult_NoneMonitorUpdateErrorZPtr {
5838 err: Box::into_raw(Box::new(e)),
5844 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
5845 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
5846 impl Drop for CResult_NoneMonitorUpdateErrorZ {
5847 fn drop(&mut self) {
5850 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5851 let _ = unsafe { Box::from_raw(self.contents.err) };
5856 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
5857 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
5858 let contents = if o.result_ok {
5859 let _ = unsafe { Box::from_raw(o.contents.result) };
5860 o.contents.result = std::ptr::null_mut();
5861 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
5863 let err = unsafe { o.contents.err };
5864 unsafe { o.contents.err = std::ptr::null_mut(); }
5865 CResult_NoneMonitorUpdateErrorZPtr { err }
5869 result_ok: o.result_ok,
5873 impl Clone for CResult_NoneMonitorUpdateErrorZ {
5874 fn clone(&self) -> Self {
5876 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
5877 result: std::ptr::null_mut()
5880 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
5881 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
5887 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
5888 /// but with all dynamically-allocated buffers duplicated in new buffers.
5889 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
5891 /// A tuple of 2 elements. See the individual fields for the types contained.
5892 pub struct C2Tuple_OutPointScriptZ {
5893 /// The element at position 0
5894 pub a: crate::lightning::chain::transaction::OutPoint,
5895 /// The element at position 1
5896 pub b: crate::c_types::derived::CVec_u8Z,
5898 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
5899 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
5906 impl C2Tuple_OutPointScriptZ {
5907 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
5911 impl Clone for C2Tuple_OutPointScriptZ {
5912 fn clone(&self) -> Self {
5920 /// Creates a new tuple which has the same data as `orig`
5921 /// but with all dynamically-allocated buffers duplicated in new buffers.
5922 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
5923 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
5925 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
5926 C2Tuple_OutPointScriptZ { a, b, }
5930 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
5931 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
5933 /// A tuple of 2 elements. See the individual fields for the types contained.
5934 pub struct C2Tuple_u32ScriptZ {
5935 /// The element at position 0
5937 /// The element at position 1
5938 pub b: crate::c_types::derived::CVec_u8Z,
5940 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
5941 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
5948 impl C2Tuple_u32ScriptZ {
5949 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
5953 impl Clone for C2Tuple_u32ScriptZ {
5954 fn clone(&self) -> Self {
5962 /// Creates a new tuple which has the same data as `orig`
5963 /// but with all dynamically-allocated buffers duplicated in new buffers.
5964 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
5965 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
5967 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
5968 C2Tuple_u32ScriptZ { a, b, }
5972 /// Frees any resources used by the C2Tuple_u32ScriptZ.
5973 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
5975 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
5976 /// This corresponds to std::vector in C++
5977 pub struct CVec_C2Tuple_u32ScriptZZ {
5978 /// The elements in the array.
5979 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5980 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
5981 /// The number of elements pointed to by `data`.
5984 impl CVec_C2Tuple_u32ScriptZZ {
5985 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
5986 if self.datalen == 0 { return Vec::new(); }
5987 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5988 self.data = std::ptr::null_mut();
5992 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
5993 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5996 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
5997 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
5998 let datalen = v.len();
5999 let data = Box::into_raw(v.into_boxed_slice());
6000 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6004 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6005 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6006 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6007 fn drop(&mut self) {
6008 if self.datalen == 0 { return; }
6009 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6012 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6013 fn clone(&self) -> Self {
6014 let mut res = Vec::new();
6015 if self.datalen == 0 { return Self::from(res); }
6016 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6021 /// A tuple of 2 elements. See the individual fields for the types contained.
6022 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6023 /// The element at position 0
6024 pub a: crate::c_types::ThirtyTwoBytes,
6025 /// The element at position 1
6026 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6028 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6029 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6036 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6037 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6041 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6042 fn clone(&self) -> Self {
6050 /// Creates a new tuple which has the same data as `orig`
6051 /// but with all dynamically-allocated buffers duplicated in new buffers.
6052 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { orig.clone() }
6053 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6055 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 {
6056 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6060 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6061 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6063 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6064 /// This corresponds to std::vector in C++
6065 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6066 /// The elements in the array.
6067 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6068 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6069 /// The number of elements pointed to by `data`.
6072 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6073 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6074 if self.datalen == 0 { return Vec::new(); }
6075 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6076 self.data = std::ptr::null_mut();
6080 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6081 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6084 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6085 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6086 let datalen = v.len();
6087 let data = Box::into_raw(v.into_boxed_slice());
6088 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6092 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6093 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6094 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6095 fn drop(&mut self) {
6096 if self.datalen == 0 { return; }
6097 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6100 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6101 fn clone(&self) -> Self {
6102 let mut res = Vec::new();
6103 if self.datalen == 0 { return Self::from(res); }
6104 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6109 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6110 /// This corresponds to std::vector in C++
6111 pub struct CVec_EventZ {
6112 /// The elements in the array.
6113 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6114 pub data: *mut crate::lightning::util::events::Event,
6115 /// The number of elements pointed to by `data`.
6119 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6120 if self.datalen == 0 { return Vec::new(); }
6121 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6122 self.data = std::ptr::null_mut();
6126 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6127 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6130 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6131 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6132 let datalen = v.len();
6133 let data = Box::into_raw(v.into_boxed_slice());
6134 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6138 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6139 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6140 impl Drop for CVec_EventZ {
6141 fn drop(&mut self) {
6142 if self.datalen == 0 { return; }
6143 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6146 impl Clone for CVec_EventZ {
6147 fn clone(&self) -> Self {
6148 let mut res = Vec::new();
6149 if self.datalen == 0 { return Self::from(res); }
6150 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6155 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6156 /// This corresponds to std::vector in C++
6157 pub struct CVec_TransactionZ {
6158 /// The elements in the array.
6159 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6160 pub data: *mut crate::c_types::Transaction,
6161 /// The number of elements pointed to by `data`.
6164 impl CVec_TransactionZ {
6165 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6166 if self.datalen == 0 { return Vec::new(); }
6167 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6168 self.data = std::ptr::null_mut();
6172 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6173 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6176 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6177 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6178 let datalen = v.len();
6179 let data = Box::into_raw(v.into_boxed_slice());
6180 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6184 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6185 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6186 impl Drop for CVec_TransactionZ {
6187 fn drop(&mut self) {
6188 if self.datalen == 0 { return; }
6189 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6192 impl Clone for CVec_TransactionZ {
6193 fn clone(&self) -> Self {
6194 let mut res = Vec::new();
6195 if self.datalen == 0 { return Self::from(res); }
6196 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6201 /// A tuple of 2 elements. See the individual fields for the types contained.
6202 pub struct C2Tuple_u32TxOutZ {
6203 /// The element at position 0
6205 /// The element at position 1
6206 pub b: crate::c_types::TxOut,
6208 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6209 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6216 impl C2Tuple_u32TxOutZ {
6217 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6221 impl Clone for C2Tuple_u32TxOutZ {
6222 fn clone(&self) -> Self {
6230 /// Creates a new tuple which has the same data as `orig`
6231 /// but with all dynamically-allocated buffers duplicated in new buffers.
6232 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
6233 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6235 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6236 C2Tuple_u32TxOutZ { a, b, }
6240 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6241 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6243 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6244 /// This corresponds to std::vector in C++
6245 pub struct CVec_C2Tuple_u32TxOutZZ {
6246 /// The elements in the array.
6247 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6248 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6249 /// The number of elements pointed to by `data`.
6252 impl CVec_C2Tuple_u32TxOutZZ {
6253 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6254 if self.datalen == 0 { return Vec::new(); }
6255 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6256 self.data = std::ptr::null_mut();
6260 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6261 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6264 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6265 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6266 let datalen = v.len();
6267 let data = Box::into_raw(v.into_boxed_slice());
6268 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6272 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6273 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6274 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6275 fn drop(&mut self) {
6276 if self.datalen == 0 { return; }
6277 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6280 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6281 fn clone(&self) -> Self {
6282 let mut res = Vec::new();
6283 if self.datalen == 0 { return Self::from(res); }
6284 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6289 /// A tuple of 2 elements. See the individual fields for the types contained.
6290 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6291 /// The element at position 0
6292 pub a: crate::c_types::ThirtyTwoBytes,
6293 /// The element at position 1
6294 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6296 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6297 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6304 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6305 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6309 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6310 fn clone(&self) -> Self {
6318 /// Creates a new tuple which has the same data as `orig`
6319 /// but with all dynamically-allocated buffers duplicated in new buffers.
6320 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { orig.clone() }
6321 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6323 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 {
6324 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6328 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6329 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6331 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6332 /// This corresponds to std::vector in C++
6333 pub struct CVec_TransactionOutputsZ {
6334 /// The elements in the array.
6335 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6336 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6337 /// The number of elements pointed to by `data`.
6340 impl CVec_TransactionOutputsZ {
6341 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6342 if self.datalen == 0 { return Vec::new(); }
6343 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6344 self.data = std::ptr::null_mut();
6348 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6349 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6352 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6353 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6354 let datalen = v.len();
6355 let data = Box::into_raw(v.into_boxed_slice());
6356 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6360 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6361 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6362 impl Drop for CVec_TransactionOutputsZ {
6363 fn drop(&mut self) {
6364 if self.datalen == 0 { return; }
6365 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6368 impl Clone for CVec_TransactionOutputsZ {
6369 fn clone(&self) -> Self {
6370 let mut res = Vec::new();
6371 if self.datalen == 0 { return Self::from(res); }
6372 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6377 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6378 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6379 /// A pointer to the contents in the success state.
6380 /// Reading from this pointer when `result_ok` is not set is undefined.
6381 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
6382 /// A pointer to the contents in the error state.
6383 /// Reading from this pointer when `result_ok` is set is undefined.
6384 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6387 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6388 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6389 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6390 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6391 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6392 /// `err` or `result` depending on the state of `result_ok`.
6393 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
6394 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6395 pub result_ok: bool,
6398 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
6399 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6400 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6401 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6402 result: Box::into_raw(Box::new(o)),
6408 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
6409 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6410 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6411 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6412 err: Box::into_raw(Box::new(e)),
6418 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
6419 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
6420 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6421 fn drop(&mut self) {
6423 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6424 let _ = unsafe { Box::from_raw(self.contents.result) };
6427 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6428 let _ = unsafe { Box::from_raw(self.contents.err) };
6433 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6434 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6435 let contents = if o.result_ok {
6436 let result = unsafe { o.contents.result };
6437 unsafe { o.contents.result = std::ptr::null_mut() };
6438 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
6440 let err = unsafe { o.contents.err };
6441 unsafe { o.contents.err = std::ptr::null_mut(); }
6442 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
6446 result_ok: o.result_ok,
6451 /// The contents of CResult_boolLightningErrorZ
6452 pub union CResult_boolLightningErrorZPtr {
6453 /// A pointer to the contents in the success state.
6454 /// Reading from this pointer when `result_ok` is not set is undefined.
6455 pub result: *mut bool,
6456 /// A pointer to the contents in the error state.
6457 /// Reading from this pointer when `result_ok` is set is undefined.
6458 pub err: *mut crate::lightning::ln::msgs::LightningError,
6461 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6462 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6463 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6464 pub struct CResult_boolLightningErrorZ {
6465 /// The contents of this CResult_boolLightningErrorZ, accessible via either
6466 /// `err` or `result` depending on the state of `result_ok`.
6467 pub contents: CResult_boolLightningErrorZPtr,
6468 /// Whether this CResult_boolLightningErrorZ represents a success state.
6469 pub result_ok: bool,
6472 /// Creates a new CResult_boolLightningErrorZ in the success state.
6473 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6474 CResult_boolLightningErrorZ {
6475 contents: CResult_boolLightningErrorZPtr {
6476 result: Box::into_raw(Box::new(o)),
6482 /// Creates a new CResult_boolLightningErrorZ in the error state.
6483 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6484 CResult_boolLightningErrorZ {
6485 contents: CResult_boolLightningErrorZPtr {
6486 err: Box::into_raw(Box::new(e)),
6492 /// Frees any resources used by the CResult_boolLightningErrorZ.
6493 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6494 impl Drop for CResult_boolLightningErrorZ {
6495 fn drop(&mut self) {
6497 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6498 let _ = unsafe { Box::from_raw(self.contents.result) };
6501 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6502 let _ = unsafe { Box::from_raw(self.contents.err) };
6507 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6508 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6509 let contents = if o.result_ok {
6510 let result = unsafe { o.contents.result };
6511 unsafe { o.contents.result = std::ptr::null_mut() };
6512 CResult_boolLightningErrorZPtr { result }
6514 let err = unsafe { o.contents.err };
6515 unsafe { o.contents.err = std::ptr::null_mut(); }
6516 CResult_boolLightningErrorZPtr { err }
6520 result_ok: o.result_ok,
6524 impl Clone for CResult_boolLightningErrorZ {
6525 fn clone(&self) -> Self {
6527 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6528 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6531 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6532 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6538 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6539 /// but with all dynamically-allocated buffers duplicated in new buffers.
6540 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
6542 /// A tuple of 3 elements. See the individual fields for the types contained.
6543 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6544 /// The element at position 0
6545 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6546 /// The element at position 1
6547 pub b: crate::lightning::ln::msgs::ChannelUpdate,
6548 /// The element at position 2
6549 pub c: crate::lightning::ln::msgs::ChannelUpdate,
6551 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6552 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6560 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6561 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6562 (self.a, self.b, self.c)
6565 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6566 fn clone(&self) -> Self {
6575 /// Creates a new tuple which has the same data as `orig`
6576 /// but with all dynamically-allocated buffers duplicated in new buffers.
6577 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
6578 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6580 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 {
6581 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6585 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6586 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6588 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6589 /// This corresponds to std::vector in C++
6590 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6591 /// The elements in the array.
6592 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6593 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
6594 /// The number of elements pointed to by `data`.
6597 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6598 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
6599 if self.datalen == 0 { return Vec::new(); }
6600 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6601 self.data = std::ptr::null_mut();
6605 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
6606 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6609 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6610 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
6611 let datalen = v.len();
6612 let data = Box::into_raw(v.into_boxed_slice());
6613 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6617 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6618 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6619 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6620 fn drop(&mut self) {
6621 if self.datalen == 0 { return; }
6622 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6625 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6626 fn clone(&self) -> Self {
6627 let mut res = Vec::new();
6628 if self.datalen == 0 { return Self::from(res); }
6629 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6634 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6635 /// This corresponds to std::vector in C++
6636 pub struct CVec_NodeAnnouncementZ {
6637 /// The elements in the array.
6638 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6639 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
6640 /// The number of elements pointed to by `data`.
6643 impl CVec_NodeAnnouncementZ {
6644 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
6645 if self.datalen == 0 { return Vec::new(); }
6646 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6647 self.data = std::ptr::null_mut();
6651 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
6652 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6655 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
6656 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
6657 let datalen = v.len();
6658 let data = Box::into_raw(v.into_boxed_slice());
6659 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6663 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6664 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
6665 impl Drop for CVec_NodeAnnouncementZ {
6666 fn drop(&mut self) {
6667 if self.datalen == 0 { return; }
6668 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6671 impl Clone for CVec_NodeAnnouncementZ {
6672 fn clone(&self) -> Self {
6673 let mut res = Vec::new();
6674 if self.datalen == 0 { return Self::from(res); }
6675 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6680 /// The contents of CResult_NoneLightningErrorZ
6681 pub union CResult_NoneLightningErrorZPtr {
6682 /// Note that this value is always NULL, as there are no contents in the OK variant
6683 pub result: *mut std::ffi::c_void,
6684 /// A pointer to the contents in the error state.
6685 /// Reading from this pointer when `result_ok` is set is undefined.
6686 pub err: *mut crate::lightning::ln::msgs::LightningError,
6689 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6690 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6692 pub struct CResult_NoneLightningErrorZ {
6693 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6694 /// `err` or `result` depending on the state of `result_ok`.
6695 pub contents: CResult_NoneLightningErrorZPtr,
6696 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6697 pub result_ok: bool,
6700 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6701 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6702 CResult_NoneLightningErrorZ {
6703 contents: CResult_NoneLightningErrorZPtr {
6704 result: std::ptr::null_mut(),
6710 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6711 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6712 CResult_NoneLightningErrorZ {
6713 contents: CResult_NoneLightningErrorZPtr {
6714 err: Box::into_raw(Box::new(e)),
6720 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6721 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6722 impl Drop for CResult_NoneLightningErrorZ {
6723 fn drop(&mut self) {
6726 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6727 let _ = unsafe { Box::from_raw(self.contents.err) };
6732 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6733 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6734 let contents = if o.result_ok {
6735 let _ = unsafe { Box::from_raw(o.contents.result) };
6736 o.contents.result = std::ptr::null_mut();
6737 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
6739 let err = unsafe { o.contents.err };
6740 unsafe { o.contents.err = std::ptr::null_mut(); }
6741 CResult_NoneLightningErrorZPtr { err }
6745 result_ok: o.result_ok,
6749 impl Clone for CResult_NoneLightningErrorZ {
6750 fn clone(&self) -> Self {
6752 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6753 result: std::ptr::null_mut()
6756 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6757 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6763 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6764 /// but with all dynamically-allocated buffers duplicated in new buffers.
6765 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
6767 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
6768 /// This corresponds to std::vector in C++
6769 pub struct CVec_PublicKeyZ {
6770 /// The elements in the array.
6771 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6772 pub data: *mut crate::c_types::PublicKey,
6773 /// The number of elements pointed to by `data`.
6776 impl CVec_PublicKeyZ {
6777 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
6778 if self.datalen == 0 { return Vec::new(); }
6779 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6780 self.data = std::ptr::null_mut();
6784 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
6785 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6788 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
6789 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
6790 let datalen = v.len();
6791 let data = Box::into_raw(v.into_boxed_slice());
6792 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6796 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6797 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
6798 impl Drop for CVec_PublicKeyZ {
6799 fn drop(&mut self) {
6800 if self.datalen == 0 { return; }
6801 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6804 impl Clone for CVec_PublicKeyZ {
6805 fn clone(&self) -> Self {
6806 let mut res = Vec::new();
6807 if self.datalen == 0 { return Self::from(res); }
6808 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6813 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
6814 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
6815 /// A pointer to the contents in the success state.
6816 /// Reading from this pointer when `result_ok` is not set is undefined.
6817 pub result: *mut crate::c_types::derived::CVec_u8Z,
6818 /// A pointer to the contents in the error state.
6819 /// Reading from this pointer when `result_ok` is set is undefined.
6820 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6823 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
6824 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6825 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6826 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
6827 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
6828 /// `err` or `result` depending on the state of `result_ok`.
6829 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
6830 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
6831 pub result_ok: bool,
6834 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
6835 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
6836 CResult_CVec_u8ZPeerHandleErrorZ {
6837 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6838 result: Box::into_raw(Box::new(o)),
6844 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
6845 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
6846 CResult_CVec_u8ZPeerHandleErrorZ {
6847 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6848 err: Box::into_raw(Box::new(e)),
6854 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
6855 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
6856 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
6857 fn drop(&mut self) {
6859 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6860 let _ = unsafe { Box::from_raw(self.contents.result) };
6863 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6864 let _ = unsafe { Box::from_raw(self.contents.err) };
6869 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
6870 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6871 let contents = if o.result_ok {
6872 let result = unsafe { o.contents.result };
6873 unsafe { o.contents.result = std::ptr::null_mut() };
6874 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
6876 let err = unsafe { o.contents.err };
6877 unsafe { o.contents.err = std::ptr::null_mut(); }
6878 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
6882 result_ok: o.result_ok,
6886 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
6887 fn clone(&self) -> Self {
6889 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6890 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
6893 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6894 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
6900 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
6901 /// but with all dynamically-allocated buffers duplicated in new buffers.
6902 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
6904 /// The contents of CResult_NonePeerHandleErrorZ
6905 pub union CResult_NonePeerHandleErrorZPtr {
6906 /// Note that this value is always NULL, as there are no contents in the OK variant
6907 pub result: *mut std::ffi::c_void,
6908 /// A pointer to the contents in the error state.
6909 /// Reading from this pointer when `result_ok` is set is undefined.
6910 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6913 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
6914 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6916 pub struct CResult_NonePeerHandleErrorZ {
6917 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
6918 /// `err` or `result` depending on the state of `result_ok`.
6919 pub contents: CResult_NonePeerHandleErrorZPtr,
6920 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
6921 pub result_ok: bool,
6924 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
6925 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
6926 CResult_NonePeerHandleErrorZ {
6927 contents: CResult_NonePeerHandleErrorZPtr {
6928 result: std::ptr::null_mut(),
6934 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
6935 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
6936 CResult_NonePeerHandleErrorZ {
6937 contents: CResult_NonePeerHandleErrorZPtr {
6938 err: Box::into_raw(Box::new(e)),
6944 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
6945 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
6946 impl Drop for CResult_NonePeerHandleErrorZ {
6947 fn drop(&mut self) {
6950 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6951 let _ = unsafe { Box::from_raw(self.contents.err) };
6956 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
6957 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6958 let contents = if o.result_ok {
6959 let _ = unsafe { Box::from_raw(o.contents.result) };
6960 o.contents.result = std::ptr::null_mut();
6961 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
6963 let err = unsafe { o.contents.err };
6964 unsafe { o.contents.err = std::ptr::null_mut(); }
6965 CResult_NonePeerHandleErrorZPtr { err }
6969 result_ok: o.result_ok,
6973 impl Clone for CResult_NonePeerHandleErrorZ {
6974 fn clone(&self) -> Self {
6976 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
6977 result: std::ptr::null_mut()
6980 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
6981 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
6987 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
6988 /// but with all dynamically-allocated buffers duplicated in new buffers.
6989 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
6991 /// The contents of CResult_boolPeerHandleErrorZ
6992 pub union CResult_boolPeerHandleErrorZPtr {
6993 /// A pointer to the contents in the success state.
6994 /// Reading from this pointer when `result_ok` is not set is undefined.
6995 pub result: *mut bool,
6996 /// A pointer to the contents in the error state.
6997 /// Reading from this pointer when `result_ok` is set is undefined.
6998 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7001 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7002 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7004 pub struct CResult_boolPeerHandleErrorZ {
7005 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7006 /// `err` or `result` depending on the state of `result_ok`.
7007 pub contents: CResult_boolPeerHandleErrorZPtr,
7008 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7009 pub result_ok: bool,
7012 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7013 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7014 CResult_boolPeerHandleErrorZ {
7015 contents: CResult_boolPeerHandleErrorZPtr {
7016 result: Box::into_raw(Box::new(o)),
7022 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7023 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7024 CResult_boolPeerHandleErrorZ {
7025 contents: CResult_boolPeerHandleErrorZPtr {
7026 err: Box::into_raw(Box::new(e)),
7032 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7033 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7034 impl Drop for CResult_boolPeerHandleErrorZ {
7035 fn drop(&mut self) {
7037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7038 let _ = unsafe { Box::from_raw(self.contents.result) };
7041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7042 let _ = unsafe { Box::from_raw(self.contents.err) };
7047 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7048 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7049 let contents = if o.result_ok {
7050 let result = unsafe { o.contents.result };
7051 unsafe { o.contents.result = std::ptr::null_mut() };
7052 CResult_boolPeerHandleErrorZPtr { result }
7054 let err = unsafe { o.contents.err };
7055 unsafe { o.contents.err = std::ptr::null_mut(); }
7056 CResult_boolPeerHandleErrorZPtr { err }
7060 result_ok: o.result_ok,
7064 impl Clone for CResult_boolPeerHandleErrorZ {
7065 fn clone(&self) -> Self {
7067 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7068 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7071 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
7072 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7078 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7079 /// but with all dynamically-allocated buffers duplicated in new buffers.
7080 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
7082 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7083 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
7084 /// A pointer to the contents in the success state.
7085 /// Reading from this pointer when `result_ok` is not set is undefined.
7086 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
7087 /// A pointer to the contents in the error state.
7088 /// Reading from this pointer when `result_ok` is set is undefined.
7089 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7092 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7093 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7095 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7096 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7097 /// `err` or `result` depending on the state of `result_ok`.
7098 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7099 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7100 pub result_ok: bool,
7103 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7104 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7105 CResult_DirectionalChannelInfoDecodeErrorZ {
7106 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7107 result: Box::into_raw(Box::new(o)),
7113 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7114 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7115 CResult_DirectionalChannelInfoDecodeErrorZ {
7116 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7117 err: Box::into_raw(Box::new(e)),
7123 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
7124 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7125 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
7126 fn drop(&mut self) {
7128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7129 let _ = unsafe { Box::from_raw(self.contents.result) };
7132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7133 let _ = unsafe { Box::from_raw(self.contents.err) };
7138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7140 let contents = if o.result_ok {
7141 let result = unsafe { o.contents.result };
7142 unsafe { o.contents.result = std::ptr::null_mut() };
7143 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
7145 let err = unsafe { o.contents.err };
7146 unsafe { o.contents.err = std::ptr::null_mut(); }
7147 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7151 result_ok: o.result_ok,
7155 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7156 fn clone(&self) -> Self {
7158 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7159 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7162 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7169 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7170 /// but with all dynamically-allocated buffers duplicated in new buffers.
7171 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
7173 /// The contents of CResult_ChannelInfoDecodeErrorZ
7174 pub union CResult_ChannelInfoDecodeErrorZPtr {
7175 /// A pointer to the contents in the success state.
7176 /// Reading from this pointer when `result_ok` is not set is undefined.
7177 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
7178 /// A pointer to the contents in the error state.
7179 /// Reading from this pointer when `result_ok` is set is undefined.
7180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7183 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7184 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7186 pub struct CResult_ChannelInfoDecodeErrorZ {
7187 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7188 /// `err` or `result` depending on the state of `result_ok`.
7189 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7190 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7191 pub result_ok: bool,
7194 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7195 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7196 CResult_ChannelInfoDecodeErrorZ {
7197 contents: CResult_ChannelInfoDecodeErrorZPtr {
7198 result: Box::into_raw(Box::new(o)),
7204 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7205 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7206 CResult_ChannelInfoDecodeErrorZ {
7207 contents: CResult_ChannelInfoDecodeErrorZPtr {
7208 err: Box::into_raw(Box::new(e)),
7214 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7215 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7216 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7217 fn drop(&mut self) {
7219 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7220 let _ = unsafe { Box::from_raw(self.contents.result) };
7223 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7224 let _ = unsafe { Box::from_raw(self.contents.err) };
7229 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7230 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7231 let contents = if o.result_ok {
7232 let result = unsafe { o.contents.result };
7233 unsafe { o.contents.result = std::ptr::null_mut() };
7234 CResult_ChannelInfoDecodeErrorZPtr { result }
7236 let err = unsafe { o.contents.err };
7237 unsafe { o.contents.err = std::ptr::null_mut(); }
7238 CResult_ChannelInfoDecodeErrorZPtr { err }
7242 result_ok: o.result_ok,
7246 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7247 fn clone(&self) -> Self {
7249 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7250 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7253 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7254 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7260 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7261 /// but with all dynamically-allocated buffers duplicated in new buffers.
7262 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
7264 /// The contents of CResult_RoutingFeesDecodeErrorZ
7265 pub union CResult_RoutingFeesDecodeErrorZPtr {
7266 /// A pointer to the contents in the success state.
7267 /// Reading from this pointer when `result_ok` is not set is undefined.
7268 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
7269 /// A pointer to the contents in the error state.
7270 /// Reading from this pointer when `result_ok` is set is undefined.
7271 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7274 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7275 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7276 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7277 pub struct CResult_RoutingFeesDecodeErrorZ {
7278 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7279 /// `err` or `result` depending on the state of `result_ok`.
7280 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7281 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7282 pub result_ok: bool,
7285 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7286 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7287 CResult_RoutingFeesDecodeErrorZ {
7288 contents: CResult_RoutingFeesDecodeErrorZPtr {
7289 result: Box::into_raw(Box::new(o)),
7295 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7296 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7297 CResult_RoutingFeesDecodeErrorZ {
7298 contents: CResult_RoutingFeesDecodeErrorZPtr {
7299 err: Box::into_raw(Box::new(e)),
7305 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7306 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7307 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7308 fn drop(&mut self) {
7310 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7311 let _ = unsafe { Box::from_raw(self.contents.result) };
7314 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7315 let _ = unsafe { Box::from_raw(self.contents.err) };
7320 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7321 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7322 let contents = if o.result_ok {
7323 let result = unsafe { o.contents.result };
7324 unsafe { o.contents.result = std::ptr::null_mut() };
7325 CResult_RoutingFeesDecodeErrorZPtr { result }
7327 let err = unsafe { o.contents.err };
7328 unsafe { o.contents.err = std::ptr::null_mut(); }
7329 CResult_RoutingFeesDecodeErrorZPtr { err }
7333 result_ok: o.result_ok,
7337 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7338 fn clone(&self) -> Self {
7340 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7341 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
7344 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7345 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7351 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7352 /// but with all dynamically-allocated buffers duplicated in new buffers.
7353 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
7355 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7356 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7357 /// A pointer to the contents in the success state.
7358 /// Reading from this pointer when `result_ok` is not set is undefined.
7359 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
7360 /// A pointer to the contents in the error state.
7361 /// Reading from this pointer when `result_ok` is set is undefined.
7362 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7365 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7366 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7367 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7368 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7369 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7370 /// `err` or `result` depending on the state of `result_ok`.
7371 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7372 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7373 pub result_ok: bool,
7376 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7377 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7378 CResult_NodeAnnouncementInfoDecodeErrorZ {
7379 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7380 result: Box::into_raw(Box::new(o)),
7386 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7387 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7388 CResult_NodeAnnouncementInfoDecodeErrorZ {
7389 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7390 err: Box::into_raw(Box::new(e)),
7396 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7397 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7398 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7399 fn drop(&mut self) {
7401 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7402 let _ = unsafe { Box::from_raw(self.contents.result) };
7405 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7406 let _ = unsafe { Box::from_raw(self.contents.err) };
7411 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7412 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7413 let contents = if o.result_ok {
7414 let result = unsafe { o.contents.result };
7415 unsafe { o.contents.result = std::ptr::null_mut() };
7416 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7418 let err = unsafe { o.contents.err };
7419 unsafe { o.contents.err = std::ptr::null_mut(); }
7420 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7424 result_ok: o.result_ok,
7428 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7429 fn clone(&self) -> Self {
7431 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7432 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7435 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7436 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7442 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7443 /// but with all dynamically-allocated buffers duplicated in new buffers.
7444 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
7446 /// A dynamically-allocated array of u64s of arbitrary size.
7447 /// This corresponds to std::vector in C++
7448 pub struct CVec_u64Z {
7449 /// The elements in the array.
7450 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7452 /// The number of elements pointed to by `data`.
7456 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
7457 if self.datalen == 0 { return Vec::new(); }
7458 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7459 self.data = std::ptr::null_mut();
7463 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
7464 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7467 impl From<Vec<u64>> for CVec_u64Z {
7468 fn from(v: Vec<u64>) -> Self {
7469 let datalen = v.len();
7470 let data = Box::into_raw(v.into_boxed_slice());
7471 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7475 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7476 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
7477 impl Drop for CVec_u64Z {
7478 fn drop(&mut self) {
7479 if self.datalen == 0 { return; }
7480 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7483 impl Clone for CVec_u64Z {
7484 fn clone(&self) -> Self {
7485 let mut res = Vec::new();
7486 if self.datalen == 0 { return Self::from(res); }
7487 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7492 /// The contents of CResult_NodeInfoDecodeErrorZ
7493 pub union CResult_NodeInfoDecodeErrorZPtr {
7494 /// A pointer to the contents in the success state.
7495 /// Reading from this pointer when `result_ok` is not set is undefined.
7496 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
7497 /// A pointer to the contents in the error state.
7498 /// Reading from this pointer when `result_ok` is set is undefined.
7499 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7502 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7503 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7504 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7505 pub struct CResult_NodeInfoDecodeErrorZ {
7506 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7507 /// `err` or `result` depending on the state of `result_ok`.
7508 pub contents: CResult_NodeInfoDecodeErrorZPtr,
7509 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7510 pub result_ok: bool,
7513 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7514 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7515 CResult_NodeInfoDecodeErrorZ {
7516 contents: CResult_NodeInfoDecodeErrorZPtr {
7517 result: Box::into_raw(Box::new(o)),
7523 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7524 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7525 CResult_NodeInfoDecodeErrorZ {
7526 contents: CResult_NodeInfoDecodeErrorZPtr {
7527 err: Box::into_raw(Box::new(e)),
7533 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7534 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7535 impl Drop for CResult_NodeInfoDecodeErrorZ {
7536 fn drop(&mut self) {
7538 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7539 let _ = unsafe { Box::from_raw(self.contents.result) };
7542 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7543 let _ = unsafe { Box::from_raw(self.contents.err) };
7548 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7549 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7550 let contents = if o.result_ok {
7551 let result = unsafe { o.contents.result };
7552 unsafe { o.contents.result = std::ptr::null_mut() };
7553 CResult_NodeInfoDecodeErrorZPtr { result }
7555 let err = unsafe { o.contents.err };
7556 unsafe { o.contents.err = std::ptr::null_mut(); }
7557 CResult_NodeInfoDecodeErrorZPtr { err }
7561 result_ok: o.result_ok,
7565 impl Clone for CResult_NodeInfoDecodeErrorZ {
7566 fn clone(&self) -> Self {
7568 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7569 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
7572 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7573 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7579 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7580 /// but with all dynamically-allocated buffers duplicated in new buffers.
7581 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
7583 /// The contents of CResult_NetworkGraphDecodeErrorZ
7584 pub union CResult_NetworkGraphDecodeErrorZPtr {
7585 /// A pointer to the contents in the success state.
7586 /// Reading from this pointer when `result_ok` is not set is undefined.
7587 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
7588 /// A pointer to the contents in the error state.
7589 /// Reading from this pointer when `result_ok` is set is undefined.
7590 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7593 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7594 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7595 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7596 pub struct CResult_NetworkGraphDecodeErrorZ {
7597 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7598 /// `err` or `result` depending on the state of `result_ok`.
7599 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7600 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7601 pub result_ok: bool,
7604 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7605 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7606 CResult_NetworkGraphDecodeErrorZ {
7607 contents: CResult_NetworkGraphDecodeErrorZPtr {
7608 result: Box::into_raw(Box::new(o)),
7614 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7615 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7616 CResult_NetworkGraphDecodeErrorZ {
7617 contents: CResult_NetworkGraphDecodeErrorZPtr {
7618 err: Box::into_raw(Box::new(e)),
7624 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7625 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7626 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7627 fn drop(&mut self) {
7629 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7630 let _ = unsafe { Box::from_raw(self.contents.result) };
7633 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7634 let _ = unsafe { Box::from_raw(self.contents.err) };
7639 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7640 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7641 let contents = if o.result_ok {
7642 let result = unsafe { o.contents.result };
7643 unsafe { o.contents.result = std::ptr::null_mut() };
7644 CResult_NetworkGraphDecodeErrorZPtr { result }
7646 let err = unsafe { o.contents.err };
7647 unsafe { o.contents.err = std::ptr::null_mut(); }
7648 CResult_NetworkGraphDecodeErrorZPtr { err }
7652 result_ok: o.result_ok,
7656 impl Clone for CResult_NetworkGraphDecodeErrorZ {
7657 fn clone(&self) -> Self {
7659 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
7660 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
7663 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
7664 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7670 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
7671 /// but with all dynamically-allocated buffers duplicated in new buffers.
7672 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
7674 /// The contents of CResult_NetAddressu8Z
7675 pub union CResult_NetAddressu8ZPtr {
7676 /// A pointer to the contents in the success state.
7677 /// Reading from this pointer when `result_ok` is not set is undefined.
7678 pub result: *mut crate::lightning::ln::msgs::NetAddress,
7679 /// A pointer to the contents in the error state.
7680 /// Reading from this pointer when `result_ok` is set is undefined.
7684 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
7685 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7687 pub struct CResult_NetAddressu8Z {
7688 /// The contents of this CResult_NetAddressu8Z, accessible via either
7689 /// `err` or `result` depending on the state of `result_ok`.
7690 pub contents: CResult_NetAddressu8ZPtr,
7691 /// Whether this CResult_NetAddressu8Z represents a success state.
7692 pub result_ok: bool,
7695 /// Creates a new CResult_NetAddressu8Z in the success state.
7696 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
7697 CResult_NetAddressu8Z {
7698 contents: CResult_NetAddressu8ZPtr {
7699 result: Box::into_raw(Box::new(o)),
7705 /// Creates a new CResult_NetAddressu8Z in the error state.
7706 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
7707 CResult_NetAddressu8Z {
7708 contents: CResult_NetAddressu8ZPtr {
7709 err: Box::into_raw(Box::new(e)),
7715 /// Frees any resources used by the CResult_NetAddressu8Z.
7716 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
7717 impl Drop for CResult_NetAddressu8Z {
7718 fn drop(&mut self) {
7720 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7721 let _ = unsafe { Box::from_raw(self.contents.result) };
7724 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7725 let _ = unsafe { Box::from_raw(self.contents.err) };
7730 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
7731 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
7732 let contents = if o.result_ok {
7733 let result = unsafe { o.contents.result };
7734 unsafe { o.contents.result = std::ptr::null_mut() };
7735 CResult_NetAddressu8ZPtr { result }
7737 let err = unsafe { o.contents.err };
7738 unsafe { o.contents.err = std::ptr::null_mut(); }
7739 CResult_NetAddressu8ZPtr { err }
7743 result_ok: o.result_ok,
7747 impl Clone for CResult_NetAddressu8Z {
7748 fn clone(&self) -> Self {
7750 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
7751 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7754 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
7755 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
7761 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
7762 /// but with all dynamically-allocated buffers duplicated in new buffers.
7763 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
7765 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
7766 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7767 /// A pointer to the contents in the success state.
7768 /// Reading from this pointer when `result_ok` is not set is undefined.
7769 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
7770 /// A pointer to the contents in the error state.
7771 /// Reading from this pointer when `result_ok` is set is undefined.
7772 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7775 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
7776 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
7777 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7778 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
7779 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
7780 /// `err` or `result` depending on the state of `result_ok`.
7781 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
7782 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
7783 pub result_ok: bool,
7786 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
7787 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7788 CResult_CResult_NetAddressu8ZDecodeErrorZ {
7789 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7790 result: Box::into_raw(Box::new(o)),
7796 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
7797 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7798 CResult_CResult_NetAddressu8ZDecodeErrorZ {
7799 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7800 err: Box::into_raw(Box::new(e)),
7806 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
7807 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
7808 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7809 fn drop(&mut self) {
7811 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7812 let _ = unsafe { Box::from_raw(self.contents.result) };
7815 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7816 let _ = unsafe { Box::from_raw(self.contents.err) };
7821 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7822 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
7823 let contents = if o.result_ok {
7824 let result = unsafe { o.contents.result };
7825 unsafe { o.contents.result = std::ptr::null_mut() };
7826 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
7828 let err = unsafe { o.contents.err };
7829 unsafe { o.contents.err = std::ptr::null_mut(); }
7830 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
7834 result_ok: o.result_ok,
7838 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7839 fn clone(&self) -> Self {
7841 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7842 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
7845 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7846 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7852 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
7853 /// but with all dynamically-allocated buffers duplicated in new buffers.
7854 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
7856 /// The contents of CResult_NetAddressDecodeErrorZ
7857 pub union CResult_NetAddressDecodeErrorZPtr {
7858 /// A pointer to the contents in the success state.
7859 /// Reading from this pointer when `result_ok` is not set is undefined.
7860 pub result: *mut crate::lightning::ln::msgs::NetAddress,
7861 /// A pointer to the contents in the error state.
7862 /// Reading from this pointer when `result_ok` is set is undefined.
7863 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7866 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
7867 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
7868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7869 pub struct CResult_NetAddressDecodeErrorZ {
7870 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7871 /// `err` or `result` depending on the state of `result_ok`.
7872 pub contents: CResult_NetAddressDecodeErrorZPtr,
7873 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7874 pub result_ok: bool,
7877 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
7878 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
7879 CResult_NetAddressDecodeErrorZ {
7880 contents: CResult_NetAddressDecodeErrorZPtr {
7881 result: Box::into_raw(Box::new(o)),
7887 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
7888 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
7889 CResult_NetAddressDecodeErrorZ {
7890 contents: CResult_NetAddressDecodeErrorZPtr {
7891 err: Box::into_raw(Box::new(e)),
7897 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
7898 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
7899 impl Drop for CResult_NetAddressDecodeErrorZ {
7900 fn drop(&mut self) {
7902 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7903 let _ = unsafe { Box::from_raw(self.contents.result) };
7906 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7907 let _ = unsafe { Box::from_raw(self.contents.err) };
7912 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
7913 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
7914 let contents = if o.result_ok {
7915 let result = unsafe { o.contents.result };
7916 unsafe { o.contents.result = std::ptr::null_mut() };
7917 CResult_NetAddressDecodeErrorZPtr { result }
7919 let err = unsafe { o.contents.err };
7920 unsafe { o.contents.err = std::ptr::null_mut(); }
7921 CResult_NetAddressDecodeErrorZPtr { err }
7925 result_ok: o.result_ok,
7929 impl Clone for CResult_NetAddressDecodeErrorZ {
7930 fn clone(&self) -> Self {
7932 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
7933 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7936 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
7937 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7943 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
7944 /// but with all dynamically-allocated buffers duplicated in new buffers.
7945 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
7947 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
7948 /// This corresponds to std::vector in C++
7949 pub struct CVec_UpdateAddHTLCZ {
7950 /// The elements in the array.
7951 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7952 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
7953 /// The number of elements pointed to by `data`.
7956 impl CVec_UpdateAddHTLCZ {
7957 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
7958 if self.datalen == 0 { return Vec::new(); }
7959 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7960 self.data = std::ptr::null_mut();
7964 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
7965 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7968 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
7969 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
7970 let datalen = v.len();
7971 let data = Box::into_raw(v.into_boxed_slice());
7972 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7976 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7977 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
7978 impl Drop for CVec_UpdateAddHTLCZ {
7979 fn drop(&mut self) {
7980 if self.datalen == 0 { return; }
7981 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7984 impl Clone for CVec_UpdateAddHTLCZ {
7985 fn clone(&self) -> Self {
7986 let mut res = Vec::new();
7987 if self.datalen == 0 { return Self::from(res); }
7988 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7993 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
7994 /// This corresponds to std::vector in C++
7995 pub struct CVec_UpdateFulfillHTLCZ {
7996 /// The elements in the array.
7997 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7998 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
7999 /// The number of elements pointed to by `data`.
8002 impl CVec_UpdateFulfillHTLCZ {
8003 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8004 if self.datalen == 0 { return Vec::new(); }
8005 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8006 self.data = std::ptr::null_mut();
8010 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8011 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8014 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8015 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8016 let datalen = v.len();
8017 let data = Box::into_raw(v.into_boxed_slice());
8018 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8022 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8023 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8024 impl Drop for CVec_UpdateFulfillHTLCZ {
8025 fn drop(&mut self) {
8026 if self.datalen == 0 { return; }
8027 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8030 impl Clone for CVec_UpdateFulfillHTLCZ {
8031 fn clone(&self) -> Self {
8032 let mut res = Vec::new();
8033 if self.datalen == 0 { return Self::from(res); }
8034 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8039 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8040 /// This corresponds to std::vector in C++
8041 pub struct CVec_UpdateFailHTLCZ {
8042 /// The elements in the array.
8043 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8044 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8045 /// The number of elements pointed to by `data`.
8048 impl CVec_UpdateFailHTLCZ {
8049 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8050 if self.datalen == 0 { return Vec::new(); }
8051 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8052 self.data = std::ptr::null_mut();
8056 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8057 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8060 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8061 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8062 let datalen = v.len();
8063 let data = Box::into_raw(v.into_boxed_slice());
8064 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8068 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8069 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8070 impl Drop for CVec_UpdateFailHTLCZ {
8071 fn drop(&mut self) {
8072 if self.datalen == 0 { return; }
8073 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8076 impl Clone for CVec_UpdateFailHTLCZ {
8077 fn clone(&self) -> Self {
8078 let mut res = Vec::new();
8079 if self.datalen == 0 { return Self::from(res); }
8080 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8085 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8086 /// This corresponds to std::vector in C++
8087 pub struct CVec_UpdateFailMalformedHTLCZ {
8088 /// The elements in the array.
8089 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8090 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8091 /// The number of elements pointed to by `data`.
8094 impl CVec_UpdateFailMalformedHTLCZ {
8095 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8096 if self.datalen == 0 { return Vec::new(); }
8097 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8098 self.data = std::ptr::null_mut();
8102 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8103 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8106 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8107 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8108 let datalen = v.len();
8109 let data = Box::into_raw(v.into_boxed_slice());
8110 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8114 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8115 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8116 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8117 fn drop(&mut self) {
8118 if self.datalen == 0 { return; }
8119 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8122 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8123 fn clone(&self) -> Self {
8124 let mut res = Vec::new();
8125 if self.datalen == 0 { return Self::from(res); }
8126 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8131 /// The contents of CResult_AcceptChannelDecodeErrorZ
8132 pub union CResult_AcceptChannelDecodeErrorZPtr {
8133 /// A pointer to the contents in the success state.
8134 /// Reading from this pointer when `result_ok` is not set is undefined.
8135 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8136 /// A pointer to the contents in the error state.
8137 /// Reading from this pointer when `result_ok` is set is undefined.
8138 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8141 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8142 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8144 pub struct CResult_AcceptChannelDecodeErrorZ {
8145 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8146 /// `err` or `result` depending on the state of `result_ok`.
8147 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8148 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8149 pub result_ok: bool,
8152 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8153 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8154 CResult_AcceptChannelDecodeErrorZ {
8155 contents: CResult_AcceptChannelDecodeErrorZPtr {
8156 result: Box::into_raw(Box::new(o)),
8162 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8163 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8164 CResult_AcceptChannelDecodeErrorZ {
8165 contents: CResult_AcceptChannelDecodeErrorZPtr {
8166 err: Box::into_raw(Box::new(e)),
8172 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8173 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8174 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8175 fn drop(&mut self) {
8177 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8178 let _ = unsafe { Box::from_raw(self.contents.result) };
8181 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8182 let _ = unsafe { Box::from_raw(self.contents.err) };
8187 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8188 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8189 let contents = if o.result_ok {
8190 let result = unsafe { o.contents.result };
8191 unsafe { o.contents.result = std::ptr::null_mut() };
8192 CResult_AcceptChannelDecodeErrorZPtr { result }
8194 let err = unsafe { o.contents.err };
8195 unsafe { o.contents.err = std::ptr::null_mut(); }
8196 CResult_AcceptChannelDecodeErrorZPtr { err }
8200 result_ok: o.result_ok,
8204 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8205 fn clone(&self) -> Self {
8207 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8208 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8211 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8212 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8218 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8219 /// but with all dynamically-allocated buffers duplicated in new buffers.
8220 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
8222 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8223 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8224 /// A pointer to the contents in the success state.
8225 /// Reading from this pointer when `result_ok` is not set is undefined.
8226 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8227 /// A pointer to the contents in the error state.
8228 /// Reading from this pointer when `result_ok` is set is undefined.
8229 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8232 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8233 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8235 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8236 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8237 /// `err` or `result` depending on the state of `result_ok`.
8238 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8239 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8240 pub result_ok: bool,
8243 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8244 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8245 CResult_AnnouncementSignaturesDecodeErrorZ {
8246 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8247 result: Box::into_raw(Box::new(o)),
8253 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8254 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8255 CResult_AnnouncementSignaturesDecodeErrorZ {
8256 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8257 err: Box::into_raw(Box::new(e)),
8263 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8264 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
8265 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
8266 fn drop(&mut self) {
8268 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8269 let _ = unsafe { Box::from_raw(self.contents.result) };
8272 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8273 let _ = unsafe { Box::from_raw(self.contents.err) };
8278 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
8279 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
8280 let contents = if o.result_ok {
8281 let result = unsafe { o.contents.result };
8282 unsafe { o.contents.result = std::ptr::null_mut() };
8283 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
8285 let err = unsafe { o.contents.err };
8286 unsafe { o.contents.err = std::ptr::null_mut(); }
8287 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
8291 result_ok: o.result_ok,
8295 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
8296 fn clone(&self) -> Self {
8298 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8299 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
8302 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8303 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8309 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8310 /// but with all dynamically-allocated buffers duplicated in new buffers.
8311 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
8313 /// The contents of CResult_ChannelReestablishDecodeErrorZ
8314 pub union CResult_ChannelReestablishDecodeErrorZPtr {
8315 /// A pointer to the contents in the success state.
8316 /// Reading from this pointer when `result_ok` is not set is undefined.
8317 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
8318 /// A pointer to the contents in the error state.
8319 /// Reading from this pointer when `result_ok` is set is undefined.
8320 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8323 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8324 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8326 pub struct CResult_ChannelReestablishDecodeErrorZ {
8327 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8328 /// `err` or `result` depending on the state of `result_ok`.
8329 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
8330 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8331 pub result_ok: bool,
8334 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8335 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
8336 CResult_ChannelReestablishDecodeErrorZ {
8337 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8338 result: Box::into_raw(Box::new(o)),
8344 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8345 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
8346 CResult_ChannelReestablishDecodeErrorZ {
8347 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8348 err: Box::into_raw(Box::new(e)),
8354 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8355 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
8356 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
8357 fn drop(&mut self) {
8359 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8360 let _ = unsafe { Box::from_raw(self.contents.result) };
8363 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8364 let _ = unsafe { Box::from_raw(self.contents.err) };
8369 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
8370 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
8371 let contents = if o.result_ok {
8372 let result = unsafe { o.contents.result };
8373 unsafe { o.contents.result = std::ptr::null_mut() };
8374 CResult_ChannelReestablishDecodeErrorZPtr { result }
8376 let err = unsafe { o.contents.err };
8377 unsafe { o.contents.err = std::ptr::null_mut(); }
8378 CResult_ChannelReestablishDecodeErrorZPtr { err }
8382 result_ok: o.result_ok,
8386 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
8387 fn clone(&self) -> Self {
8389 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8390 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
8393 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8394 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8400 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8401 /// but with all dynamically-allocated buffers duplicated in new buffers.
8402 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
8404 /// The contents of CResult_ClosingSignedDecodeErrorZ
8405 pub union CResult_ClosingSignedDecodeErrorZPtr {
8406 /// A pointer to the contents in the success state.
8407 /// Reading from this pointer when `result_ok` is not set is undefined.
8408 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
8409 /// A pointer to the contents in the error state.
8410 /// Reading from this pointer when `result_ok` is set is undefined.
8411 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8414 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8415 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8417 pub struct CResult_ClosingSignedDecodeErrorZ {
8418 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8419 /// `err` or `result` depending on the state of `result_ok`.
8420 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
8421 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8422 pub result_ok: bool,
8425 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8426 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
8427 CResult_ClosingSignedDecodeErrorZ {
8428 contents: CResult_ClosingSignedDecodeErrorZPtr {
8429 result: Box::into_raw(Box::new(o)),
8435 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8436 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
8437 CResult_ClosingSignedDecodeErrorZ {
8438 contents: CResult_ClosingSignedDecodeErrorZPtr {
8439 err: Box::into_raw(Box::new(e)),
8445 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8446 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
8447 impl Drop for CResult_ClosingSignedDecodeErrorZ {
8448 fn drop(&mut self) {
8450 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8451 let _ = unsafe { Box::from_raw(self.contents.result) };
8454 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8455 let _ = unsafe { Box::from_raw(self.contents.err) };
8460 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
8461 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8462 let contents = if o.result_ok {
8463 let result = unsafe { o.contents.result };
8464 unsafe { o.contents.result = std::ptr::null_mut() };
8465 CResult_ClosingSignedDecodeErrorZPtr { result }
8467 let err = unsafe { o.contents.err };
8468 unsafe { o.contents.err = std::ptr::null_mut(); }
8469 CResult_ClosingSignedDecodeErrorZPtr { err }
8473 result_ok: o.result_ok,
8477 impl Clone for CResult_ClosingSignedDecodeErrorZ {
8478 fn clone(&self) -> Self {
8480 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
8481 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
8484 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
8485 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8491 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8492 /// but with all dynamically-allocated buffers duplicated in new buffers.
8493 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
8495 /// The contents of CResult_CommitmentSignedDecodeErrorZ
8496 pub union CResult_CommitmentSignedDecodeErrorZPtr {
8497 /// A pointer to the contents in the success state.
8498 /// Reading from this pointer when `result_ok` is not set is undefined.
8499 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
8500 /// A pointer to the contents in the error state.
8501 /// Reading from this pointer when `result_ok` is set is undefined.
8502 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8505 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8506 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8507 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8508 pub struct CResult_CommitmentSignedDecodeErrorZ {
8509 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8510 /// `err` or `result` depending on the state of `result_ok`.
8511 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
8512 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8513 pub result_ok: bool,
8516 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8517 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
8518 CResult_CommitmentSignedDecodeErrorZ {
8519 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8520 result: Box::into_raw(Box::new(o)),
8526 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8527 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
8528 CResult_CommitmentSignedDecodeErrorZ {
8529 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8530 err: Box::into_raw(Box::new(e)),
8536 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8537 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
8538 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
8539 fn drop(&mut self) {
8541 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8542 let _ = unsafe { Box::from_raw(self.contents.result) };
8545 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8546 let _ = unsafe { Box::from_raw(self.contents.err) };
8551 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
8552 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8553 let contents = if o.result_ok {
8554 let result = unsafe { o.contents.result };
8555 unsafe { o.contents.result = std::ptr::null_mut() };
8556 CResult_CommitmentSignedDecodeErrorZPtr { result }
8558 let err = unsafe { o.contents.err };
8559 unsafe { o.contents.err = std::ptr::null_mut(); }
8560 CResult_CommitmentSignedDecodeErrorZPtr { err }
8564 result_ok: o.result_ok,
8568 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
8569 fn clone(&self) -> Self {
8571 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8572 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
8575 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8576 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8582 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8583 /// but with all dynamically-allocated buffers duplicated in new buffers.
8584 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
8586 /// The contents of CResult_FundingCreatedDecodeErrorZ
8587 pub union CResult_FundingCreatedDecodeErrorZPtr {
8588 /// A pointer to the contents in the success state.
8589 /// Reading from this pointer when `result_ok` is not set is undefined.
8590 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
8591 /// A pointer to the contents in the error state.
8592 /// Reading from this pointer when `result_ok` is set is undefined.
8593 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8596 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8597 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8599 pub struct CResult_FundingCreatedDecodeErrorZ {
8600 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8601 /// `err` or `result` depending on the state of `result_ok`.
8602 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
8603 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8604 pub result_ok: bool,
8607 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8608 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
8609 CResult_FundingCreatedDecodeErrorZ {
8610 contents: CResult_FundingCreatedDecodeErrorZPtr {
8611 result: Box::into_raw(Box::new(o)),
8617 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8618 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
8619 CResult_FundingCreatedDecodeErrorZ {
8620 contents: CResult_FundingCreatedDecodeErrorZPtr {
8621 err: Box::into_raw(Box::new(e)),
8627 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8628 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
8629 impl Drop for CResult_FundingCreatedDecodeErrorZ {
8630 fn drop(&mut self) {
8632 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8633 let _ = unsafe { Box::from_raw(self.contents.result) };
8636 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8637 let _ = unsafe { Box::from_raw(self.contents.err) };
8642 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
8643 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
8644 let contents = if o.result_ok {
8645 let result = unsafe { o.contents.result };
8646 unsafe { o.contents.result = std::ptr::null_mut() };
8647 CResult_FundingCreatedDecodeErrorZPtr { result }
8649 let err = unsafe { o.contents.err };
8650 unsafe { o.contents.err = std::ptr::null_mut(); }
8651 CResult_FundingCreatedDecodeErrorZPtr { err }
8655 result_ok: o.result_ok,
8659 impl Clone for CResult_FundingCreatedDecodeErrorZ {
8660 fn clone(&self) -> Self {
8662 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
8663 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
8666 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
8667 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8673 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8674 /// but with all dynamically-allocated buffers duplicated in new buffers.
8675 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
8677 /// The contents of CResult_FundingSignedDecodeErrorZ
8678 pub union CResult_FundingSignedDecodeErrorZPtr {
8679 /// A pointer to the contents in the success state.
8680 /// Reading from this pointer when `result_ok` is not set is undefined.
8681 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
8682 /// A pointer to the contents in the error state.
8683 /// Reading from this pointer when `result_ok` is set is undefined.
8684 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8687 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8688 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8689 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8690 pub struct CResult_FundingSignedDecodeErrorZ {
8691 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8692 /// `err` or `result` depending on the state of `result_ok`.
8693 pub contents: CResult_FundingSignedDecodeErrorZPtr,
8694 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8695 pub result_ok: bool,
8698 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8699 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
8700 CResult_FundingSignedDecodeErrorZ {
8701 contents: CResult_FundingSignedDecodeErrorZPtr {
8702 result: Box::into_raw(Box::new(o)),
8708 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8709 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
8710 CResult_FundingSignedDecodeErrorZ {
8711 contents: CResult_FundingSignedDecodeErrorZPtr {
8712 err: Box::into_raw(Box::new(e)),
8718 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8719 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
8720 impl Drop for CResult_FundingSignedDecodeErrorZ {
8721 fn drop(&mut self) {
8723 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8724 let _ = unsafe { Box::from_raw(self.contents.result) };
8727 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8728 let _ = unsafe { Box::from_raw(self.contents.err) };
8733 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
8734 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8735 let contents = if o.result_ok {
8736 let result = unsafe { o.contents.result };
8737 unsafe { o.contents.result = std::ptr::null_mut() };
8738 CResult_FundingSignedDecodeErrorZPtr { result }
8740 let err = unsafe { o.contents.err };
8741 unsafe { o.contents.err = std::ptr::null_mut(); }
8742 CResult_FundingSignedDecodeErrorZPtr { err }
8746 result_ok: o.result_ok,
8750 impl Clone for CResult_FundingSignedDecodeErrorZ {
8751 fn clone(&self) -> Self {
8753 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
8754 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
8757 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
8758 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8764 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
8765 /// but with all dynamically-allocated buffers duplicated in new buffers.
8766 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
8768 /// The contents of CResult_FundingLockedDecodeErrorZ
8769 pub union CResult_FundingLockedDecodeErrorZPtr {
8770 /// A pointer to the contents in the success state.
8771 /// Reading from this pointer when `result_ok` is not set is undefined.
8772 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
8773 /// A pointer to the contents in the error state.
8774 /// Reading from this pointer when `result_ok` is set is undefined.
8775 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8778 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8779 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
8780 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8781 pub struct CResult_FundingLockedDecodeErrorZ {
8782 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8783 /// `err` or `result` depending on the state of `result_ok`.
8784 pub contents: CResult_FundingLockedDecodeErrorZPtr,
8785 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8786 pub result_ok: bool,
8789 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8790 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
8791 CResult_FundingLockedDecodeErrorZ {
8792 contents: CResult_FundingLockedDecodeErrorZPtr {
8793 result: Box::into_raw(Box::new(o)),
8799 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8800 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
8801 CResult_FundingLockedDecodeErrorZ {
8802 contents: CResult_FundingLockedDecodeErrorZPtr {
8803 err: Box::into_raw(Box::new(e)),
8809 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
8810 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
8811 impl Drop for CResult_FundingLockedDecodeErrorZ {
8812 fn drop(&mut self) {
8814 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8815 let _ = unsafe { Box::from_raw(self.contents.result) };
8818 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8819 let _ = unsafe { Box::from_raw(self.contents.err) };
8824 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
8825 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
8826 let contents = if o.result_ok {
8827 let result = unsafe { o.contents.result };
8828 unsafe { o.contents.result = std::ptr::null_mut() };
8829 CResult_FundingLockedDecodeErrorZPtr { result }
8831 let err = unsafe { o.contents.err };
8832 unsafe { o.contents.err = std::ptr::null_mut(); }
8833 CResult_FundingLockedDecodeErrorZPtr { err }
8837 result_ok: o.result_ok,
8841 impl Clone for CResult_FundingLockedDecodeErrorZ {
8842 fn clone(&self) -> Self {
8844 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
8845 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
8848 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
8849 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8855 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
8856 /// but with all dynamically-allocated buffers duplicated in new buffers.
8857 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
8859 /// The contents of CResult_InitDecodeErrorZ
8860 pub union CResult_InitDecodeErrorZPtr {
8861 /// A pointer to the contents in the success state.
8862 /// Reading from this pointer when `result_ok` is not set is undefined.
8863 pub result: *mut crate::lightning::ln::msgs::Init,
8864 /// A pointer to the contents in the error state.
8865 /// Reading from this pointer when `result_ok` is set is undefined.
8866 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8869 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
8870 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
8871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8872 pub struct CResult_InitDecodeErrorZ {
8873 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
8874 /// `err` or `result` depending on the state of `result_ok`.
8875 pub contents: CResult_InitDecodeErrorZPtr,
8876 /// Whether this CResult_InitDecodeErrorZ represents a success state.
8877 pub result_ok: bool,
8880 /// Creates a new CResult_InitDecodeErrorZ in the success state.
8881 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
8882 CResult_InitDecodeErrorZ {
8883 contents: CResult_InitDecodeErrorZPtr {
8884 result: Box::into_raw(Box::new(o)),
8890 /// Creates a new CResult_InitDecodeErrorZ in the error state.
8891 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
8892 CResult_InitDecodeErrorZ {
8893 contents: CResult_InitDecodeErrorZPtr {
8894 err: Box::into_raw(Box::new(e)),
8900 /// Frees any resources used by the CResult_InitDecodeErrorZ.
8901 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
8902 impl Drop for CResult_InitDecodeErrorZ {
8903 fn drop(&mut self) {
8905 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8906 let _ = unsafe { Box::from_raw(self.contents.result) };
8909 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8910 let _ = unsafe { Box::from_raw(self.contents.err) };
8915 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
8916 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
8917 let contents = if o.result_ok {
8918 let result = unsafe { o.contents.result };
8919 unsafe { o.contents.result = std::ptr::null_mut() };
8920 CResult_InitDecodeErrorZPtr { result }
8922 let err = unsafe { o.contents.err };
8923 unsafe { o.contents.err = std::ptr::null_mut(); }
8924 CResult_InitDecodeErrorZPtr { err }
8928 result_ok: o.result_ok,
8932 impl Clone for CResult_InitDecodeErrorZ {
8933 fn clone(&self) -> Self {
8935 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
8936 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
8939 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
8940 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8946 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
8947 /// but with all dynamically-allocated buffers duplicated in new buffers.
8948 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
8950 /// The contents of CResult_OpenChannelDecodeErrorZ
8951 pub union CResult_OpenChannelDecodeErrorZPtr {
8952 /// A pointer to the contents in the success state.
8953 /// Reading from this pointer when `result_ok` is not set is undefined.
8954 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
8955 /// A pointer to the contents in the error state.
8956 /// Reading from this pointer when `result_ok` is set is undefined.
8957 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8960 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
8961 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8962 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8963 pub struct CResult_OpenChannelDecodeErrorZ {
8964 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
8965 /// `err` or `result` depending on the state of `result_ok`.
8966 pub contents: CResult_OpenChannelDecodeErrorZPtr,
8967 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
8968 pub result_ok: bool,
8971 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
8972 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
8973 CResult_OpenChannelDecodeErrorZ {
8974 contents: CResult_OpenChannelDecodeErrorZPtr {
8975 result: Box::into_raw(Box::new(o)),
8981 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
8982 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
8983 CResult_OpenChannelDecodeErrorZ {
8984 contents: CResult_OpenChannelDecodeErrorZPtr {
8985 err: Box::into_raw(Box::new(e)),
8991 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
8992 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
8993 impl Drop for CResult_OpenChannelDecodeErrorZ {
8994 fn drop(&mut self) {
8996 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8997 let _ = unsafe { Box::from_raw(self.contents.result) };
9000 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9001 let _ = unsafe { Box::from_raw(self.contents.err) };
9006 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9007 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9008 let contents = if o.result_ok {
9009 let result = unsafe { o.contents.result };
9010 unsafe { o.contents.result = std::ptr::null_mut() };
9011 CResult_OpenChannelDecodeErrorZPtr { result }
9013 let err = unsafe { o.contents.err };
9014 unsafe { o.contents.err = std::ptr::null_mut(); }
9015 CResult_OpenChannelDecodeErrorZPtr { err }
9019 result_ok: o.result_ok,
9023 impl Clone for CResult_OpenChannelDecodeErrorZ {
9024 fn clone(&self) -> Self {
9026 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9027 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9030 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9031 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9037 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9038 /// but with all dynamically-allocated buffers duplicated in new buffers.
9039 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
9041 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9042 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9043 /// A pointer to the contents in the success state.
9044 /// Reading from this pointer when `result_ok` is not set is undefined.
9045 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9046 /// A pointer to the contents in the error state.
9047 /// Reading from this pointer when `result_ok` is set is undefined.
9048 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9051 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9052 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9054 pub struct CResult_RevokeAndACKDecodeErrorZ {
9055 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9056 /// `err` or `result` depending on the state of `result_ok`.
9057 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9058 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9059 pub result_ok: bool,
9062 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9063 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9064 CResult_RevokeAndACKDecodeErrorZ {
9065 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9066 result: Box::into_raw(Box::new(o)),
9072 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9073 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9074 CResult_RevokeAndACKDecodeErrorZ {
9075 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9076 err: Box::into_raw(Box::new(e)),
9082 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9083 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9084 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9085 fn drop(&mut self) {
9087 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9088 let _ = unsafe { Box::from_raw(self.contents.result) };
9091 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9092 let _ = unsafe { Box::from_raw(self.contents.err) };
9097 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9098 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9099 let contents = if o.result_ok {
9100 let result = unsafe { o.contents.result };
9101 unsafe { o.contents.result = std::ptr::null_mut() };
9102 CResult_RevokeAndACKDecodeErrorZPtr { result }
9104 let err = unsafe { o.contents.err };
9105 unsafe { o.contents.err = std::ptr::null_mut(); }
9106 CResult_RevokeAndACKDecodeErrorZPtr { err }
9110 result_ok: o.result_ok,
9114 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9115 fn clone(&self) -> Self {
9117 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9118 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9121 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9122 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9128 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9129 /// but with all dynamically-allocated buffers duplicated in new buffers.
9130 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
9132 /// The contents of CResult_ShutdownDecodeErrorZ
9133 pub union CResult_ShutdownDecodeErrorZPtr {
9134 /// A pointer to the contents in the success state.
9135 /// Reading from this pointer when `result_ok` is not set is undefined.
9136 pub result: *mut crate::lightning::ln::msgs::Shutdown,
9137 /// A pointer to the contents in the error state.
9138 /// Reading from this pointer when `result_ok` is set is undefined.
9139 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9142 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9143 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9145 pub struct CResult_ShutdownDecodeErrorZ {
9146 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9147 /// `err` or `result` depending on the state of `result_ok`.
9148 pub contents: CResult_ShutdownDecodeErrorZPtr,
9149 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9150 pub result_ok: bool,
9153 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9154 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9155 CResult_ShutdownDecodeErrorZ {
9156 contents: CResult_ShutdownDecodeErrorZPtr {
9157 result: Box::into_raw(Box::new(o)),
9163 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9164 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
9165 CResult_ShutdownDecodeErrorZ {
9166 contents: CResult_ShutdownDecodeErrorZPtr {
9167 err: Box::into_raw(Box::new(e)),
9173 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9174 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
9175 impl Drop for CResult_ShutdownDecodeErrorZ {
9176 fn drop(&mut self) {
9178 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9179 let _ = unsafe { Box::from_raw(self.contents.result) };
9182 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9183 let _ = unsafe { Box::from_raw(self.contents.err) };
9188 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
9189 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
9190 let contents = if o.result_ok {
9191 let result = unsafe { o.contents.result };
9192 unsafe { o.contents.result = std::ptr::null_mut() };
9193 CResult_ShutdownDecodeErrorZPtr { result }
9195 let err = unsafe { o.contents.err };
9196 unsafe { o.contents.err = std::ptr::null_mut(); }
9197 CResult_ShutdownDecodeErrorZPtr { err }
9201 result_ok: o.result_ok,
9205 impl Clone for CResult_ShutdownDecodeErrorZ {
9206 fn clone(&self) -> Self {
9208 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
9209 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
9212 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
9213 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9219 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9220 /// but with all dynamically-allocated buffers duplicated in new buffers.
9221 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
9223 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
9224 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
9225 /// A pointer to the contents in the success state.
9226 /// Reading from this pointer when `result_ok` is not set is undefined.
9227 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9228 /// A pointer to the contents in the error state.
9229 /// Reading from this pointer when `result_ok` is set is undefined.
9230 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9233 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9234 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9236 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
9237 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9238 /// `err` or `result` depending on the state of `result_ok`.
9239 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
9240 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9241 pub result_ok: bool,
9244 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9245 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
9246 CResult_UpdateFailHTLCDecodeErrorZ {
9247 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9248 result: Box::into_raw(Box::new(o)),
9254 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9255 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
9256 CResult_UpdateFailHTLCDecodeErrorZ {
9257 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9258 err: Box::into_raw(Box::new(e)),
9264 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9265 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
9266 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
9267 fn drop(&mut self) {
9269 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9270 let _ = unsafe { Box::from_raw(self.contents.result) };
9273 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9274 let _ = unsafe { Box::from_raw(self.contents.err) };
9279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
9280 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9281 let contents = if o.result_ok {
9282 let result = unsafe { o.contents.result };
9283 unsafe { o.contents.result = std::ptr::null_mut() };
9284 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
9286 let err = unsafe { o.contents.err };
9287 unsafe { o.contents.err = std::ptr::null_mut(); }
9288 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
9292 result_ok: o.result_ok,
9296 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
9297 fn clone(&self) -> Self {
9299 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9300 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
9303 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9304 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9310 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9311 /// but with all dynamically-allocated buffers duplicated in new buffers.
9312 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
9314 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9315 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9316 /// A pointer to the contents in the success state.
9317 /// Reading from this pointer when `result_ok` is not set is undefined.
9318 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9319 /// A pointer to the contents in the error state.
9320 /// Reading from this pointer when `result_ok` is set is undefined.
9321 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9324 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9325 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9327 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9328 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9329 /// `err` or `result` depending on the state of `result_ok`.
9330 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
9331 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9332 pub result_ok: bool,
9335 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9336 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9337 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9338 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9339 result: Box::into_raw(Box::new(o)),
9345 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9346 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9347 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9348 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9349 err: Box::into_raw(Box::new(e)),
9355 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9356 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
9357 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9358 fn drop(&mut self) {
9360 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9361 let _ = unsafe { Box::from_raw(self.contents.result) };
9364 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9365 let _ = unsafe { Box::from_raw(self.contents.err) };
9370 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9371 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9372 let contents = if o.result_ok {
9373 let result = unsafe { o.contents.result };
9374 unsafe { o.contents.result = std::ptr::null_mut() };
9375 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
9377 let err = unsafe { o.contents.err };
9378 unsafe { o.contents.err = std::ptr::null_mut(); }
9379 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
9383 result_ok: o.result_ok,
9387 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9388 fn clone(&self) -> Self {
9390 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9391 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
9394 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9395 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9401 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9402 /// but with all dynamically-allocated buffers duplicated in new buffers.
9403 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
9405 /// The contents of CResult_UpdateFeeDecodeErrorZ
9406 pub union CResult_UpdateFeeDecodeErrorZPtr {
9407 /// A pointer to the contents in the success state.
9408 /// Reading from this pointer when `result_ok` is not set is undefined.
9409 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
9410 /// A pointer to the contents in the error state.
9411 /// Reading from this pointer when `result_ok` is set is undefined.
9412 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9415 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9416 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9417 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9418 pub struct CResult_UpdateFeeDecodeErrorZ {
9419 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9420 /// `err` or `result` depending on the state of `result_ok`.
9421 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
9422 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9423 pub result_ok: bool,
9426 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9427 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
9428 CResult_UpdateFeeDecodeErrorZ {
9429 contents: CResult_UpdateFeeDecodeErrorZPtr {
9430 result: Box::into_raw(Box::new(o)),
9436 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9437 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
9438 CResult_UpdateFeeDecodeErrorZ {
9439 contents: CResult_UpdateFeeDecodeErrorZPtr {
9440 err: Box::into_raw(Box::new(e)),
9446 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9447 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
9448 impl Drop for CResult_UpdateFeeDecodeErrorZ {
9449 fn drop(&mut self) {
9451 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9452 let _ = unsafe { Box::from_raw(self.contents.result) };
9455 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9456 let _ = unsafe { Box::from_raw(self.contents.err) };
9461 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
9462 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
9463 let contents = if o.result_ok {
9464 let result = unsafe { o.contents.result };
9465 unsafe { o.contents.result = std::ptr::null_mut() };
9466 CResult_UpdateFeeDecodeErrorZPtr { result }
9468 let err = unsafe { o.contents.err };
9469 unsafe { o.contents.err = std::ptr::null_mut(); }
9470 CResult_UpdateFeeDecodeErrorZPtr { err }
9474 result_ok: o.result_ok,
9478 impl Clone for CResult_UpdateFeeDecodeErrorZ {
9479 fn clone(&self) -> Self {
9481 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
9482 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
9485 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
9486 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9492 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9493 /// but with all dynamically-allocated buffers duplicated in new buffers.
9494 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
9496 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9497 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9498 /// A pointer to the contents in the success state.
9499 /// Reading from this pointer when `result_ok` is not set is undefined.
9500 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9501 /// A pointer to the contents in the error state.
9502 /// Reading from this pointer when `result_ok` is set is undefined.
9503 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9506 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9507 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9508 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9509 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
9510 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9511 /// `err` or `result` depending on the state of `result_ok`.
9512 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
9513 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9514 pub result_ok: bool,
9517 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9518 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9519 CResult_UpdateFulfillHTLCDecodeErrorZ {
9520 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9521 result: Box::into_raw(Box::new(o)),
9527 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9528 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9529 CResult_UpdateFulfillHTLCDecodeErrorZ {
9530 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9531 err: Box::into_raw(Box::new(e)),
9537 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9538 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
9539 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
9540 fn drop(&mut self) {
9542 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9543 let _ = unsafe { Box::from_raw(self.contents.result) };
9546 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9547 let _ = unsafe { Box::from_raw(self.contents.err) };
9552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
9553 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9554 let contents = if o.result_ok {
9555 let result = unsafe { o.contents.result };
9556 unsafe { o.contents.result = std::ptr::null_mut() };
9557 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
9559 let err = unsafe { o.contents.err };
9560 unsafe { o.contents.err = std::ptr::null_mut(); }
9561 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
9565 result_ok: o.result_ok,
9569 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
9570 fn clone(&self) -> Self {
9572 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9573 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
9576 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9577 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9583 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9584 /// but with all dynamically-allocated buffers duplicated in new buffers.
9585 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
9587 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
9588 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
9589 /// A pointer to the contents in the success state.
9590 /// Reading from this pointer when `result_ok` is not set is undefined.
9591 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9592 /// A pointer to the contents in the error state.
9593 /// Reading from this pointer when `result_ok` is set is undefined.
9594 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9597 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9598 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9600 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
9601 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9602 /// `err` or `result` depending on the state of `result_ok`.
9603 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
9604 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9605 pub result_ok: bool,
9608 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9609 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
9610 CResult_UpdateAddHTLCDecodeErrorZ {
9611 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9612 result: Box::into_raw(Box::new(o)),
9618 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9619 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
9620 CResult_UpdateAddHTLCDecodeErrorZ {
9621 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9622 err: Box::into_raw(Box::new(e)),
9628 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
9629 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
9630 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
9631 fn drop(&mut self) {
9633 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9634 let _ = unsafe { Box::from_raw(self.contents.result) };
9637 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9638 let _ = unsafe { Box::from_raw(self.contents.err) };
9643 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
9644 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9645 let contents = if o.result_ok {
9646 let result = unsafe { o.contents.result };
9647 unsafe { o.contents.result = std::ptr::null_mut() };
9648 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
9650 let err = unsafe { o.contents.err };
9651 unsafe { o.contents.err = std::ptr::null_mut(); }
9652 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
9656 result_ok: o.result_ok,
9660 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
9661 fn clone(&self) -> Self {
9663 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9664 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
9667 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9668 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9674 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9675 /// but with all dynamically-allocated buffers duplicated in new buffers.
9676 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
9678 /// The contents of CResult_PingDecodeErrorZ
9679 pub union CResult_PingDecodeErrorZPtr {
9680 /// A pointer to the contents in the success state.
9681 /// Reading from this pointer when `result_ok` is not set is undefined.
9682 pub result: *mut crate::lightning::ln::msgs::Ping,
9683 /// A pointer to the contents in the error state.
9684 /// Reading from this pointer when `result_ok` is set is undefined.
9685 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9688 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9689 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9691 pub struct CResult_PingDecodeErrorZ {
9692 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
9693 /// `err` or `result` depending on the state of `result_ok`.
9694 pub contents: CResult_PingDecodeErrorZPtr,
9695 /// Whether this CResult_PingDecodeErrorZ represents a success state.
9696 pub result_ok: bool,
9699 /// Creates a new CResult_PingDecodeErrorZ in the success state.
9700 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
9701 CResult_PingDecodeErrorZ {
9702 contents: CResult_PingDecodeErrorZPtr {
9703 result: Box::into_raw(Box::new(o)),
9709 /// Creates a new CResult_PingDecodeErrorZ in the error state.
9710 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
9711 CResult_PingDecodeErrorZ {
9712 contents: CResult_PingDecodeErrorZPtr {
9713 err: Box::into_raw(Box::new(e)),
9719 /// Frees any resources used by the CResult_PingDecodeErrorZ.
9720 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
9721 impl Drop for CResult_PingDecodeErrorZ {
9722 fn drop(&mut self) {
9724 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9725 let _ = unsafe { Box::from_raw(self.contents.result) };
9728 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9729 let _ = unsafe { Box::from_raw(self.contents.err) };
9734 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
9735 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
9736 let contents = if o.result_ok {
9737 let result = unsafe { o.contents.result };
9738 unsafe { o.contents.result = std::ptr::null_mut() };
9739 CResult_PingDecodeErrorZPtr { result }
9741 let err = unsafe { o.contents.err };
9742 unsafe { o.contents.err = std::ptr::null_mut(); }
9743 CResult_PingDecodeErrorZPtr { err }
9747 result_ok: o.result_ok,
9751 impl Clone for CResult_PingDecodeErrorZ {
9752 fn clone(&self) -> Self {
9754 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
9755 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
9758 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
9759 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9765 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
9766 /// but with all dynamically-allocated buffers duplicated in new buffers.
9767 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
9769 /// The contents of CResult_PongDecodeErrorZ
9770 pub union CResult_PongDecodeErrorZPtr {
9771 /// A pointer to the contents in the success state.
9772 /// Reading from this pointer when `result_ok` is not set is undefined.
9773 pub result: *mut crate::lightning::ln::msgs::Pong,
9774 /// A pointer to the contents in the error state.
9775 /// Reading from this pointer when `result_ok` is set is undefined.
9776 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9779 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9780 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9782 pub struct CResult_PongDecodeErrorZ {
9783 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
9784 /// `err` or `result` depending on the state of `result_ok`.
9785 pub contents: CResult_PongDecodeErrorZPtr,
9786 /// Whether this CResult_PongDecodeErrorZ represents a success state.
9787 pub result_ok: bool,
9790 /// Creates a new CResult_PongDecodeErrorZ in the success state.
9791 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
9792 CResult_PongDecodeErrorZ {
9793 contents: CResult_PongDecodeErrorZPtr {
9794 result: Box::into_raw(Box::new(o)),
9800 /// Creates a new CResult_PongDecodeErrorZ in the error state.
9801 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
9802 CResult_PongDecodeErrorZ {
9803 contents: CResult_PongDecodeErrorZPtr {
9804 err: Box::into_raw(Box::new(e)),
9810 /// Frees any resources used by the CResult_PongDecodeErrorZ.
9811 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
9812 impl Drop for CResult_PongDecodeErrorZ {
9813 fn drop(&mut self) {
9815 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9816 let _ = unsafe { Box::from_raw(self.contents.result) };
9819 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9820 let _ = unsafe { Box::from_raw(self.contents.err) };
9825 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
9826 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
9827 let contents = if o.result_ok {
9828 let result = unsafe { o.contents.result };
9829 unsafe { o.contents.result = std::ptr::null_mut() };
9830 CResult_PongDecodeErrorZPtr { result }
9832 let err = unsafe { o.contents.err };
9833 unsafe { o.contents.err = std::ptr::null_mut(); }
9834 CResult_PongDecodeErrorZPtr { err }
9838 result_ok: o.result_ok,
9842 impl Clone for CResult_PongDecodeErrorZ {
9843 fn clone(&self) -> Self {
9845 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
9846 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
9849 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
9850 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9856 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
9857 /// but with all dynamically-allocated buffers duplicated in new buffers.
9858 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
9860 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9861 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9862 /// A pointer to the contents in the success state.
9863 /// Reading from this pointer when `result_ok` is not set is undefined.
9864 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
9865 /// A pointer to the contents in the error state.
9866 /// Reading from this pointer when `result_ok` is set is undefined.
9867 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9870 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9871 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9872 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9873 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9874 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
9875 /// `err` or `result` depending on the state of `result_ok`.
9876 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
9877 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
9878 pub result_ok: bool,
9881 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
9882 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9883 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9884 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9885 result: Box::into_raw(Box::new(o)),
9891 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
9892 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9893 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9894 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9895 err: Box::into_raw(Box::new(e)),
9901 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
9902 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
9903 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9904 fn drop(&mut self) {
9906 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9907 let _ = unsafe { Box::from_raw(self.contents.result) };
9910 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9911 let _ = unsafe { Box::from_raw(self.contents.err) };
9916 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9917 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
9918 let contents = if o.result_ok {
9919 let result = unsafe { o.contents.result };
9920 unsafe { o.contents.result = std::ptr::null_mut() };
9921 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
9923 let err = unsafe { o.contents.err };
9924 unsafe { o.contents.err = std::ptr::null_mut(); }
9925 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
9929 result_ok: o.result_ok,
9933 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9934 fn clone(&self) -> Self {
9936 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9937 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
9940 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9941 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9947 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9948 /// but with all dynamically-allocated buffers duplicated in new buffers.
9949 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
9951 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
9952 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
9953 /// A pointer to the contents in the success state.
9954 /// Reading from this pointer when `result_ok` is not set is undefined.
9955 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
9956 /// A pointer to the contents in the error state.
9957 /// Reading from this pointer when `result_ok` is set is undefined.
9958 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9961 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9962 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9964 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
9965 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
9966 /// `err` or `result` depending on the state of `result_ok`.
9967 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
9968 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
9969 pub result_ok: bool,
9972 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
9973 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
9974 CResult_ChannelAnnouncementDecodeErrorZ {
9975 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
9976 result: Box::into_raw(Box::new(o)),
9982 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
9983 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
9984 CResult_ChannelAnnouncementDecodeErrorZ {
9985 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
9986 err: Box::into_raw(Box::new(e)),
9992 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
9993 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
9994 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
9995 fn drop(&mut self) {
9997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9998 let _ = unsafe { Box::from_raw(self.contents.result) };
10001 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10002 let _ = unsafe { Box::from_raw(self.contents.err) };
10007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10008 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10009 let contents = if o.result_ok {
10010 let result = unsafe { o.contents.result };
10011 unsafe { o.contents.result = std::ptr::null_mut() };
10012 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10014 let err = unsafe { o.contents.err };
10015 unsafe { o.contents.err = std::ptr::null_mut(); }
10016 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10020 result_ok: o.result_ok,
10024 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10025 fn clone(&self) -> Self {
10026 if self.result_ok {
10027 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10028 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10031 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10032 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10038 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10039 /// but with all dynamically-allocated buffers duplicated in new buffers.
10040 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
10042 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10043 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10044 /// A pointer to the contents in the success state.
10045 /// Reading from this pointer when `result_ok` is not set is undefined.
10046 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10047 /// A pointer to the contents in the error state.
10048 /// Reading from this pointer when `result_ok` is set is undefined.
10049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10052 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10053 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10055 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10056 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10057 /// `err` or `result` depending on the state of `result_ok`.
10058 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10059 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10060 pub result_ok: bool,
10063 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10064 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10065 CResult_UnsignedChannelUpdateDecodeErrorZ {
10066 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10067 result: Box::into_raw(Box::new(o)),
10073 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10074 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10075 CResult_UnsignedChannelUpdateDecodeErrorZ {
10076 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10077 err: Box::into_raw(Box::new(e)),
10083 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10084 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10085 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10086 fn drop(&mut self) {
10087 if self.result_ok {
10088 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10089 let _ = unsafe { Box::from_raw(self.contents.result) };
10092 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10093 let _ = unsafe { Box::from_raw(self.contents.err) };
10098 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10099 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10100 let contents = if o.result_ok {
10101 let result = unsafe { o.contents.result };
10102 unsafe { o.contents.result = std::ptr::null_mut() };
10103 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10105 let err = unsafe { o.contents.err };
10106 unsafe { o.contents.err = std::ptr::null_mut(); }
10107 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10111 result_ok: o.result_ok,
10115 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10116 fn clone(&self) -> Self {
10117 if self.result_ok {
10118 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10119 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10122 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10123 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10129 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10130 /// but with all dynamically-allocated buffers duplicated in new buffers.
10131 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
10133 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10134 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10135 /// A pointer to the contents in the success state.
10136 /// Reading from this pointer when `result_ok` is not set is undefined.
10137 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10138 /// A pointer to the contents in the error state.
10139 /// Reading from this pointer when `result_ok` is set is undefined.
10140 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10143 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10144 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10146 pub struct CResult_ChannelUpdateDecodeErrorZ {
10147 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10148 /// `err` or `result` depending on the state of `result_ok`.
10149 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10150 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10151 pub result_ok: bool,
10154 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10155 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10156 CResult_ChannelUpdateDecodeErrorZ {
10157 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10158 result: Box::into_raw(Box::new(o)),
10164 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10165 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
10166 CResult_ChannelUpdateDecodeErrorZ {
10167 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10168 err: Box::into_raw(Box::new(e)),
10174 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10175 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
10176 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
10177 fn drop(&mut self) {
10178 if self.result_ok {
10179 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10180 let _ = unsafe { Box::from_raw(self.contents.result) };
10183 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10184 let _ = unsafe { Box::from_raw(self.contents.err) };
10189 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
10190 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10191 let contents = if o.result_ok {
10192 let result = unsafe { o.contents.result };
10193 unsafe { o.contents.result = std::ptr::null_mut() };
10194 CResult_ChannelUpdateDecodeErrorZPtr { result }
10196 let err = unsafe { o.contents.err };
10197 unsafe { o.contents.err = std::ptr::null_mut(); }
10198 CResult_ChannelUpdateDecodeErrorZPtr { err }
10202 result_ok: o.result_ok,
10206 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
10207 fn clone(&self) -> Self {
10208 if self.result_ok {
10209 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10210 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
10213 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10214 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10220 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10221 /// but with all dynamically-allocated buffers duplicated in new buffers.
10222 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
10224 /// The contents of CResult_ErrorMessageDecodeErrorZ
10225 pub union CResult_ErrorMessageDecodeErrorZPtr {
10226 /// A pointer to the contents in the success state.
10227 /// Reading from this pointer when `result_ok` is not set is undefined.
10228 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
10229 /// A pointer to the contents in the error state.
10230 /// Reading from this pointer when `result_ok` is set is undefined.
10231 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10234 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10235 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10237 pub struct CResult_ErrorMessageDecodeErrorZ {
10238 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10239 /// `err` or `result` depending on the state of `result_ok`.
10240 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
10241 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10242 pub result_ok: bool,
10245 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10246 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
10247 CResult_ErrorMessageDecodeErrorZ {
10248 contents: CResult_ErrorMessageDecodeErrorZPtr {
10249 result: Box::into_raw(Box::new(o)),
10255 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10256 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
10257 CResult_ErrorMessageDecodeErrorZ {
10258 contents: CResult_ErrorMessageDecodeErrorZPtr {
10259 err: Box::into_raw(Box::new(e)),
10265 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10266 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
10267 impl Drop for CResult_ErrorMessageDecodeErrorZ {
10268 fn drop(&mut self) {
10269 if self.result_ok {
10270 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10271 let _ = unsafe { Box::from_raw(self.contents.result) };
10274 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10275 let _ = unsafe { Box::from_raw(self.contents.err) };
10280 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
10281 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
10282 let contents = if o.result_ok {
10283 let result = unsafe { o.contents.result };
10284 unsafe { o.contents.result = std::ptr::null_mut() };
10285 CResult_ErrorMessageDecodeErrorZPtr { result }
10287 let err = unsafe { o.contents.err };
10288 unsafe { o.contents.err = std::ptr::null_mut(); }
10289 CResult_ErrorMessageDecodeErrorZPtr { err }
10293 result_ok: o.result_ok,
10297 impl Clone for CResult_ErrorMessageDecodeErrorZ {
10298 fn clone(&self) -> Self {
10299 if self.result_ok {
10300 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
10301 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
10304 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
10305 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10311 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10312 /// but with all dynamically-allocated buffers duplicated in new buffers.
10313 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
10315 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10316 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10317 /// A pointer to the contents in the success state.
10318 /// Reading from this pointer when `result_ok` is not set is undefined.
10319 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
10320 /// A pointer to the contents in the error state.
10321 /// Reading from this pointer when `result_ok` is set is undefined.
10322 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10325 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10326 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10328 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10329 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10330 /// `err` or `result` depending on the state of `result_ok`.
10331 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
10332 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10333 pub result_ok: bool,
10336 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10337 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10338 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10339 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10340 result: Box::into_raw(Box::new(o)),
10346 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10347 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10348 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10349 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10350 err: Box::into_raw(Box::new(e)),
10356 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10357 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
10358 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10359 fn drop(&mut self) {
10360 if self.result_ok {
10361 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10362 let _ = unsafe { Box::from_raw(self.contents.result) };
10365 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10366 let _ = unsafe { Box::from_raw(self.contents.err) };
10371 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10372 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10373 let contents = if o.result_ok {
10374 let result = unsafe { o.contents.result };
10375 unsafe { o.contents.result = std::ptr::null_mut() };
10376 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
10378 let err = unsafe { o.contents.err };
10379 unsafe { o.contents.err = std::ptr::null_mut(); }
10380 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
10384 result_ok: o.result_ok,
10388 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10389 fn clone(&self) -> Self {
10390 if self.result_ok {
10391 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10392 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10395 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10396 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10402 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10403 /// but with all dynamically-allocated buffers duplicated in new buffers.
10404 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
10406 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
10407 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
10408 /// A pointer to the contents in the success state.
10409 /// Reading from this pointer when `result_ok` is not set is undefined.
10410 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10411 /// A pointer to the contents in the error state.
10412 /// Reading from this pointer when `result_ok` is set is undefined.
10413 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10416 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10417 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10419 pub struct CResult_NodeAnnouncementDecodeErrorZ {
10420 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10421 /// `err` or `result` depending on the state of `result_ok`.
10422 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
10423 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10424 pub result_ok: bool,
10427 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10428 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
10429 CResult_NodeAnnouncementDecodeErrorZ {
10430 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10431 result: Box::into_raw(Box::new(o)),
10437 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10438 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
10439 CResult_NodeAnnouncementDecodeErrorZ {
10440 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10441 err: Box::into_raw(Box::new(e)),
10447 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10448 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
10449 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
10450 fn drop(&mut self) {
10451 if self.result_ok {
10452 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10453 let _ = unsafe { Box::from_raw(self.contents.result) };
10456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10457 let _ = unsafe { Box::from_raw(self.contents.err) };
10462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
10463 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10464 let contents = if o.result_ok {
10465 let result = unsafe { o.contents.result };
10466 unsafe { o.contents.result = std::ptr::null_mut() };
10467 CResult_NodeAnnouncementDecodeErrorZPtr { result }
10469 let err = unsafe { o.contents.err };
10470 unsafe { o.contents.err = std::ptr::null_mut(); }
10471 CResult_NodeAnnouncementDecodeErrorZPtr { err }
10475 result_ok: o.result_ok,
10479 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
10480 fn clone(&self) -> Self {
10481 if self.result_ok {
10482 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10483 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10486 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10487 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10493 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10494 /// but with all dynamically-allocated buffers duplicated in new buffers.
10495 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
10497 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10498 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
10499 /// A pointer to the contents in the success state.
10500 /// Reading from this pointer when `result_ok` is not set is undefined.
10501 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
10502 /// A pointer to the contents in the error state.
10503 /// Reading from this pointer when `result_ok` is set is undefined.
10504 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10507 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10508 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10510 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
10511 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10512 /// `err` or `result` depending on the state of `result_ok`.
10513 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
10514 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10515 pub result_ok: bool,
10518 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10519 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10520 CResult_QueryShortChannelIdsDecodeErrorZ {
10521 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10522 result: Box::into_raw(Box::new(o)),
10528 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10529 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10530 CResult_QueryShortChannelIdsDecodeErrorZ {
10531 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10532 err: Box::into_raw(Box::new(e)),
10538 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10539 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
10540 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
10541 fn drop(&mut self) {
10542 if self.result_ok {
10543 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10544 let _ = unsafe { Box::from_raw(self.contents.result) };
10547 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10548 let _ = unsafe { Box::from_raw(self.contents.err) };
10553 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
10554 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
10555 let contents = if o.result_ok {
10556 let result = unsafe { o.contents.result };
10557 unsafe { o.contents.result = std::ptr::null_mut() };
10558 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
10560 let err = unsafe { o.contents.err };
10561 unsafe { o.contents.err = std::ptr::null_mut(); }
10562 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
10566 result_ok: o.result_ok,
10570 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
10571 fn clone(&self) -> Self {
10572 if self.result_ok {
10573 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10574 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
10577 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10578 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10584 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10585 /// but with all dynamically-allocated buffers duplicated in new buffers.
10586 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
10588 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10589 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10590 /// A pointer to the contents in the success state.
10591 /// Reading from this pointer when `result_ok` is not set is undefined.
10592 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
10593 /// A pointer to the contents in the error state.
10594 /// Reading from this pointer when `result_ok` is set is undefined.
10595 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10598 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10599 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10601 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10602 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10603 /// `err` or `result` depending on the state of `result_ok`.
10604 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
10605 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10606 pub result_ok: bool,
10609 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10610 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10611 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10612 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10613 result: Box::into_raw(Box::new(o)),
10619 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10620 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10621 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10622 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10623 err: Box::into_raw(Box::new(e)),
10629 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10630 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
10631 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10632 fn drop(&mut self) {
10633 if self.result_ok {
10634 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10635 let _ = unsafe { Box::from_raw(self.contents.result) };
10638 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10639 let _ = unsafe { Box::from_raw(self.contents.err) };
10644 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10645 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
10646 let contents = if o.result_ok {
10647 let result = unsafe { o.contents.result };
10648 unsafe { o.contents.result = std::ptr::null_mut() };
10649 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
10651 let err = unsafe { o.contents.err };
10652 unsafe { o.contents.err = std::ptr::null_mut(); }
10653 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
10657 result_ok: o.result_ok,
10661 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10662 fn clone(&self) -> Self {
10663 if self.result_ok {
10664 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10665 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
10668 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10669 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10675 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10676 /// but with all dynamically-allocated buffers duplicated in new buffers.
10677 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
10679 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
10680 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
10681 /// A pointer to the contents in the success state.
10682 /// Reading from this pointer when `result_ok` is not set is undefined.
10683 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
10684 /// A pointer to the contents in the error state.
10685 /// Reading from this pointer when `result_ok` is set is undefined.
10686 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10689 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10690 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10692 pub struct CResult_QueryChannelRangeDecodeErrorZ {
10693 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10694 /// `err` or `result` depending on the state of `result_ok`.
10695 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
10696 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10697 pub result_ok: bool,
10700 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10701 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
10702 CResult_QueryChannelRangeDecodeErrorZ {
10703 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10704 result: Box::into_raw(Box::new(o)),
10710 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10711 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
10712 CResult_QueryChannelRangeDecodeErrorZ {
10713 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10714 err: Box::into_raw(Box::new(e)),
10720 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10721 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
10722 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
10723 fn drop(&mut self) {
10724 if self.result_ok {
10725 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10726 let _ = unsafe { Box::from_raw(self.contents.result) };
10729 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10730 let _ = unsafe { Box::from_raw(self.contents.err) };
10735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
10736 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10737 let contents = if o.result_ok {
10738 let result = unsafe { o.contents.result };
10739 unsafe { o.contents.result = std::ptr::null_mut() };
10740 CResult_QueryChannelRangeDecodeErrorZPtr { result }
10742 let err = unsafe { o.contents.err };
10743 unsafe { o.contents.err = std::ptr::null_mut(); }
10744 CResult_QueryChannelRangeDecodeErrorZPtr { err }
10748 result_ok: o.result_ok,
10752 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
10753 fn clone(&self) -> Self {
10754 if self.result_ok {
10755 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10756 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
10759 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10760 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10766 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10767 /// but with all dynamically-allocated buffers duplicated in new buffers.
10768 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
10770 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
10771 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
10772 /// A pointer to the contents in the success state.
10773 /// Reading from this pointer when `result_ok` is not set is undefined.
10774 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
10775 /// A pointer to the contents in the error state.
10776 /// Reading from this pointer when `result_ok` is set is undefined.
10777 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10780 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10781 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10783 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
10784 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10785 /// `err` or `result` depending on the state of `result_ok`.
10786 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
10787 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10788 pub result_ok: bool,
10791 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10792 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
10793 CResult_ReplyChannelRangeDecodeErrorZ {
10794 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10795 result: Box::into_raw(Box::new(o)),
10801 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10802 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
10803 CResult_ReplyChannelRangeDecodeErrorZ {
10804 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10805 err: Box::into_raw(Box::new(e)),
10811 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10812 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
10813 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
10814 fn drop(&mut self) {
10815 if self.result_ok {
10816 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10817 let _ = unsafe { Box::from_raw(self.contents.result) };
10820 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10821 let _ = unsafe { Box::from_raw(self.contents.err) };
10826 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
10827 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10828 let contents = if o.result_ok {
10829 let result = unsafe { o.contents.result };
10830 unsafe { o.contents.result = std::ptr::null_mut() };
10831 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
10833 let err = unsafe { o.contents.err };
10834 unsafe { o.contents.err = std::ptr::null_mut(); }
10835 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
10839 result_ok: o.result_ok,
10843 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
10844 fn clone(&self) -> Self {
10845 if self.result_ok {
10846 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10847 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
10850 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10851 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10857 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10858 /// but with all dynamically-allocated buffers duplicated in new buffers.
10859 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
10861 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
10862 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
10863 /// A pointer to the contents in the success state.
10864 /// Reading from this pointer when `result_ok` is not set is undefined.
10865 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
10866 /// A pointer to the contents in the error state.
10867 /// Reading from this pointer when `result_ok` is set is undefined.
10868 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10871 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10872 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10874 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
10875 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10876 /// `err` or `result` depending on the state of `result_ok`.
10877 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
10878 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10879 pub result_ok: bool,
10882 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10883 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
10884 CResult_GossipTimestampFilterDecodeErrorZ {
10885 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10886 result: Box::into_raw(Box::new(o)),
10892 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10893 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
10894 CResult_GossipTimestampFilterDecodeErrorZ {
10895 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10896 err: Box::into_raw(Box::new(e)),
10902 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
10903 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
10904 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
10905 fn drop(&mut self) {
10906 if self.result_ok {
10907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10908 let _ = unsafe { Box::from_raw(self.contents.result) };
10911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10912 let _ = unsafe { Box::from_raw(self.contents.err) };
10917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
10918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
10919 let contents = if o.result_ok {
10920 let result = unsafe { o.contents.result };
10921 unsafe { o.contents.result = std::ptr::null_mut() };
10922 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
10924 let err = unsafe { o.contents.err };
10925 unsafe { o.contents.err = std::ptr::null_mut(); }
10926 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
10930 result_ok: o.result_ok,
10934 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
10935 fn clone(&self) -> Self {
10936 if self.result_ok {
10937 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10938 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
10941 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10942 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10948 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10949 /// but with all dynamically-allocated buffers duplicated in new buffers.
10950 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
10952 /// The contents of CResult_InvoiceSignOrCreationErrorZ
10953 pub union CResult_InvoiceSignOrCreationErrorZPtr {
10954 /// A pointer to the contents in the success state.
10955 /// Reading from this pointer when `result_ok` is not set is undefined.
10956 pub result: *mut crate::lightning_invoice::Invoice,
10957 /// A pointer to the contents in the error state.
10958 /// Reading from this pointer when `result_ok` is set is undefined.
10959 pub err: *mut crate::lightning_invoice::SignOrCreationError,
10962 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10963 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10965 pub struct CResult_InvoiceSignOrCreationErrorZ {
10966 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10967 /// `err` or `result` depending on the state of `result_ok`.
10968 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
10969 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10970 pub result_ok: bool,
10973 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
10974 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
10975 CResult_InvoiceSignOrCreationErrorZ {
10976 contents: CResult_InvoiceSignOrCreationErrorZPtr {
10977 result: Box::into_raw(Box::new(o)),
10983 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
10984 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
10985 CResult_InvoiceSignOrCreationErrorZ {
10986 contents: CResult_InvoiceSignOrCreationErrorZPtr {
10987 err: Box::into_raw(Box::new(e)),
10993 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
10994 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
10995 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
10996 fn drop(&mut self) {
10997 if self.result_ok {
10998 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10999 let _ = unsafe { Box::from_raw(self.contents.result) };
11002 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11003 let _ = unsafe { Box::from_raw(self.contents.err) };
11008 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11009 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11010 let contents = if o.result_ok {
11011 let result = unsafe { o.contents.result };
11012 unsafe { o.contents.result = std::ptr::null_mut() };
11013 CResult_InvoiceSignOrCreationErrorZPtr { result }
11015 let err = unsafe { o.contents.err };
11016 unsafe { o.contents.err = std::ptr::null_mut(); }
11017 CResult_InvoiceSignOrCreationErrorZPtr { err }
11021 result_ok: o.result_ok,
11025 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11026 fn clone(&self) -> Self {
11027 if self.result_ok {
11028 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11029 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11032 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11033 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11039 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11040 /// but with all dynamically-allocated buffers duplicated in new buffers.
11041 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }