2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4 /// A pointer to the contents in the success state.
5 /// Reading from this pointer when `result_ok` is not set is undefined.
6 pub result: *mut crate::c_types::SecretKey,
7 /// A pointer to the contents in the error state.
8 /// Reading from this pointer when `result_ok` is set is undefined.
9 pub err: *mut crate::c_types::Secp256k1Error,
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17 /// `err` or `result` depending on the state of `result_ok`.
18 pub contents: CResult_SecretKeyErrorZPtr,
19 /// Whether this CResult_SecretKeyErrorZ represents a success state.
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25 CResult_SecretKeyErrorZ {
26 contents: CResult_SecretKeyErrorZPtr {
27 result: Box::into_raw(Box::new(o)),
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35 CResult_SecretKeyErrorZ {
36 contents: CResult_SecretKeyErrorZPtr {
37 err: Box::into_raw(Box::new(e)),
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
48 if unsafe { !(self.contents.result as *mut ()).is_null() } {
49 let _ = unsafe { Box::from_raw(self.contents.result) };
52 if unsafe { !(self.contents.err as *mut ()).is_null() } {
53 let _ = unsafe { Box::from_raw(self.contents.err) };
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60 let contents = if o.result_ok {
61 let result = unsafe { o.contents.result };
62 unsafe { o.contents.result = std::ptr::null_mut() };
63 CResult_SecretKeyErrorZPtr { result }
65 let err = unsafe { o.contents.err };
66 unsafe { o.contents.err = std::ptr::null_mut(); }
67 CResult_SecretKeyErrorZPtr { err }
71 result_ok: o.result_ok,
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78 /// A pointer to the contents in the success state.
79 /// Reading from this pointer when `result_ok` is not set is undefined.
80 pub result: *mut crate::c_types::PublicKey,
81 /// A pointer to the contents in the error state.
82 /// Reading from this pointer when `result_ok` is set is undefined.
83 pub err: *mut crate::c_types::Secp256k1Error,
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91 /// `err` or `result` depending on the state of `result_ok`.
92 pub contents: CResult_PublicKeyErrorZPtr,
93 /// Whether this CResult_PublicKeyErrorZ represents a success state.
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99 CResult_PublicKeyErrorZ {
100 contents: CResult_PublicKeyErrorZPtr {
101 result: Box::into_raw(Box::new(o)),
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109 CResult_PublicKeyErrorZ {
110 contents: CResult_PublicKeyErrorZPtr {
111 err: Box::into_raw(Box::new(e)),
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
123 let _ = unsafe { Box::from_raw(self.contents.result) };
126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
127 let _ = unsafe { Box::from_raw(self.contents.err) };
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134 let contents = if o.result_ok {
135 let result = unsafe { o.contents.result };
136 unsafe { o.contents.result = std::ptr::null_mut() };
137 CResult_PublicKeyErrorZPtr { result }
139 let err = unsafe { o.contents.err };
140 unsafe { o.contents.err = std::ptr::null_mut(); }
141 CResult_PublicKeyErrorZPtr { err }
145 result_ok: o.result_ok,
149 impl Clone for CResult_PublicKeyErrorZ {
150 fn clone(&self) -> Self {
152 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
153 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
156 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
157 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
163 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
164 /// but with all dynamically-allocated buffers duplicated in new buffers.
165 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { orig.clone() }
167 /// The contents of CResult_TxCreationKeysDecodeErrorZ
168 pub union CResult_TxCreationKeysDecodeErrorZPtr {
169 /// A pointer to the contents in the success state.
170 /// Reading from this pointer when `result_ok` is not set is undefined.
171 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
172 /// A pointer to the contents in the error state.
173 /// Reading from this pointer when `result_ok` is set is undefined.
174 pub err: *mut crate::lightning::ln::msgs::DecodeError,
177 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
178 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
180 pub struct CResult_TxCreationKeysDecodeErrorZ {
181 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
182 /// `err` or `result` depending on the state of `result_ok`.
183 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
184 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
188 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
189 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
190 CResult_TxCreationKeysDecodeErrorZ {
191 contents: CResult_TxCreationKeysDecodeErrorZPtr {
192 result: Box::into_raw(Box::new(o)),
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
200 CResult_TxCreationKeysDecodeErrorZ {
201 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202 err: Box::into_raw(Box::new(e)),
208 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
210 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
214 let _ = unsafe { Box::from_raw(self.contents.result) };
217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
218 let _ = unsafe { Box::from_raw(self.contents.err) };
223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
225 let contents = if o.result_ok {
226 let result = unsafe { o.contents.result };
227 unsafe { o.contents.result = std::ptr::null_mut() };
228 CResult_TxCreationKeysDecodeErrorZPtr { result }
230 let err = unsafe { o.contents.err };
231 unsafe { o.contents.err = std::ptr::null_mut(); }
232 CResult_TxCreationKeysDecodeErrorZPtr { err }
236 result_ok: o.result_ok,
240 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
241 fn clone(&self) -> Self {
243 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
244 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
247 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
254 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
255 /// but with all dynamically-allocated buffers duplicated in new buffers.
256 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { orig.clone() }
258 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
259 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
260 /// A pointer to the contents in the success state.
261 /// Reading from this pointer when `result_ok` is not set is undefined.
262 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
263 /// A pointer to the contents in the error state.
264 /// Reading from this pointer when `result_ok` is set is undefined.
265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
268 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
269 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
272 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
273 /// `err` or `result` depending on the state of `result_ok`.
274 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
275 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
279 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
280 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
281 CResult_ChannelPublicKeysDecodeErrorZ {
282 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
283 result: Box::into_raw(Box::new(o)),
289 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
290 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
291 CResult_ChannelPublicKeysDecodeErrorZ {
292 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
293 err: Box::into_raw(Box::new(e)),
299 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
300 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
301 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
305 let _ = unsafe { Box::from_raw(self.contents.result) };
308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
309 let _ = unsafe { Box::from_raw(self.contents.err) };
314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
315 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
316 let contents = if o.result_ok {
317 let result = unsafe { o.contents.result };
318 unsafe { o.contents.result = std::ptr::null_mut() };
319 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
321 let err = unsafe { o.contents.err };
322 unsafe { o.contents.err = std::ptr::null_mut(); }
323 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
327 result_ok: o.result_ok,
331 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
332 fn clone(&self) -> Self {
334 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
335 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
338 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
345 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
346 /// but with all dynamically-allocated buffers duplicated in new buffers.
347 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { orig.clone() }
349 /// The contents of CResult_TxCreationKeysErrorZ
350 pub union CResult_TxCreationKeysErrorZPtr {
351 /// A pointer to the contents in the success state.
352 /// Reading from this pointer when `result_ok` is not set is undefined.
353 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
354 /// A pointer to the contents in the error state.
355 /// Reading from this pointer when `result_ok` is set is undefined.
356 pub err: *mut crate::c_types::Secp256k1Error,
359 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
360 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
362 pub struct CResult_TxCreationKeysErrorZ {
363 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
364 /// `err` or `result` depending on the state of `result_ok`.
365 pub contents: CResult_TxCreationKeysErrorZPtr,
366 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
370 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
371 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
372 CResult_TxCreationKeysErrorZ {
373 contents: CResult_TxCreationKeysErrorZPtr {
374 result: Box::into_raw(Box::new(o)),
380 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
381 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
382 CResult_TxCreationKeysErrorZ {
383 contents: CResult_TxCreationKeysErrorZPtr {
384 err: Box::into_raw(Box::new(e)),
390 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
392 impl Drop for CResult_TxCreationKeysErrorZ {
395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
396 let _ = unsafe { Box::from_raw(self.contents.result) };
399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
400 let _ = unsafe { Box::from_raw(self.contents.err) };
405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
407 let contents = if o.result_ok {
408 let result = unsafe { o.contents.result };
409 unsafe { o.contents.result = std::ptr::null_mut() };
410 CResult_TxCreationKeysErrorZPtr { result }
412 let err = unsafe { o.contents.err };
413 unsafe { o.contents.err = std::ptr::null_mut(); }
414 CResult_TxCreationKeysErrorZPtr { err }
418 result_ok: o.result_ok,
422 impl Clone for CResult_TxCreationKeysErrorZ {
423 fn clone(&self) -> Self {
425 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
426 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
429 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
430 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
436 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
437 /// but with all dynamically-allocated buffers duplicated in new buffers.
438 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { orig.clone() }
441 /// An enum which can either contain a u32 or not
442 pub enum COption_u32Z {
443 /// When we're in this state, this COption_u32Z contains a u32
445 /// When we're in this state, this COption_u32Z contains nothing
449 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
450 if let Self::Some(_) = self { true } else { false }
452 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
453 if let Self::Some(v) = self { v } else { unreachable!() }
457 /// Constructs a new COption_u32Z containing a u32
458 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
459 COption_u32Z::Some(o)
462 /// Constructs a new COption_u32Z containing nothing
463 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
467 /// Frees any resources associated with the u32, if we are in the Some state
468 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
470 /// Creates a new COption_u32Z which has the same data as `orig`
471 /// but with all dynamically-allocated buffers duplicated in new buffers.
472 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { orig.clone() }
474 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
475 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
476 /// A pointer to the contents in the success state.
477 /// Reading from this pointer when `result_ok` is not set is undefined.
478 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
479 /// A pointer to the contents in the error state.
480 /// Reading from this pointer when `result_ok` is set is undefined.
481 pub err: *mut crate::lightning::ln::msgs::DecodeError,
484 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
485 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
487 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
488 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
489 /// `err` or `result` depending on the state of `result_ok`.
490 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
491 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
495 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
496 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
497 CResult_HTLCOutputInCommitmentDecodeErrorZ {
498 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
499 result: Box::into_raw(Box::new(o)),
505 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
506 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
507 CResult_HTLCOutputInCommitmentDecodeErrorZ {
508 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
509 err: Box::into_raw(Box::new(e)),
515 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
516 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
517 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
521 let _ = unsafe { Box::from_raw(self.contents.result) };
524 if unsafe { !(self.contents.err as *mut ()).is_null() } {
525 let _ = unsafe { Box::from_raw(self.contents.err) };
530 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
531 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
532 let contents = if o.result_ok {
533 let result = unsafe { o.contents.result };
534 unsafe { o.contents.result = std::ptr::null_mut() };
535 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
537 let err = unsafe { o.contents.err };
538 unsafe { o.contents.err = std::ptr::null_mut(); }
539 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
543 result_ok: o.result_ok,
547 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
548 fn clone(&self) -> Self {
550 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
551 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
554 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
555 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
561 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
562 /// but with all dynamically-allocated buffers duplicated in new buffers.
563 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
565 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
566 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
567 /// A pointer to the contents in the success state.
568 /// Reading from this pointer when `result_ok` is not set is undefined.
569 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
570 /// A pointer to the contents in the error state.
571 /// Reading from this pointer when `result_ok` is set is undefined.
572 pub err: *mut crate::lightning::ln::msgs::DecodeError,
575 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
576 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
578 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
579 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
580 /// `err` or `result` depending on the state of `result_ok`.
581 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
582 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
586 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
587 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
588 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
589 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
590 result: Box::into_raw(Box::new(o)),
596 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
597 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
598 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
599 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
600 err: Box::into_raw(Box::new(e)),
606 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
607 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
608 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
611 if unsafe { !(self.contents.result as *mut ()).is_null() } {
612 let _ = unsafe { Box::from_raw(self.contents.result) };
615 if unsafe { !(self.contents.err as *mut ()).is_null() } {
616 let _ = unsafe { Box::from_raw(self.contents.err) };
621 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
622 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
623 let contents = if o.result_ok {
624 let result = unsafe { o.contents.result };
625 unsafe { o.contents.result = std::ptr::null_mut() };
626 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
628 let err = unsafe { o.contents.err };
629 unsafe { o.contents.err = std::ptr::null_mut(); }
630 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
634 result_ok: o.result_ok,
638 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
639 fn clone(&self) -> Self {
641 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
642 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
645 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
646 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
652 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
653 /// but with all dynamically-allocated buffers duplicated in new buffers.
654 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
656 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
657 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
658 /// A pointer to the contents in the success state.
659 /// Reading from this pointer when `result_ok` is not set is undefined.
660 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
661 /// A pointer to the contents in the error state.
662 /// Reading from this pointer when `result_ok` is set is undefined.
663 pub err: *mut crate::lightning::ln::msgs::DecodeError,
666 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
667 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
669 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
670 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
671 /// `err` or `result` depending on the state of `result_ok`.
672 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
673 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
677 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
678 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
679 CResult_ChannelTransactionParametersDecodeErrorZ {
680 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
681 result: Box::into_raw(Box::new(o)),
687 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
688 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
689 CResult_ChannelTransactionParametersDecodeErrorZ {
690 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
691 err: Box::into_raw(Box::new(e)),
697 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
698 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
699 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
703 let _ = unsafe { Box::from_raw(self.contents.result) };
706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
707 let _ = unsafe { Box::from_raw(self.contents.err) };
712 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
713 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
714 let contents = if o.result_ok {
715 let result = unsafe { o.contents.result };
716 unsafe { o.contents.result = std::ptr::null_mut() };
717 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
719 let err = unsafe { o.contents.err };
720 unsafe { o.contents.err = std::ptr::null_mut(); }
721 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
725 result_ok: o.result_ok,
729 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
730 fn clone(&self) -> Self {
732 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
733 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
736 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
737 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
743 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
744 /// but with all dynamically-allocated buffers duplicated in new buffers.
745 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
747 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
748 /// This corresponds to std::vector in C++
749 pub struct CVec_SignatureZ {
750 /// The elements in the array.
751 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
752 pub data: *mut crate::c_types::Signature,
753 /// The number of elements pointed to by `data`.
756 impl CVec_SignatureZ {
757 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
758 if self.datalen == 0 { return Vec::new(); }
759 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
760 self.data = std::ptr::null_mut();
764 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
765 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
768 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
769 fn from(v: Vec<crate::c_types::Signature>) -> Self {
770 let datalen = v.len();
771 let data = Box::into_raw(v.into_boxed_slice());
772 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
776 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
777 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
778 impl Drop for CVec_SignatureZ {
780 if self.datalen == 0 { return; }
781 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
784 impl Clone for CVec_SignatureZ {
785 fn clone(&self) -> Self {
786 let mut res = Vec::new();
787 if self.datalen == 0 { return Self::from(res); }
788 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
793 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
794 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
795 /// A pointer to the contents in the success state.
796 /// Reading from this pointer when `result_ok` is not set is undefined.
797 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
798 /// A pointer to the contents in the error state.
799 /// Reading from this pointer when `result_ok` is set is undefined.
800 pub err: *mut crate::lightning::ln::msgs::DecodeError,
803 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
804 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
806 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
807 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
808 /// `err` or `result` depending on the state of `result_ok`.
809 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
810 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
814 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
815 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
816 CResult_HolderCommitmentTransactionDecodeErrorZ {
817 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
818 result: Box::into_raw(Box::new(o)),
824 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
825 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
826 CResult_HolderCommitmentTransactionDecodeErrorZ {
827 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
828 err: Box::into_raw(Box::new(e)),
834 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
835 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
836 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
839 if unsafe { !(self.contents.result as *mut ()).is_null() } {
840 let _ = unsafe { Box::from_raw(self.contents.result) };
843 if unsafe { !(self.contents.err as *mut ()).is_null() } {
844 let _ = unsafe { Box::from_raw(self.contents.err) };
849 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
850 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
851 let contents = if o.result_ok {
852 let result = unsafe { o.contents.result };
853 unsafe { o.contents.result = std::ptr::null_mut() };
854 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
856 let err = unsafe { o.contents.err };
857 unsafe { o.contents.err = std::ptr::null_mut(); }
858 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
862 result_ok: o.result_ok,
866 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
867 fn clone(&self) -> Self {
869 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
870 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
873 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
874 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
880 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
881 /// but with all dynamically-allocated buffers duplicated in new buffers.
882 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
884 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
885 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
886 /// A pointer to the contents in the success state.
887 /// Reading from this pointer when `result_ok` is not set is undefined.
888 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
889 /// A pointer to the contents in the error state.
890 /// Reading from this pointer when `result_ok` is set is undefined.
891 pub err: *mut crate::lightning::ln::msgs::DecodeError,
894 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
895 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
897 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
898 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
899 /// `err` or `result` depending on the state of `result_ok`.
900 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
901 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
905 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
906 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
907 CResult_BuiltCommitmentTransactionDecodeErrorZ {
908 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
909 result: Box::into_raw(Box::new(o)),
915 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
916 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
917 CResult_BuiltCommitmentTransactionDecodeErrorZ {
918 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
919 err: Box::into_raw(Box::new(e)),
925 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
926 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
927 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
930 if unsafe { !(self.contents.result as *mut ()).is_null() } {
931 let _ = unsafe { Box::from_raw(self.contents.result) };
934 if unsafe { !(self.contents.err as *mut ()).is_null() } {
935 let _ = unsafe { Box::from_raw(self.contents.err) };
940 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
941 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
942 let contents = if o.result_ok {
943 let result = unsafe { o.contents.result };
944 unsafe { o.contents.result = std::ptr::null_mut() };
945 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
947 let err = unsafe { o.contents.err };
948 unsafe { o.contents.err = std::ptr::null_mut(); }
949 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
953 result_ok: o.result_ok,
957 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
958 fn clone(&self) -> Self {
960 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
961 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
964 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
965 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
971 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
972 /// but with all dynamically-allocated buffers duplicated in new buffers.
973 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
975 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
976 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
977 /// A pointer to the contents in the success state.
978 /// Reading from this pointer when `result_ok` is not set is undefined.
979 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
980 /// A pointer to the contents in the error state.
981 /// Reading from this pointer when `result_ok` is set is undefined.
982 pub err: *mut crate::lightning::ln::msgs::DecodeError,
985 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
986 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
988 pub struct CResult_CommitmentTransactionDecodeErrorZ {
989 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
990 /// `err` or `result` depending on the state of `result_ok`.
991 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
992 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
996 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
997 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
998 CResult_CommitmentTransactionDecodeErrorZ {
999 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1000 result: Box::into_raw(Box::new(o)),
1006 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1007 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1008 CResult_CommitmentTransactionDecodeErrorZ {
1009 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1010 err: Box::into_raw(Box::new(e)),
1016 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1017 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1018 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1019 fn drop(&mut self) {
1021 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1022 let _ = unsafe { Box::from_raw(self.contents.result) };
1025 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1026 let _ = unsafe { Box::from_raw(self.contents.err) };
1031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1032 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1033 let contents = if o.result_ok {
1034 let result = unsafe { o.contents.result };
1035 unsafe { o.contents.result = std::ptr::null_mut() };
1036 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1038 let err = unsafe { o.contents.err };
1039 unsafe { o.contents.err = std::ptr::null_mut(); }
1040 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1044 result_ok: o.result_ok,
1048 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1049 fn clone(&self) -> Self {
1051 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1052 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1055 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1056 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1062 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1063 /// but with all dynamically-allocated buffers duplicated in new buffers.
1064 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
1066 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1067 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1068 /// A pointer to the contents in the success state.
1069 /// Reading from this pointer when `result_ok` is not set is undefined.
1070 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1071 /// Note that this value is always NULL, as there are no contents in the Err variant
1072 pub err: *mut std::ffi::c_void,
1075 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1076 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1078 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1079 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1080 /// `err` or `result` depending on the state of `result_ok`.
1081 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1082 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1083 pub result_ok: bool,
1086 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1087 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1088 CResult_TrustedCommitmentTransactionNoneZ {
1089 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1090 result: Box::into_raw(Box::new(o)),
1096 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1097 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1098 CResult_TrustedCommitmentTransactionNoneZ {
1099 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1100 err: std::ptr::null_mut(),
1106 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1107 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1108 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1109 fn drop(&mut self) {
1111 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1112 let _ = unsafe { Box::from_raw(self.contents.result) };
1118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1119 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1120 let contents = if o.result_ok {
1121 let result = unsafe { o.contents.result };
1122 unsafe { o.contents.result = std::ptr::null_mut() };
1123 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1125 let _ = unsafe { Box::from_raw(o.contents.err) };
1126 o.contents.err = std::ptr::null_mut();
1127 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1131 result_ok: o.result_ok,
1136 /// The contents of CResult_CVec_SignatureZNoneZ
1137 pub union CResult_CVec_SignatureZNoneZPtr {
1138 /// A pointer to the contents in the success state.
1139 /// Reading from this pointer when `result_ok` is not set is undefined.
1140 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1141 /// Note that this value is always NULL, as there are no contents in the Err variant
1142 pub err: *mut std::ffi::c_void,
1145 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1146 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1148 pub struct CResult_CVec_SignatureZNoneZ {
1149 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1150 /// `err` or `result` depending on the state of `result_ok`.
1151 pub contents: CResult_CVec_SignatureZNoneZPtr,
1152 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1153 pub result_ok: bool,
1156 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1157 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1158 CResult_CVec_SignatureZNoneZ {
1159 contents: CResult_CVec_SignatureZNoneZPtr {
1160 result: Box::into_raw(Box::new(o)),
1166 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1167 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1168 CResult_CVec_SignatureZNoneZ {
1169 contents: CResult_CVec_SignatureZNoneZPtr {
1170 err: std::ptr::null_mut(),
1176 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1177 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1178 impl Drop for CResult_CVec_SignatureZNoneZ {
1179 fn drop(&mut self) {
1181 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1182 let _ = unsafe { Box::from_raw(self.contents.result) };
1188 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1189 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1190 let contents = if o.result_ok {
1191 let result = unsafe { o.contents.result };
1192 unsafe { o.contents.result = std::ptr::null_mut() };
1193 CResult_CVec_SignatureZNoneZPtr { result }
1195 let _ = unsafe { Box::from_raw(o.contents.err) };
1196 o.contents.err = std::ptr::null_mut();
1197 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1201 result_ok: o.result_ok,
1205 impl Clone for CResult_CVec_SignatureZNoneZ {
1206 fn clone(&self) -> Self {
1208 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1209 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1212 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1213 err: std::ptr::null_mut()
1219 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1220 /// but with all dynamically-allocated buffers duplicated in new buffers.
1221 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
1223 /// The contents of CResult_NoneErrorZ
1224 pub union CResult_NoneErrorZPtr {
1225 /// Note that this value is always NULL, as there are no contents in the OK variant
1226 pub result: *mut std::ffi::c_void,
1227 /// A pointer to the contents in the error state.
1228 /// Reading from this pointer when `result_ok` is set is undefined.
1229 pub err: *mut crate::c_types::IOError,
1232 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1233 /// containing a () on success and a crate::c_types::IOError on failure.
1234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1235 pub struct CResult_NoneErrorZ {
1236 /// The contents of this CResult_NoneErrorZ, accessible via either
1237 /// `err` or `result` depending on the state of `result_ok`.
1238 pub contents: CResult_NoneErrorZPtr,
1239 /// Whether this CResult_NoneErrorZ represents a success state.
1240 pub result_ok: bool,
1243 /// Creates a new CResult_NoneErrorZ in the success state.
1244 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1245 CResult_NoneErrorZ {
1246 contents: CResult_NoneErrorZPtr {
1247 result: std::ptr::null_mut(),
1253 /// Creates a new CResult_NoneErrorZ in the error state.
1254 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1255 CResult_NoneErrorZ {
1256 contents: CResult_NoneErrorZPtr {
1257 err: Box::into_raw(Box::new(e)),
1263 /// Frees any resources used by the CResult_NoneErrorZ.
1264 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1265 impl Drop for CResult_NoneErrorZ {
1266 fn drop(&mut self) {
1269 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1270 let _ = unsafe { Box::from_raw(self.contents.err) };
1275 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1276 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1277 let contents = if o.result_ok {
1278 let _ = unsafe { Box::from_raw(o.contents.result) };
1279 o.contents.result = std::ptr::null_mut();
1280 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1282 let err = unsafe { o.contents.err };
1283 unsafe { o.contents.err = std::ptr::null_mut(); }
1284 CResult_NoneErrorZPtr { err }
1288 result_ok: o.result_ok,
1292 impl Clone for CResult_NoneErrorZ {
1293 fn clone(&self) -> Self {
1295 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1296 result: std::ptr::null_mut()
1299 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1300 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1306 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1307 /// but with all dynamically-allocated buffers duplicated in new buffers.
1308 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { orig.clone() }
1310 /// The contents of CResult_RouteHopDecodeErrorZ
1311 pub union CResult_RouteHopDecodeErrorZPtr {
1312 /// A pointer to the contents in the success state.
1313 /// Reading from this pointer when `result_ok` is not set is undefined.
1314 pub result: *mut crate::lightning::routing::router::RouteHop,
1315 /// A pointer to the contents in the error state.
1316 /// Reading from this pointer when `result_ok` is set is undefined.
1317 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1320 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1321 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1322 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1323 pub struct CResult_RouteHopDecodeErrorZ {
1324 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1325 /// `err` or `result` depending on the state of `result_ok`.
1326 pub contents: CResult_RouteHopDecodeErrorZPtr,
1327 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1328 pub result_ok: bool,
1331 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1332 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1333 CResult_RouteHopDecodeErrorZ {
1334 contents: CResult_RouteHopDecodeErrorZPtr {
1335 result: Box::into_raw(Box::new(o)),
1341 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1342 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1343 CResult_RouteHopDecodeErrorZ {
1344 contents: CResult_RouteHopDecodeErrorZPtr {
1345 err: Box::into_raw(Box::new(e)),
1351 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1352 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1353 impl Drop for CResult_RouteHopDecodeErrorZ {
1354 fn drop(&mut self) {
1356 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1357 let _ = unsafe { Box::from_raw(self.contents.result) };
1360 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1361 let _ = unsafe { Box::from_raw(self.contents.err) };
1366 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1367 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1368 let contents = if o.result_ok {
1369 let result = unsafe { o.contents.result };
1370 unsafe { o.contents.result = std::ptr::null_mut() };
1371 CResult_RouteHopDecodeErrorZPtr { result }
1373 let err = unsafe { o.contents.err };
1374 unsafe { o.contents.err = std::ptr::null_mut(); }
1375 CResult_RouteHopDecodeErrorZPtr { err }
1379 result_ok: o.result_ok,
1383 impl Clone for CResult_RouteHopDecodeErrorZ {
1384 fn clone(&self) -> Self {
1386 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1387 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1390 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1391 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1397 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1398 /// but with all dynamically-allocated buffers duplicated in new buffers.
1399 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { orig.clone() }
1401 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1402 /// This corresponds to std::vector in C++
1403 pub struct CVec_RouteHopZ {
1404 /// The elements in the array.
1405 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1406 pub data: *mut crate::lightning::routing::router::RouteHop,
1407 /// The number of elements pointed to by `data`.
1410 impl CVec_RouteHopZ {
1411 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1412 if self.datalen == 0 { return Vec::new(); }
1413 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1414 self.data = std::ptr::null_mut();
1418 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1419 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1422 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1423 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1424 let datalen = v.len();
1425 let data = Box::into_raw(v.into_boxed_slice());
1426 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1430 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1431 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1432 impl Drop for CVec_RouteHopZ {
1433 fn drop(&mut self) {
1434 if self.datalen == 0 { return; }
1435 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1438 impl Clone for CVec_RouteHopZ {
1439 fn clone(&self) -> Self {
1440 let mut res = Vec::new();
1441 if self.datalen == 0 { return Self::from(res); }
1442 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1447 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1448 /// This corresponds to std::vector in C++
1449 pub struct CVec_CVec_RouteHopZZ {
1450 /// The elements in the array.
1451 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1452 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1453 /// The number of elements pointed to by `data`.
1456 impl CVec_CVec_RouteHopZZ {
1457 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1458 if self.datalen == 0 { return Vec::new(); }
1459 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1460 self.data = std::ptr::null_mut();
1464 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1465 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1468 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1469 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1470 let datalen = v.len();
1471 let data = Box::into_raw(v.into_boxed_slice());
1472 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1476 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1477 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1478 impl Drop for CVec_CVec_RouteHopZZ {
1479 fn drop(&mut self) {
1480 if self.datalen == 0 { return; }
1481 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1484 impl Clone for CVec_CVec_RouteHopZZ {
1485 fn clone(&self) -> Self {
1486 let mut res = Vec::new();
1487 if self.datalen == 0 { return Self::from(res); }
1488 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1493 /// The contents of CResult_RouteDecodeErrorZ
1494 pub union CResult_RouteDecodeErrorZPtr {
1495 /// A pointer to the contents in the success state.
1496 /// Reading from this pointer when `result_ok` is not set is undefined.
1497 pub result: *mut crate::lightning::routing::router::Route,
1498 /// A pointer to the contents in the error state.
1499 /// Reading from this pointer when `result_ok` is set is undefined.
1500 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1503 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1504 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1506 pub struct CResult_RouteDecodeErrorZ {
1507 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1508 /// `err` or `result` depending on the state of `result_ok`.
1509 pub contents: CResult_RouteDecodeErrorZPtr,
1510 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1511 pub result_ok: bool,
1514 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1515 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1516 CResult_RouteDecodeErrorZ {
1517 contents: CResult_RouteDecodeErrorZPtr {
1518 result: Box::into_raw(Box::new(o)),
1524 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1525 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1526 CResult_RouteDecodeErrorZ {
1527 contents: CResult_RouteDecodeErrorZPtr {
1528 err: Box::into_raw(Box::new(e)),
1534 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1535 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1536 impl Drop for CResult_RouteDecodeErrorZ {
1537 fn drop(&mut self) {
1539 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1540 let _ = unsafe { Box::from_raw(self.contents.result) };
1543 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1544 let _ = unsafe { Box::from_raw(self.contents.err) };
1549 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1550 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1551 let contents = if o.result_ok {
1552 let result = unsafe { o.contents.result };
1553 unsafe { o.contents.result = std::ptr::null_mut() };
1554 CResult_RouteDecodeErrorZPtr { result }
1556 let err = unsafe { o.contents.err };
1557 unsafe { o.contents.err = std::ptr::null_mut(); }
1558 CResult_RouteDecodeErrorZPtr { err }
1562 result_ok: o.result_ok,
1566 impl Clone for CResult_RouteDecodeErrorZ {
1567 fn clone(&self) -> Self {
1569 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1570 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1573 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1574 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1580 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1581 /// but with all dynamically-allocated buffers duplicated in new buffers.
1582 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
1585 /// An enum which can either contain a u64 or not
1586 pub enum COption_u64Z {
1587 /// When we're in this state, this COption_u64Z contains a u64
1589 /// When we're in this state, this COption_u64Z contains nothing
1593 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1594 if let Self::Some(_) = self { true } else { false }
1596 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1597 if let Self::Some(v) = self { v } else { unreachable!() }
1601 /// Constructs a new COption_u64Z containing a u64
1602 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1603 COption_u64Z::Some(o)
1606 /// Constructs a new COption_u64Z containing nothing
1607 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1611 /// Frees any resources associated with the u64, if we are in the Some state
1612 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1614 /// Creates a new COption_u64Z which has the same data as `orig`
1615 /// but with all dynamically-allocated buffers duplicated in new buffers.
1616 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1618 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1619 /// This corresponds to std::vector in C++
1620 pub struct CVec_ChannelDetailsZ {
1621 /// The elements in the array.
1622 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1623 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
1624 /// The number of elements pointed to by `data`.
1627 impl CVec_ChannelDetailsZ {
1628 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
1629 if self.datalen == 0 { return Vec::new(); }
1630 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1631 self.data = std::ptr::null_mut();
1635 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
1636 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1639 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1640 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
1641 let datalen = v.len();
1642 let data = Box::into_raw(v.into_boxed_slice());
1643 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1647 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1648 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1649 impl Drop for CVec_ChannelDetailsZ {
1650 fn drop(&mut self) {
1651 if self.datalen == 0 { return; }
1652 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1655 impl Clone for CVec_ChannelDetailsZ {
1656 fn clone(&self) -> Self {
1657 let mut res = Vec::new();
1658 if self.datalen == 0 { return Self::from(res); }
1659 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1664 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1665 /// This corresponds to std::vector in C++
1666 pub struct CVec_RouteHintZ {
1667 /// The elements in the array.
1668 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1669 pub data: *mut crate::lightning::routing::router::RouteHint,
1670 /// The number of elements pointed to by `data`.
1673 impl CVec_RouteHintZ {
1674 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1675 if self.datalen == 0 { return Vec::new(); }
1676 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1677 self.data = std::ptr::null_mut();
1681 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1682 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1685 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1686 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1687 let datalen = v.len();
1688 let data = Box::into_raw(v.into_boxed_slice());
1689 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1693 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1694 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1695 impl Drop for CVec_RouteHintZ {
1696 fn drop(&mut self) {
1697 if self.datalen == 0 { return; }
1698 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1701 impl Clone for CVec_RouteHintZ {
1702 fn clone(&self) -> Self {
1703 let mut res = Vec::new();
1704 if self.datalen == 0 { return Self::from(res); }
1705 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1710 /// The contents of CResult_RouteLightningErrorZ
1711 pub union CResult_RouteLightningErrorZPtr {
1712 /// A pointer to the contents in the success state.
1713 /// Reading from this pointer when `result_ok` is not set is undefined.
1714 pub result: *mut crate::lightning::routing::router::Route,
1715 /// A pointer to the contents in the error state.
1716 /// Reading from this pointer when `result_ok` is set is undefined.
1717 pub err: *mut crate::lightning::ln::msgs::LightningError,
1720 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1721 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1723 pub struct CResult_RouteLightningErrorZ {
1724 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
1725 /// `err` or `result` depending on the state of `result_ok`.
1726 pub contents: CResult_RouteLightningErrorZPtr,
1727 /// Whether this CResult_RouteLightningErrorZ represents a success state.
1728 pub result_ok: bool,
1731 /// Creates a new CResult_RouteLightningErrorZ in the success state.
1732 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
1733 CResult_RouteLightningErrorZ {
1734 contents: CResult_RouteLightningErrorZPtr {
1735 result: Box::into_raw(Box::new(o)),
1741 /// Creates a new CResult_RouteLightningErrorZ in the error state.
1742 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
1743 CResult_RouteLightningErrorZ {
1744 contents: CResult_RouteLightningErrorZPtr {
1745 err: Box::into_raw(Box::new(e)),
1751 /// Frees any resources used by the CResult_RouteLightningErrorZ.
1752 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
1753 impl Drop for CResult_RouteLightningErrorZ {
1754 fn drop(&mut self) {
1756 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1757 let _ = unsafe { Box::from_raw(self.contents.result) };
1760 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1761 let _ = unsafe { Box::from_raw(self.contents.err) };
1766 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
1767 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
1768 let contents = if o.result_ok {
1769 let result = unsafe { o.contents.result };
1770 unsafe { o.contents.result = std::ptr::null_mut() };
1771 CResult_RouteLightningErrorZPtr { result }
1773 let err = unsafe { o.contents.err };
1774 unsafe { o.contents.err = std::ptr::null_mut(); }
1775 CResult_RouteLightningErrorZPtr { err }
1779 result_ok: o.result_ok,
1783 impl Clone for CResult_RouteLightningErrorZ {
1784 fn clone(&self) -> Self {
1786 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
1787 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1790 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
1791 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1797 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
1798 /// but with all dynamically-allocated buffers duplicated in new buffers.
1799 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
1801 /// The contents of CResult_TxOutAccessErrorZ
1802 pub union CResult_TxOutAccessErrorZPtr {
1803 /// A pointer to the contents in the success state.
1804 /// Reading from this pointer when `result_ok` is not set is undefined.
1805 pub result: *mut crate::c_types::TxOut,
1806 /// A pointer to the contents in the error state.
1807 /// Reading from this pointer when `result_ok` is set is undefined.
1808 pub err: *mut crate::lightning::chain::AccessError,
1811 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1812 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1814 pub struct CResult_TxOutAccessErrorZ {
1815 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
1816 /// `err` or `result` depending on the state of `result_ok`.
1817 pub contents: CResult_TxOutAccessErrorZPtr,
1818 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
1819 pub result_ok: bool,
1822 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
1823 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
1824 CResult_TxOutAccessErrorZ {
1825 contents: CResult_TxOutAccessErrorZPtr {
1826 result: Box::into_raw(Box::new(o)),
1832 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
1833 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
1834 CResult_TxOutAccessErrorZ {
1835 contents: CResult_TxOutAccessErrorZPtr {
1836 err: Box::into_raw(Box::new(e)),
1842 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
1843 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
1844 impl Drop for CResult_TxOutAccessErrorZ {
1845 fn drop(&mut self) {
1847 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1848 let _ = unsafe { Box::from_raw(self.contents.result) };
1851 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1852 let _ = unsafe { Box::from_raw(self.contents.err) };
1857 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
1858 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
1859 let contents = if o.result_ok {
1860 let result = unsafe { o.contents.result };
1861 unsafe { o.contents.result = std::ptr::null_mut() };
1862 CResult_TxOutAccessErrorZPtr { result }
1864 let err = unsafe { o.contents.err };
1865 unsafe { o.contents.err = std::ptr::null_mut(); }
1866 CResult_TxOutAccessErrorZPtr { err }
1870 result_ok: o.result_ok,
1874 impl Clone for CResult_TxOutAccessErrorZ {
1875 fn clone(&self) -> Self {
1877 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
1878 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
1881 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
1882 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
1888 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
1889 /// but with all dynamically-allocated buffers duplicated in new buffers.
1890 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
1892 /// A tuple of 2 elements. See the individual fields for the types contained.
1893 pub struct C2Tuple_usizeTransactionZ {
1894 /// The element at position 0
1896 /// The element at position 1
1897 pub b: crate::c_types::Transaction,
1899 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
1900 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
1907 impl C2Tuple_usizeTransactionZ {
1908 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
1912 impl Clone for C2Tuple_usizeTransactionZ {
1913 fn clone(&self) -> Self {
1921 /// Creates a new tuple which has the same data as `orig`
1922 /// but with all dynamically-allocated buffers duplicated in new buffers.
1923 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { orig.clone() }
1924 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
1926 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
1927 C2Tuple_usizeTransactionZ { a, b, }
1931 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
1932 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
1934 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1935 /// This corresponds to std::vector in C++
1936 pub struct CVec_C2Tuple_usizeTransactionZZ {
1937 /// The elements in the array.
1938 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1939 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
1940 /// The number of elements pointed to by `data`.
1943 impl CVec_C2Tuple_usizeTransactionZZ {
1944 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
1945 if self.datalen == 0 { return Vec::new(); }
1946 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1947 self.data = std::ptr::null_mut();
1951 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
1952 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1955 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
1956 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
1957 let datalen = v.len();
1958 let data = Box::into_raw(v.into_boxed_slice());
1959 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1963 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1964 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
1965 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
1966 fn drop(&mut self) {
1967 if self.datalen == 0 { return; }
1968 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1971 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
1972 fn clone(&self) -> Self {
1973 let mut res = Vec::new();
1974 if self.datalen == 0 { return Self::from(res); }
1975 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1980 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1981 /// This corresponds to std::vector in C++
1982 pub struct CVec_TxidZ {
1983 /// The elements in the array.
1984 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1985 pub data: *mut crate::c_types::ThirtyTwoBytes,
1986 /// The number of elements pointed to by `data`.
1990 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1991 if self.datalen == 0 { return Vec::new(); }
1992 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1993 self.data = std::ptr::null_mut();
1997 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1998 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2001 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2002 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2003 let datalen = v.len();
2004 let data = Box::into_raw(v.into_boxed_slice());
2005 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2009 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2010 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2011 impl Drop for CVec_TxidZ {
2012 fn drop(&mut self) {
2013 if self.datalen == 0 { return; }
2014 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2017 impl Clone for CVec_TxidZ {
2018 fn clone(&self) -> Self {
2019 let mut res = Vec::new();
2020 if self.datalen == 0 { return Self::from(res); }
2021 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2026 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2027 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2028 /// Note that this value is always NULL, as there are no contents in the OK variant
2029 pub result: *mut std::ffi::c_void,
2030 /// A pointer to the contents in the error state.
2031 /// Reading from this pointer when `result_ok` is set is undefined.
2032 pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2035 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2036 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2038 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2039 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2040 /// `err` or `result` depending on the state of `result_ok`.
2041 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2042 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2043 pub result_ok: bool,
2046 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2047 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2048 CResult_NoneChannelMonitorUpdateErrZ {
2049 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2050 result: std::ptr::null_mut(),
2056 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2057 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2058 CResult_NoneChannelMonitorUpdateErrZ {
2059 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2060 err: Box::into_raw(Box::new(e)),
2066 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2067 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2068 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2069 fn drop(&mut self) {
2072 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2073 let _ = unsafe { Box::from_raw(self.contents.err) };
2078 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2079 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2080 let contents = if o.result_ok {
2081 let _ = unsafe { Box::from_raw(o.contents.result) };
2082 o.contents.result = std::ptr::null_mut();
2083 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2085 let err = unsafe { o.contents.err };
2086 unsafe { o.contents.err = std::ptr::null_mut(); }
2087 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2091 result_ok: o.result_ok,
2095 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2096 fn clone(&self) -> Self {
2098 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2099 result: std::ptr::null_mut()
2102 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2103 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2109 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2110 /// but with all dynamically-allocated buffers duplicated in new buffers.
2111 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2113 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2114 /// This corresponds to std::vector in C++
2115 pub struct CVec_MonitorEventZ {
2116 /// The elements in the array.
2117 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2118 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2119 /// The number of elements pointed to by `data`.
2122 impl CVec_MonitorEventZ {
2123 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2124 if self.datalen == 0 { return Vec::new(); }
2125 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2126 self.data = std::ptr::null_mut();
2130 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2131 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2134 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2135 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2136 let datalen = v.len();
2137 let data = Box::into_raw(v.into_boxed_slice());
2138 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2142 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2143 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2144 impl Drop for CVec_MonitorEventZ {
2145 fn drop(&mut self) {
2146 if self.datalen == 0 { return; }
2147 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2150 impl Clone for CVec_MonitorEventZ {
2151 fn clone(&self) -> Self {
2152 let mut res = Vec::new();
2153 if self.datalen == 0 { return Self::from(res); }
2154 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2160 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2161 pub enum COption_C2Tuple_usizeTransactionZZ {
2162 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2163 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2164 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2167 impl COption_C2Tuple_usizeTransactionZZ {
2168 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2169 if let Self::Some(_) = self { true } else { false }
2171 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2172 if let Self::Some(v) = self { v } else { unreachable!() }
2176 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2177 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2178 COption_C2Tuple_usizeTransactionZZ::Some(o)
2181 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2182 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2183 COption_C2Tuple_usizeTransactionZZ::None
2186 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2187 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2189 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2190 /// but with all dynamically-allocated buffers duplicated in new buffers.
2191 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { orig.clone() }
2193 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2194 /// This corresponds to std::vector in C++
2195 pub struct CVec_SpendableOutputDescriptorZ {
2196 /// The elements in the array.
2197 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2198 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2199 /// The number of elements pointed to by `data`.
2202 impl CVec_SpendableOutputDescriptorZ {
2203 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2204 if self.datalen == 0 { return Vec::new(); }
2205 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2206 self.data = std::ptr::null_mut();
2210 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2211 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2214 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2215 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2216 let datalen = v.len();
2217 let data = Box::into_raw(v.into_boxed_slice());
2218 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2222 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2223 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2224 impl Drop for CVec_SpendableOutputDescriptorZ {
2225 fn drop(&mut self) {
2226 if self.datalen == 0 { return; }
2227 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2230 impl Clone for CVec_SpendableOutputDescriptorZ {
2231 fn clone(&self) -> Self {
2232 let mut res = Vec::new();
2233 if self.datalen == 0 { return Self::from(res); }
2234 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2239 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2240 /// This corresponds to std::vector in C++
2241 pub struct CVec_MessageSendEventZ {
2242 /// The elements in the array.
2243 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2244 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2245 /// The number of elements pointed to by `data`.
2248 impl CVec_MessageSendEventZ {
2249 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2250 if self.datalen == 0 { return Vec::new(); }
2251 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2252 self.data = std::ptr::null_mut();
2256 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2257 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2260 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2261 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2262 let datalen = v.len();
2263 let data = Box::into_raw(v.into_boxed_slice());
2264 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2268 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2269 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2270 impl Drop for CVec_MessageSendEventZ {
2271 fn drop(&mut self) {
2272 if self.datalen == 0 { return; }
2273 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2276 impl Clone for CVec_MessageSendEventZ {
2277 fn clone(&self) -> Self {
2278 let mut res = Vec::new();
2279 if self.datalen == 0 { return Self::from(res); }
2280 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2285 /// The contents of CResult_InitFeaturesDecodeErrorZ
2286 pub union CResult_InitFeaturesDecodeErrorZPtr {
2287 /// A pointer to the contents in the success state.
2288 /// Reading from this pointer when `result_ok` is not set is undefined.
2289 pub result: *mut crate::lightning::ln::features::InitFeatures,
2290 /// A pointer to the contents in the error state.
2291 /// Reading from this pointer when `result_ok` is set is undefined.
2292 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2295 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2296 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2297 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2298 pub struct CResult_InitFeaturesDecodeErrorZ {
2299 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2300 /// `err` or `result` depending on the state of `result_ok`.
2301 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2302 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2303 pub result_ok: bool,
2306 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2307 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2308 CResult_InitFeaturesDecodeErrorZ {
2309 contents: CResult_InitFeaturesDecodeErrorZPtr {
2310 result: Box::into_raw(Box::new(o)),
2316 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
2317 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
2318 CResult_InitFeaturesDecodeErrorZ {
2319 contents: CResult_InitFeaturesDecodeErrorZPtr {
2320 err: Box::into_raw(Box::new(e)),
2326 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
2327 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
2328 impl Drop for CResult_InitFeaturesDecodeErrorZ {
2329 fn drop(&mut self) {
2331 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2332 let _ = unsafe { Box::from_raw(self.contents.result) };
2335 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2336 let _ = unsafe { Box::from_raw(self.contents.err) };
2341 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
2342 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2343 let contents = if o.result_ok {
2344 let result = unsafe { o.contents.result };
2345 unsafe { o.contents.result = std::ptr::null_mut() };
2346 CResult_InitFeaturesDecodeErrorZPtr { result }
2348 let err = unsafe { o.contents.err };
2349 unsafe { o.contents.err = std::ptr::null_mut(); }
2350 CResult_InitFeaturesDecodeErrorZPtr { err }
2354 result_ok: o.result_ok,
2359 /// The contents of CResult_NodeFeaturesDecodeErrorZ
2360 pub union CResult_NodeFeaturesDecodeErrorZPtr {
2361 /// A pointer to the contents in the success state.
2362 /// Reading from this pointer when `result_ok` is not set is undefined.
2363 pub result: *mut crate::lightning::ln::features::NodeFeatures,
2364 /// A pointer to the contents in the error state.
2365 /// Reading from this pointer when `result_ok` is set is undefined.
2366 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2369 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2370 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2371 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2372 pub struct CResult_NodeFeaturesDecodeErrorZ {
2373 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2374 /// `err` or `result` depending on the state of `result_ok`.
2375 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
2376 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2377 pub result_ok: bool,
2380 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2381 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2382 CResult_NodeFeaturesDecodeErrorZ {
2383 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2384 result: Box::into_raw(Box::new(o)),
2390 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2391 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2392 CResult_NodeFeaturesDecodeErrorZ {
2393 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2394 err: Box::into_raw(Box::new(e)),
2400 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2401 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2402 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2403 fn drop(&mut self) {
2405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2406 let _ = unsafe { Box::from_raw(self.contents.result) };
2409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2410 let _ = unsafe { Box::from_raw(self.contents.err) };
2415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2417 let contents = if o.result_ok {
2418 let result = unsafe { o.contents.result };
2419 unsafe { o.contents.result = std::ptr::null_mut() };
2420 CResult_NodeFeaturesDecodeErrorZPtr { result }
2422 let err = unsafe { o.contents.err };
2423 unsafe { o.contents.err = std::ptr::null_mut(); }
2424 CResult_NodeFeaturesDecodeErrorZPtr { err }
2428 result_ok: o.result_ok,
2433 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2434 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2435 /// A pointer to the contents in the success state.
2436 /// Reading from this pointer when `result_ok` is not set is undefined.
2437 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
2438 /// A pointer to the contents in the error state.
2439 /// Reading from this pointer when `result_ok` is set is undefined.
2440 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2443 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2444 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2446 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2447 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2448 /// `err` or `result` depending on the state of `result_ok`.
2449 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2450 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2451 pub result_ok: bool,
2454 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2455 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2456 CResult_ChannelFeaturesDecodeErrorZ {
2457 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2458 result: Box::into_raw(Box::new(o)),
2464 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2465 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2466 CResult_ChannelFeaturesDecodeErrorZ {
2467 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2468 err: Box::into_raw(Box::new(e)),
2474 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2475 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2476 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
2477 fn drop(&mut self) {
2479 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2480 let _ = unsafe { Box::from_raw(self.contents.result) };
2483 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2484 let _ = unsafe { Box::from_raw(self.contents.err) };
2489 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2490 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2491 let contents = if o.result_ok {
2492 let result = unsafe { o.contents.result };
2493 unsafe { o.contents.result = std::ptr::null_mut() };
2494 CResult_ChannelFeaturesDecodeErrorZPtr { result }
2496 let err = unsafe { o.contents.err };
2497 unsafe { o.contents.err = std::ptr::null_mut(); }
2498 CResult_ChannelFeaturesDecodeErrorZPtr { err }
2502 result_ok: o.result_ok,
2507 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2508 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
2509 /// A pointer to the contents in the success state.
2510 /// Reading from this pointer when `result_ok` is not set is undefined.
2511 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
2512 /// A pointer to the contents in the error state.
2513 /// Reading from this pointer when `result_ok` is set is undefined.
2514 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2517 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2518 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2520 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
2521 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2522 /// `err` or `result` depending on the state of `result_ok`.
2523 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2524 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2525 pub result_ok: bool,
2528 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2529 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2530 CResult_InvoiceFeaturesDecodeErrorZ {
2531 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2532 result: Box::into_raw(Box::new(o)),
2538 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2539 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2540 CResult_InvoiceFeaturesDecodeErrorZ {
2541 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2542 err: Box::into_raw(Box::new(e)),
2548 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2549 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2550 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
2551 fn drop(&mut self) {
2553 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2554 let _ = unsafe { Box::from_raw(self.contents.result) };
2557 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2558 let _ = unsafe { Box::from_raw(self.contents.err) };
2563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2564 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2565 let contents = if o.result_ok {
2566 let result = unsafe { o.contents.result };
2567 unsafe { o.contents.result = std::ptr::null_mut() };
2568 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
2570 let err = unsafe { o.contents.err };
2571 unsafe { o.contents.err = std::ptr::null_mut(); }
2572 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2576 result_ok: o.result_ok,
2581 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2582 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2583 /// A pointer to the contents in the success state.
2584 /// Reading from this pointer when `result_ok` is not set is undefined.
2585 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
2586 /// A pointer to the contents in the error state.
2587 /// Reading from this pointer when `result_ok` is set is undefined.
2588 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2591 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2592 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2594 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2595 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2596 /// `err` or `result` depending on the state of `result_ok`.
2597 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
2598 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2599 pub result_ok: bool,
2602 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
2603 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2604 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2605 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2606 result: Box::into_raw(Box::new(o)),
2612 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
2613 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2614 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2615 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2616 err: Box::into_raw(Box::new(e)),
2622 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
2623 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
2624 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2625 fn drop(&mut self) {
2627 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2628 let _ = unsafe { Box::from_raw(self.contents.result) };
2631 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2632 let _ = unsafe { Box::from_raw(self.contents.err) };
2637 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2638 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2639 let contents = if o.result_ok {
2640 let result = unsafe { o.contents.result };
2641 unsafe { o.contents.result = std::ptr::null_mut() };
2642 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
2644 let err = unsafe { o.contents.err };
2645 unsafe { o.contents.err = std::ptr::null_mut(); }
2646 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
2650 result_ok: o.result_ok,
2654 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2655 fn clone(&self) -> Self {
2657 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2658 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2661 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2662 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2668 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2669 /// but with all dynamically-allocated buffers duplicated in new buffers.
2670 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2672 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2673 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2674 /// A pointer to the contents in the success state.
2675 /// Reading from this pointer when `result_ok` is not set is undefined.
2676 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
2677 /// A pointer to the contents in the error state.
2678 /// Reading from this pointer when `result_ok` is set is undefined.
2679 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2682 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2683 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2684 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2685 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2686 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2687 /// `err` or `result` depending on the state of `result_ok`.
2688 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
2689 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2690 pub result_ok: bool,
2693 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
2694 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2695 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2696 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2697 result: Box::into_raw(Box::new(o)),
2703 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
2704 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2705 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2706 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2707 err: Box::into_raw(Box::new(e)),
2713 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
2714 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
2715 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2716 fn drop(&mut self) {
2718 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2719 let _ = unsafe { Box::from_raw(self.contents.result) };
2722 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2723 let _ = unsafe { Box::from_raw(self.contents.err) };
2728 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2729 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2730 let contents = if o.result_ok {
2731 let result = unsafe { o.contents.result };
2732 unsafe { o.contents.result = std::ptr::null_mut() };
2733 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
2735 let err = unsafe { o.contents.err };
2736 unsafe { o.contents.err = std::ptr::null_mut(); }
2737 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
2741 result_ok: o.result_ok,
2745 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2746 fn clone(&self) -> Self {
2748 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2749 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2752 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2753 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2759 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2760 /// but with all dynamically-allocated buffers duplicated in new buffers.
2761 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2763 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
2764 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2765 /// A pointer to the contents in the success state.
2766 /// Reading from this pointer when `result_ok` is not set is undefined.
2767 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2768 /// A pointer to the contents in the error state.
2769 /// Reading from this pointer when `result_ok` is set is undefined.
2770 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2773 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2774 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2776 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
2777 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
2778 /// `err` or `result` depending on the state of `result_ok`.
2779 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
2780 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
2781 pub result_ok: bool,
2784 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
2785 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2786 CResult_SpendableOutputDescriptorDecodeErrorZ {
2787 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2788 result: Box::into_raw(Box::new(o)),
2794 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
2795 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2796 CResult_SpendableOutputDescriptorDecodeErrorZ {
2797 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2798 err: Box::into_raw(Box::new(e)),
2804 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
2805 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
2806 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
2807 fn drop(&mut self) {
2809 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2810 let _ = unsafe { Box::from_raw(self.contents.result) };
2813 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2814 let _ = unsafe { Box::from_raw(self.contents.err) };
2819 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
2820 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2821 let contents = if o.result_ok {
2822 let result = unsafe { o.contents.result };
2823 unsafe { o.contents.result = std::ptr::null_mut() };
2824 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
2826 let err = unsafe { o.contents.err };
2827 unsafe { o.contents.err = std::ptr::null_mut(); }
2828 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
2832 result_ok: o.result_ok,
2836 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
2837 fn clone(&self) -> Self {
2839 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2840 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2843 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2844 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2850 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
2851 /// but with all dynamically-allocated buffers duplicated in new buffers.
2852 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
2854 /// A tuple of 2 elements. See the individual fields for the types contained.
2855 pub struct C2Tuple_SignatureCVec_SignatureZZ {
2856 /// The element at position 0
2857 pub a: crate::c_types::Signature,
2858 /// The element at position 1
2859 pub b: crate::c_types::derived::CVec_SignatureZ,
2861 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
2862 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
2869 impl C2Tuple_SignatureCVec_SignatureZZ {
2870 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
2874 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
2875 fn clone(&self) -> Self {
2883 /// Creates a new tuple which has the same data as `orig`
2884 /// but with all dynamically-allocated buffers duplicated in new buffers.
2885 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
2886 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
2888 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
2889 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
2893 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
2894 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
2896 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
2897 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2898 /// A pointer to the contents in the success state.
2899 /// Reading from this pointer when `result_ok` is not set is undefined.
2900 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
2901 /// Note that this value is always NULL, as there are no contents in the Err variant
2902 pub err: *mut std::ffi::c_void,
2905 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
2906 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
2907 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2908 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2909 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
2910 /// `err` or `result` depending on the state of `result_ok`.
2911 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
2912 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2913 pub result_ok: bool,
2916 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
2917 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2918 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2919 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2920 result: Box::into_raw(Box::new(o)),
2926 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
2927 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2928 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2929 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2930 err: std::ptr::null_mut(),
2936 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
2937 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
2938 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2939 fn drop(&mut self) {
2941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2942 let _ = unsafe { Box::from_raw(self.contents.result) };
2948 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2949 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
2950 let contents = if o.result_ok {
2951 let result = unsafe { o.contents.result };
2952 unsafe { o.contents.result = std::ptr::null_mut() };
2953 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
2955 let _ = unsafe { Box::from_raw(o.contents.err) };
2956 o.contents.err = std::ptr::null_mut();
2957 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
2961 result_ok: o.result_ok,
2965 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2966 fn clone(&self) -> Self {
2968 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2969 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
2972 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2973 err: std::ptr::null_mut()
2979 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
2980 /// but with all dynamically-allocated buffers duplicated in new buffers.
2981 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
2983 /// The contents of CResult_SignatureNoneZ
2984 pub union CResult_SignatureNoneZPtr {
2985 /// A pointer to the contents in the success state.
2986 /// Reading from this pointer when `result_ok` is not set is undefined.
2987 pub result: *mut crate::c_types::Signature,
2988 /// Note that this value is always NULL, as there are no contents in the Err variant
2989 pub err: *mut std::ffi::c_void,
2992 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
2993 /// containing a crate::c_types::Signature on success and a () on failure.
2994 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2995 pub struct CResult_SignatureNoneZ {
2996 /// The contents of this CResult_SignatureNoneZ, accessible via either
2997 /// `err` or `result` depending on the state of `result_ok`.
2998 pub contents: CResult_SignatureNoneZPtr,
2999 /// Whether this CResult_SignatureNoneZ represents a success state.
3000 pub result_ok: bool,
3003 /// Creates a new CResult_SignatureNoneZ in the success state.
3004 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3005 CResult_SignatureNoneZ {
3006 contents: CResult_SignatureNoneZPtr {
3007 result: Box::into_raw(Box::new(o)),
3013 /// Creates a new CResult_SignatureNoneZ in the error state.
3014 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3015 CResult_SignatureNoneZ {
3016 contents: CResult_SignatureNoneZPtr {
3017 err: std::ptr::null_mut(),
3023 /// Frees any resources used by the CResult_SignatureNoneZ.
3024 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3025 impl Drop for CResult_SignatureNoneZ {
3026 fn drop(&mut self) {
3028 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3029 let _ = unsafe { Box::from_raw(self.contents.result) };
3035 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3036 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3037 let contents = if o.result_ok {
3038 let result = unsafe { o.contents.result };
3039 unsafe { o.contents.result = std::ptr::null_mut() };
3040 CResult_SignatureNoneZPtr { result }
3042 let _ = unsafe { Box::from_raw(o.contents.err) };
3043 o.contents.err = std::ptr::null_mut();
3044 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3048 result_ok: o.result_ok,
3052 impl Clone for CResult_SignatureNoneZ {
3053 fn clone(&self) -> Self {
3055 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3056 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3059 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3060 err: std::ptr::null_mut()
3066 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3067 /// but with all dynamically-allocated buffers duplicated in new buffers.
3068 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
3070 /// The contents of CResult_SignDecodeErrorZ
3071 pub union CResult_SignDecodeErrorZPtr {
3072 /// A pointer to the contents in the success state.
3073 /// Reading from this pointer when `result_ok` is not set is undefined.
3074 pub result: *mut crate::lightning::chain::keysinterface::Sign,
3075 /// A pointer to the contents in the error state.
3076 /// Reading from this pointer when `result_ok` is set is undefined.
3077 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3080 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3081 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3083 pub struct CResult_SignDecodeErrorZ {
3084 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3085 /// `err` or `result` depending on the state of `result_ok`.
3086 pub contents: CResult_SignDecodeErrorZPtr,
3087 /// Whether this CResult_SignDecodeErrorZ represents a success state.
3088 pub result_ok: bool,
3091 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3092 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3093 CResult_SignDecodeErrorZ {
3094 contents: CResult_SignDecodeErrorZPtr {
3095 result: Box::into_raw(Box::new(o)),
3101 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3102 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3103 CResult_SignDecodeErrorZ {
3104 contents: CResult_SignDecodeErrorZPtr {
3105 err: Box::into_raw(Box::new(e)),
3111 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3112 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3113 impl Drop for CResult_SignDecodeErrorZ {
3114 fn drop(&mut self) {
3116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3117 let _ = unsafe { Box::from_raw(self.contents.result) };
3120 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3121 let _ = unsafe { Box::from_raw(self.contents.err) };
3126 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3127 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3128 let contents = if o.result_ok {
3129 let result = unsafe { o.contents.result };
3130 unsafe { o.contents.result = std::ptr::null_mut() };
3131 CResult_SignDecodeErrorZPtr { result }
3133 let err = unsafe { o.contents.err };
3134 unsafe { o.contents.err = std::ptr::null_mut(); }
3135 CResult_SignDecodeErrorZPtr { err }
3139 result_ok: o.result_ok,
3143 impl Clone for CResult_SignDecodeErrorZ {
3144 fn clone(&self) -> Self {
3146 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3147 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3150 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3151 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3157 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3158 /// but with all dynamically-allocated buffers duplicated in new buffers.
3159 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
3161 /// A dynamically-allocated array of u8s of arbitrary size.
3162 /// This corresponds to std::vector in C++
3163 pub struct CVec_u8Z {
3164 /// The elements in the array.
3165 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3167 /// The number of elements pointed to by `data`.
3171 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3172 if self.datalen == 0 { return Vec::new(); }
3173 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3174 self.data = std::ptr::null_mut();
3178 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3179 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3182 impl From<Vec<u8>> for CVec_u8Z {
3183 fn from(v: Vec<u8>) -> Self {
3184 let datalen = v.len();
3185 let data = Box::into_raw(v.into_boxed_slice());
3186 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3190 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3191 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3192 impl Drop for CVec_u8Z {
3193 fn drop(&mut self) {
3194 if self.datalen == 0 { return; }
3195 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3198 impl Clone for CVec_u8Z {
3199 fn clone(&self) -> Self {
3200 let mut res = Vec::new();
3201 if self.datalen == 0 { return Self::from(res); }
3202 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3207 /// The contents of CResult_RecoverableSignatureNoneZ
3208 pub union CResult_RecoverableSignatureNoneZPtr {
3209 /// A pointer to the contents in the success state.
3210 /// Reading from this pointer when `result_ok` is not set is undefined.
3211 pub result: *mut crate::c_types::RecoverableSignature,
3212 /// Note that this value is always NULL, as there are no contents in the Err variant
3213 pub err: *mut std::ffi::c_void,
3216 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3217 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3219 pub struct CResult_RecoverableSignatureNoneZ {
3220 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3221 /// `err` or `result` depending on the state of `result_ok`.
3222 pub contents: CResult_RecoverableSignatureNoneZPtr,
3223 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3224 pub result_ok: bool,
3227 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
3228 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
3229 CResult_RecoverableSignatureNoneZ {
3230 contents: CResult_RecoverableSignatureNoneZPtr {
3231 result: Box::into_raw(Box::new(o)),
3237 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
3238 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
3239 CResult_RecoverableSignatureNoneZ {
3240 contents: CResult_RecoverableSignatureNoneZPtr {
3241 err: std::ptr::null_mut(),
3247 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
3248 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
3249 impl Drop for CResult_RecoverableSignatureNoneZ {
3250 fn drop(&mut self) {
3252 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3253 let _ = unsafe { Box::from_raw(self.contents.result) };
3259 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
3260 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
3261 let contents = if o.result_ok {
3262 let result = unsafe { o.contents.result };
3263 unsafe { o.contents.result = std::ptr::null_mut() };
3264 CResult_RecoverableSignatureNoneZPtr { result }
3266 let _ = unsafe { Box::from_raw(o.contents.err) };
3267 o.contents.err = std::ptr::null_mut();
3268 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
3272 result_ok: o.result_ok,
3276 impl Clone for CResult_RecoverableSignatureNoneZ {
3277 fn clone(&self) -> Self {
3279 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
3280 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
3283 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
3284 err: std::ptr::null_mut()
3290 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
3291 /// but with all dynamically-allocated buffers duplicated in new buffers.
3292 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { orig.clone() }
3294 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3295 /// This corresponds to std::vector in C++
3296 pub struct CVec_CVec_u8ZZ {
3297 /// The elements in the array.
3298 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3299 pub data: *mut crate::c_types::derived::CVec_u8Z,
3300 /// The number of elements pointed to by `data`.
3303 impl CVec_CVec_u8ZZ {
3304 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3305 if self.datalen == 0 { return Vec::new(); }
3306 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3307 self.data = std::ptr::null_mut();
3311 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3312 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3315 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3316 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3317 let datalen = v.len();
3318 let data = Box::into_raw(v.into_boxed_slice());
3319 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3323 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3324 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3325 impl Drop for CVec_CVec_u8ZZ {
3326 fn drop(&mut self) {
3327 if self.datalen == 0 { return; }
3328 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3331 impl Clone for CVec_CVec_u8ZZ {
3332 fn clone(&self) -> Self {
3333 let mut res = Vec::new();
3334 if self.datalen == 0 { return Self::from(res); }
3335 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3340 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3341 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3342 /// A pointer to the contents in the success state.
3343 /// Reading from this pointer when `result_ok` is not set is undefined.
3344 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3345 /// Note that this value is always NULL, as there are no contents in the Err variant
3346 pub err: *mut std::ffi::c_void,
3349 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3350 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3352 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3353 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3354 /// `err` or `result` depending on the state of `result_ok`.
3355 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3356 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3357 pub result_ok: bool,
3360 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3361 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3362 CResult_CVec_CVec_u8ZZNoneZ {
3363 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3364 result: Box::into_raw(Box::new(o)),
3370 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3371 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3372 CResult_CVec_CVec_u8ZZNoneZ {
3373 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3374 err: std::ptr::null_mut(),
3380 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3381 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3382 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3383 fn drop(&mut self) {
3385 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3386 let _ = unsafe { Box::from_raw(self.contents.result) };
3392 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3393 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3394 let contents = if o.result_ok {
3395 let result = unsafe { o.contents.result };
3396 unsafe { o.contents.result = std::ptr::null_mut() };
3397 CResult_CVec_CVec_u8ZZNoneZPtr { result }
3399 let _ = unsafe { Box::from_raw(o.contents.err) };
3400 o.contents.err = std::ptr::null_mut();
3401 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
3405 result_ok: o.result_ok,
3409 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3410 fn clone(&self) -> Self {
3412 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3413 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3416 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3417 err: std::ptr::null_mut()
3423 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3424 /// but with all dynamically-allocated buffers duplicated in new buffers.
3425 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
3427 /// The contents of CResult_InMemorySignerDecodeErrorZ
3428 pub union CResult_InMemorySignerDecodeErrorZPtr {
3429 /// A pointer to the contents in the success state.
3430 /// Reading from this pointer when `result_ok` is not set is undefined.
3431 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
3432 /// A pointer to the contents in the error state.
3433 /// Reading from this pointer when `result_ok` is set is undefined.
3434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3437 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3438 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3440 pub struct CResult_InMemorySignerDecodeErrorZ {
3441 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3442 /// `err` or `result` depending on the state of `result_ok`.
3443 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3444 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3445 pub result_ok: bool,
3448 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3449 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3450 CResult_InMemorySignerDecodeErrorZ {
3451 contents: CResult_InMemorySignerDecodeErrorZPtr {
3452 result: Box::into_raw(Box::new(o)),
3458 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3459 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3460 CResult_InMemorySignerDecodeErrorZ {
3461 contents: CResult_InMemorySignerDecodeErrorZPtr {
3462 err: Box::into_raw(Box::new(e)),
3468 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3469 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3470 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3471 fn drop(&mut self) {
3473 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3474 let _ = unsafe { Box::from_raw(self.contents.result) };
3477 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3478 let _ = unsafe { Box::from_raw(self.contents.err) };
3483 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3484 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3485 let contents = if o.result_ok {
3486 let result = unsafe { o.contents.result };
3487 unsafe { o.contents.result = std::ptr::null_mut() };
3488 CResult_InMemorySignerDecodeErrorZPtr { result }
3490 let err = unsafe { o.contents.err };
3491 unsafe { o.contents.err = std::ptr::null_mut(); }
3492 CResult_InMemorySignerDecodeErrorZPtr { err }
3496 result_ok: o.result_ok,
3500 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3501 fn clone(&self) -> Self {
3503 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3504 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3507 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3508 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3514 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3515 /// but with all dynamically-allocated buffers duplicated in new buffers.
3516 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
3518 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3519 /// This corresponds to std::vector in C++
3520 pub struct CVec_TxOutZ {
3521 /// The elements in the array.
3522 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3523 pub data: *mut crate::c_types::TxOut,
3524 /// The number of elements pointed to by `data`.
3528 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
3529 if self.datalen == 0 { return Vec::new(); }
3530 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3531 self.data = std::ptr::null_mut();
3535 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
3536 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3539 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
3540 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
3541 let datalen = v.len();
3542 let data = Box::into_raw(v.into_boxed_slice());
3543 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3547 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3548 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
3549 impl Drop for CVec_TxOutZ {
3550 fn drop(&mut self) {
3551 if self.datalen == 0 { return; }
3552 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3555 impl Clone for CVec_TxOutZ {
3556 fn clone(&self) -> Self {
3557 let mut res = Vec::new();
3558 if self.datalen == 0 { return Self::from(res); }
3559 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3564 /// The contents of CResult_TransactionNoneZ
3565 pub union CResult_TransactionNoneZPtr {
3566 /// A pointer to the contents in the success state.
3567 /// Reading from this pointer when `result_ok` is not set is undefined.
3568 pub result: *mut crate::c_types::Transaction,
3569 /// Note that this value is always NULL, as there are no contents in the Err variant
3570 pub err: *mut std::ffi::c_void,
3573 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3574 /// containing a crate::c_types::Transaction on success and a () on failure.
3575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3576 pub struct CResult_TransactionNoneZ {
3577 /// The contents of this CResult_TransactionNoneZ, accessible via either
3578 /// `err` or `result` depending on the state of `result_ok`.
3579 pub contents: CResult_TransactionNoneZPtr,
3580 /// Whether this CResult_TransactionNoneZ represents a success state.
3581 pub result_ok: bool,
3584 /// Creates a new CResult_TransactionNoneZ in the success state.
3585 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3586 CResult_TransactionNoneZ {
3587 contents: CResult_TransactionNoneZPtr {
3588 result: Box::into_raw(Box::new(o)),
3594 /// Creates a new CResult_TransactionNoneZ in the error state.
3595 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3596 CResult_TransactionNoneZ {
3597 contents: CResult_TransactionNoneZPtr {
3598 err: std::ptr::null_mut(),
3604 /// Frees any resources used by the CResult_TransactionNoneZ.
3605 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3606 impl Drop for CResult_TransactionNoneZ {
3607 fn drop(&mut self) {
3609 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3610 let _ = unsafe { Box::from_raw(self.contents.result) };
3616 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3617 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3618 let contents = if o.result_ok {
3619 let result = unsafe { o.contents.result };
3620 unsafe { o.contents.result = std::ptr::null_mut() };
3621 CResult_TransactionNoneZPtr { result }
3623 let _ = unsafe { Box::from_raw(o.contents.err) };
3624 o.contents.err = std::ptr::null_mut();
3625 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
3629 result_ok: o.result_ok,
3633 impl Clone for CResult_TransactionNoneZ {
3634 fn clone(&self) -> Self {
3636 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3637 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3640 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3641 err: std::ptr::null_mut()
3647 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3648 /// but with all dynamically-allocated buffers duplicated in new buffers.
3649 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { orig.clone() }
3651 /// A tuple of 2 elements. See the individual fields for the types contained.
3652 pub struct C2Tuple_BlockHashChannelMonitorZ {
3653 /// The element at position 0
3654 pub a: crate::c_types::ThirtyTwoBytes,
3655 /// The element at position 1
3656 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3658 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3659 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3666 impl C2Tuple_BlockHashChannelMonitorZ {
3667 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3671 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3673 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3674 C2Tuple_BlockHashChannelMonitorZ { a, b, }
3678 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3679 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3681 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3682 /// This corresponds to std::vector in C++
3683 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
3684 /// The elements in the array.
3685 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3686 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3687 /// The number of elements pointed to by `data`.
3690 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
3691 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
3692 if self.datalen == 0 { return Vec::new(); }
3693 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3694 self.data = std::ptr::null_mut();
3698 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
3699 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3702 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3703 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
3704 let datalen = v.len();
3705 let data = Box::into_raw(v.into_boxed_slice());
3706 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3710 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3711 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
3712 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3713 fn drop(&mut self) {
3714 if self.datalen == 0 { return; }
3715 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3719 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3720 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3721 /// A pointer to the contents in the success state.
3722 /// Reading from this pointer when `result_ok` is not set is undefined.
3723 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
3724 /// A pointer to the contents in the error state.
3725 /// Reading from this pointer when `result_ok` is set is undefined.
3726 pub err: *mut crate::c_types::IOError,
3729 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3730 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3732 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3733 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3734 /// `err` or `result` depending on the state of `result_ok`.
3735 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
3736 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3737 pub result_ok: bool,
3740 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
3741 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3742 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3743 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3744 result: Box::into_raw(Box::new(o)),
3750 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
3751 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3752 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3753 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3754 err: Box::into_raw(Box::new(e)),
3760 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
3761 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
3762 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3763 fn drop(&mut self) {
3765 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3766 let _ = unsafe { Box::from_raw(self.contents.result) };
3769 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3770 let _ = unsafe { Box::from_raw(self.contents.err) };
3775 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3776 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
3777 let contents = if o.result_ok {
3778 let result = unsafe { o.contents.result };
3779 unsafe { o.contents.result = std::ptr::null_mut() };
3780 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
3782 let err = unsafe { o.contents.err };
3783 unsafe { o.contents.err = std::ptr::null_mut(); }
3784 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
3788 result_ok: o.result_ok,
3794 /// An enum which can either contain a u16 or not
3795 pub enum COption_u16Z {
3796 /// When we're in this state, this COption_u16Z contains a u16
3798 /// When we're in this state, this COption_u16Z contains nothing
3802 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3803 if let Self::Some(_) = self { true } else { false }
3805 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
3806 if let Self::Some(v) = self { v } else { unreachable!() }
3810 /// Constructs a new COption_u16Z containing a u16
3811 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
3812 COption_u16Z::Some(o)
3815 /// Constructs a new COption_u16Z containing nothing
3816 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
3820 /// Frees any resources associated with the u16, if we are in the Some state
3821 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
3823 /// Creates a new COption_u16Z which has the same data as `orig`
3824 /// but with all dynamically-allocated buffers duplicated in new buffers.
3825 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { orig.clone() }
3827 /// The contents of CResult_NoneAPIErrorZ
3828 pub union CResult_NoneAPIErrorZPtr {
3829 /// Note that this value is always NULL, as there are no contents in the OK variant
3830 pub result: *mut std::ffi::c_void,
3831 /// A pointer to the contents in the error state.
3832 /// Reading from this pointer when `result_ok` is set is undefined.
3833 pub err: *mut crate::lightning::util::errors::APIError,
3836 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
3837 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
3838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3839 pub struct CResult_NoneAPIErrorZ {
3840 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
3841 /// `err` or `result` depending on the state of `result_ok`.
3842 pub contents: CResult_NoneAPIErrorZPtr,
3843 /// Whether this CResult_NoneAPIErrorZ represents a success state.
3844 pub result_ok: bool,
3847 /// Creates a new CResult_NoneAPIErrorZ in the success state.
3848 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
3849 CResult_NoneAPIErrorZ {
3850 contents: CResult_NoneAPIErrorZPtr {
3851 result: std::ptr::null_mut(),
3857 /// Creates a new CResult_NoneAPIErrorZ in the error state.
3858 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
3859 CResult_NoneAPIErrorZ {
3860 contents: CResult_NoneAPIErrorZPtr {
3861 err: Box::into_raw(Box::new(e)),
3867 /// Frees any resources used by the CResult_NoneAPIErrorZ.
3868 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
3869 impl Drop for CResult_NoneAPIErrorZ {
3870 fn drop(&mut self) {
3873 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3874 let _ = unsafe { Box::from_raw(self.contents.err) };
3879 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
3880 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
3881 let contents = if o.result_ok {
3882 let _ = unsafe { Box::from_raw(o.contents.result) };
3883 o.contents.result = std::ptr::null_mut();
3884 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
3886 let err = unsafe { o.contents.err };
3887 unsafe { o.contents.err = std::ptr::null_mut(); }
3888 CResult_NoneAPIErrorZPtr { err }
3892 result_ok: o.result_ok,
3896 impl Clone for CResult_NoneAPIErrorZ {
3897 fn clone(&self) -> Self {
3899 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
3900 result: std::ptr::null_mut()
3903 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
3904 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
3910 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
3911 /// but with all dynamically-allocated buffers duplicated in new buffers.
3912 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
3914 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
3915 /// This corresponds to std::vector in C++
3916 pub struct CVec_CResult_NoneAPIErrorZZ {
3917 /// The elements in the array.
3918 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3919 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
3920 /// The number of elements pointed to by `data`.
3923 impl CVec_CResult_NoneAPIErrorZZ {
3924 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
3925 if self.datalen == 0 { return Vec::new(); }
3926 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3927 self.data = std::ptr::null_mut();
3931 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
3932 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3935 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
3936 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
3937 let datalen = v.len();
3938 let data = Box::into_raw(v.into_boxed_slice());
3939 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3943 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3944 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
3945 impl Drop for CVec_CResult_NoneAPIErrorZZ {
3946 fn drop(&mut self) {
3947 if self.datalen == 0 { return; }
3948 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3951 impl Clone for CVec_CResult_NoneAPIErrorZZ {
3952 fn clone(&self) -> Self {
3953 let mut res = Vec::new();
3954 if self.datalen == 0 { return Self::from(res); }
3955 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3960 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
3961 /// This corresponds to std::vector in C++
3962 pub struct CVec_APIErrorZ {
3963 /// The elements in the array.
3964 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3965 pub data: *mut crate::lightning::util::errors::APIError,
3966 /// The number of elements pointed to by `data`.
3969 impl CVec_APIErrorZ {
3970 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
3971 if self.datalen == 0 { return Vec::new(); }
3972 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3973 self.data = std::ptr::null_mut();
3977 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
3978 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3981 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
3982 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
3983 let datalen = v.len();
3984 let data = Box::into_raw(v.into_boxed_slice());
3985 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3989 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3990 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
3991 impl Drop for CVec_APIErrorZ {
3992 fn drop(&mut self) {
3993 if self.datalen == 0 { return; }
3994 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3997 impl Clone for CVec_APIErrorZ {
3998 fn clone(&self) -> Self {
3999 let mut res = Vec::new();
4000 if self.datalen == 0 { return Self::from(res); }
4001 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4006 /// The contents of CResult_NonePaymentSendFailureZ
4007 pub union CResult_NonePaymentSendFailureZPtr {
4008 /// Note that this value is always NULL, as there are no contents in the OK variant
4009 pub result: *mut std::ffi::c_void,
4010 /// A pointer to the contents in the error state.
4011 /// Reading from this pointer when `result_ok` is set is undefined.
4012 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4015 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4016 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4017 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4018 pub struct CResult_NonePaymentSendFailureZ {
4019 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4020 /// `err` or `result` depending on the state of `result_ok`.
4021 pub contents: CResult_NonePaymentSendFailureZPtr,
4022 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4023 pub result_ok: bool,
4026 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4027 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4028 CResult_NonePaymentSendFailureZ {
4029 contents: CResult_NonePaymentSendFailureZPtr {
4030 result: std::ptr::null_mut(),
4036 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4037 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4038 CResult_NonePaymentSendFailureZ {
4039 contents: CResult_NonePaymentSendFailureZPtr {
4040 err: Box::into_raw(Box::new(e)),
4046 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4047 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4048 impl Drop for CResult_NonePaymentSendFailureZ {
4049 fn drop(&mut self) {
4052 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4053 let _ = unsafe { Box::from_raw(self.contents.err) };
4058 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4059 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4060 let contents = if o.result_ok {
4061 let _ = unsafe { Box::from_raw(o.contents.result) };
4062 o.contents.result = std::ptr::null_mut();
4063 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4065 let err = unsafe { o.contents.err };
4066 unsafe { o.contents.err = std::ptr::null_mut(); }
4067 CResult_NonePaymentSendFailureZPtr { err }
4071 result_ok: o.result_ok,
4075 impl Clone for CResult_NonePaymentSendFailureZ {
4076 fn clone(&self) -> Self {
4078 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4079 result: std::ptr::null_mut()
4082 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4083 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4089 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4090 /// but with all dynamically-allocated buffers duplicated in new buffers.
4091 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4093 /// The contents of CResult_PaymentHashPaymentSendFailureZ
4094 pub union CResult_PaymentHashPaymentSendFailureZPtr {
4095 /// A pointer to the contents in the success state.
4096 /// Reading from this pointer when `result_ok` is not set is undefined.
4097 pub result: *mut crate::c_types::ThirtyTwoBytes,
4098 /// A pointer to the contents in the error state.
4099 /// Reading from this pointer when `result_ok` is set is undefined.
4100 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4103 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
4104 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4106 pub struct CResult_PaymentHashPaymentSendFailureZ {
4107 /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
4108 /// `err` or `result` depending on the state of `result_ok`.
4109 pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
4110 /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
4111 pub result_ok: bool,
4114 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
4115 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
4116 CResult_PaymentHashPaymentSendFailureZ {
4117 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4118 result: Box::into_raw(Box::new(o)),
4124 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
4125 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
4126 CResult_PaymentHashPaymentSendFailureZ {
4127 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4128 err: Box::into_raw(Box::new(e)),
4134 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
4135 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
4136 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
4137 fn drop(&mut self) {
4139 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4140 let _ = unsafe { Box::from_raw(self.contents.result) };
4143 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4144 let _ = unsafe { Box::from_raw(self.contents.err) };
4149 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
4150 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4151 let contents = if o.result_ok {
4152 let result = unsafe { o.contents.result };
4153 unsafe { o.contents.result = std::ptr::null_mut() };
4154 CResult_PaymentHashPaymentSendFailureZPtr { result }
4156 let err = unsafe { o.contents.err };
4157 unsafe { o.contents.err = std::ptr::null_mut(); }
4158 CResult_PaymentHashPaymentSendFailureZPtr { err }
4162 result_ok: o.result_ok,
4166 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
4167 fn clone(&self) -> Self {
4169 Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4170 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4173 Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4174 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4180 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
4181 /// but with all dynamically-allocated buffers duplicated in new buffers.
4182 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { orig.clone() }
4184 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4185 /// This corresponds to std::vector in C++
4186 pub struct CVec_NetAddressZ {
4187 /// The elements in the array.
4188 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4189 pub data: *mut crate::lightning::ln::msgs::NetAddress,
4190 /// The number of elements pointed to by `data`.
4193 impl CVec_NetAddressZ {
4194 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4195 if self.datalen == 0 { return Vec::new(); }
4196 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4197 self.data = std::ptr::null_mut();
4201 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4202 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4205 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4206 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4207 let datalen = v.len();
4208 let data = Box::into_raw(v.into_boxed_slice());
4209 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4213 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4214 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4215 impl Drop for CVec_NetAddressZ {
4216 fn drop(&mut self) {
4217 if self.datalen == 0 { return; }
4218 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4221 impl Clone for CVec_NetAddressZ {
4222 fn clone(&self) -> Self {
4223 let mut res = Vec::new();
4224 if self.datalen == 0 { return Self::from(res); }
4225 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4230 /// A tuple of 2 elements. See the individual fields for the types contained.
4231 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4232 /// The element at position 0
4233 pub a: crate::c_types::ThirtyTwoBytes,
4234 /// The element at position 1
4235 pub b: crate::c_types::ThirtyTwoBytes,
4237 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4238 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4245 impl C2Tuple_PaymentHashPaymentSecretZ {
4246 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4250 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4251 fn clone(&self) -> Self {
4259 /// Creates a new tuple which has the same data as `orig`
4260 /// but with all dynamically-allocated buffers duplicated in new buffers.
4261 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { orig.clone() }
4262 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4264 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4265 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4269 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4270 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4272 /// The contents of CResult_PaymentSecretAPIErrorZ
4273 pub union CResult_PaymentSecretAPIErrorZPtr {
4274 /// A pointer to the contents in the success state.
4275 /// Reading from this pointer when `result_ok` is not set is undefined.
4276 pub result: *mut crate::c_types::ThirtyTwoBytes,
4277 /// A pointer to the contents in the error state.
4278 /// Reading from this pointer when `result_ok` is set is undefined.
4279 pub err: *mut crate::lightning::util::errors::APIError,
4282 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4283 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4285 pub struct CResult_PaymentSecretAPIErrorZ {
4286 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4287 /// `err` or `result` depending on the state of `result_ok`.
4288 pub contents: CResult_PaymentSecretAPIErrorZPtr,
4289 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4290 pub result_ok: bool,
4293 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4294 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4295 CResult_PaymentSecretAPIErrorZ {
4296 contents: CResult_PaymentSecretAPIErrorZPtr {
4297 result: Box::into_raw(Box::new(o)),
4303 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4304 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4305 CResult_PaymentSecretAPIErrorZ {
4306 contents: CResult_PaymentSecretAPIErrorZPtr {
4307 err: Box::into_raw(Box::new(e)),
4313 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4314 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4315 impl Drop for CResult_PaymentSecretAPIErrorZ {
4316 fn drop(&mut self) {
4318 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4319 let _ = unsafe { Box::from_raw(self.contents.result) };
4322 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4323 let _ = unsafe { Box::from_raw(self.contents.err) };
4328 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4329 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4330 let contents = if o.result_ok {
4331 let result = unsafe { o.contents.result };
4332 unsafe { o.contents.result = std::ptr::null_mut() };
4333 CResult_PaymentSecretAPIErrorZPtr { result }
4335 let err = unsafe { o.contents.err };
4336 unsafe { o.contents.err = std::ptr::null_mut(); }
4337 CResult_PaymentSecretAPIErrorZPtr { err }
4341 result_ok: o.result_ok,
4345 impl Clone for CResult_PaymentSecretAPIErrorZ {
4346 fn clone(&self) -> Self {
4348 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4349 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4352 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4353 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4359 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4360 /// but with all dynamically-allocated buffers duplicated in new buffers.
4361 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { orig.clone() }
4363 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4364 /// This corresponds to std::vector in C++
4365 pub struct CVec_ChannelMonitorZ {
4366 /// The elements in the array.
4367 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4368 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4369 /// The number of elements pointed to by `data`.
4372 impl CVec_ChannelMonitorZ {
4373 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4374 if self.datalen == 0 { return Vec::new(); }
4375 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4376 self.data = std::ptr::null_mut();
4380 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4381 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4384 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4385 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4386 let datalen = v.len();
4387 let data = Box::into_raw(v.into_boxed_slice());
4388 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4392 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4393 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4394 impl Drop for CVec_ChannelMonitorZ {
4395 fn drop(&mut self) {
4396 if self.datalen == 0 { return; }
4397 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4401 /// A tuple of 2 elements. See the individual fields for the types contained.
4402 pub struct C2Tuple_BlockHashChannelManagerZ {
4403 /// The element at position 0
4404 pub a: crate::c_types::ThirtyTwoBytes,
4405 /// The element at position 1
4406 pub b: crate::lightning::ln::channelmanager::ChannelManager,
4408 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4409 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4416 impl C2Tuple_BlockHashChannelManagerZ {
4417 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4421 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4423 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4424 C2Tuple_BlockHashChannelManagerZ { a, b, }
4428 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4429 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4431 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4432 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4433 /// A pointer to the contents in the success state.
4434 /// Reading from this pointer when `result_ok` is not set is undefined.
4435 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4436 /// A pointer to the contents in the error state.
4437 /// Reading from this pointer when `result_ok` is set is undefined.
4438 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4441 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4442 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4444 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4445 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4446 /// `err` or `result` depending on the state of `result_ok`.
4447 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4448 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4449 pub result_ok: bool,
4452 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4453 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4454 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4455 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4456 result: Box::into_raw(Box::new(o)),
4462 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4463 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4464 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4465 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4466 err: Box::into_raw(Box::new(e)),
4472 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4473 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4474 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4475 fn drop(&mut self) {
4477 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4478 let _ = unsafe { Box::from_raw(self.contents.result) };
4481 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4482 let _ = unsafe { Box::from_raw(self.contents.err) };
4487 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4488 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4489 let contents = if o.result_ok {
4490 let result = unsafe { o.contents.result };
4491 unsafe { o.contents.result = std::ptr::null_mut() };
4492 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4494 let err = unsafe { o.contents.err };
4495 unsafe { o.contents.err = std::ptr::null_mut(); }
4496 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4500 result_ok: o.result_ok,
4505 /// The contents of CResult_ChannelConfigDecodeErrorZ
4506 pub union CResult_ChannelConfigDecodeErrorZPtr {
4507 /// A pointer to the contents in the success state.
4508 /// Reading from this pointer when `result_ok` is not set is undefined.
4509 pub result: *mut crate::lightning::util::config::ChannelConfig,
4510 /// A pointer to the contents in the error state.
4511 /// Reading from this pointer when `result_ok` is set is undefined.
4512 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4515 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4516 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4518 pub struct CResult_ChannelConfigDecodeErrorZ {
4519 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4520 /// `err` or `result` depending on the state of `result_ok`.
4521 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4522 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4523 pub result_ok: bool,
4526 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4527 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4528 CResult_ChannelConfigDecodeErrorZ {
4529 contents: CResult_ChannelConfigDecodeErrorZPtr {
4530 result: Box::into_raw(Box::new(o)),
4536 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4537 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4538 CResult_ChannelConfigDecodeErrorZ {
4539 contents: CResult_ChannelConfigDecodeErrorZPtr {
4540 err: Box::into_raw(Box::new(e)),
4546 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4547 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4548 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4549 fn drop(&mut self) {
4551 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4552 let _ = unsafe { Box::from_raw(self.contents.result) };
4555 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4556 let _ = unsafe { Box::from_raw(self.contents.err) };
4561 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4562 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4563 let contents = if o.result_ok {
4564 let result = unsafe { o.contents.result };
4565 unsafe { o.contents.result = std::ptr::null_mut() };
4566 CResult_ChannelConfigDecodeErrorZPtr { result }
4568 let err = unsafe { o.contents.err };
4569 unsafe { o.contents.err = std::ptr::null_mut(); }
4570 CResult_ChannelConfigDecodeErrorZPtr { err }
4574 result_ok: o.result_ok,
4578 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4579 fn clone(&self) -> Self {
4581 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4582 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4585 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4586 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4592 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4593 /// but with all dynamically-allocated buffers duplicated in new buffers.
4594 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
4596 /// The contents of CResult_OutPointDecodeErrorZ
4597 pub union CResult_OutPointDecodeErrorZPtr {
4598 /// A pointer to the contents in the success state.
4599 /// Reading from this pointer when `result_ok` is not set is undefined.
4600 pub result: *mut crate::lightning::chain::transaction::OutPoint,
4601 /// A pointer to the contents in the error state.
4602 /// Reading from this pointer when `result_ok` is set is undefined.
4603 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4606 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4607 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4608 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4609 pub struct CResult_OutPointDecodeErrorZ {
4610 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4611 /// `err` or `result` depending on the state of `result_ok`.
4612 pub contents: CResult_OutPointDecodeErrorZPtr,
4613 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4614 pub result_ok: bool,
4617 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4618 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4619 CResult_OutPointDecodeErrorZ {
4620 contents: CResult_OutPointDecodeErrorZPtr {
4621 result: Box::into_raw(Box::new(o)),
4627 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4628 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4629 CResult_OutPointDecodeErrorZ {
4630 contents: CResult_OutPointDecodeErrorZPtr {
4631 err: Box::into_raw(Box::new(e)),
4637 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
4638 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
4639 impl Drop for CResult_OutPointDecodeErrorZ {
4640 fn drop(&mut self) {
4642 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4643 let _ = unsafe { Box::from_raw(self.contents.result) };
4646 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4647 let _ = unsafe { Box::from_raw(self.contents.err) };
4652 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
4653 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4654 let contents = if o.result_ok {
4655 let result = unsafe { o.contents.result };
4656 unsafe { o.contents.result = std::ptr::null_mut() };
4657 CResult_OutPointDecodeErrorZPtr { result }
4659 let err = unsafe { o.contents.err };
4660 unsafe { o.contents.err = std::ptr::null_mut(); }
4661 CResult_OutPointDecodeErrorZPtr { err }
4665 result_ok: o.result_ok,
4669 impl Clone for CResult_OutPointDecodeErrorZ {
4670 fn clone(&self) -> Self {
4672 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
4673 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
4676 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
4677 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4683 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
4684 /// but with all dynamically-allocated buffers duplicated in new buffers.
4685 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
4687 /// The contents of CResult_SiPrefixNoneZ
4688 pub union CResult_SiPrefixNoneZPtr {
4689 /// A pointer to the contents in the success state.
4690 /// Reading from this pointer when `result_ok` is not set is undefined.
4691 pub result: *mut crate::lightning_invoice::SiPrefix,
4692 /// Note that this value is always NULL, as there are no contents in the Err variant
4693 pub err: *mut std::ffi::c_void,
4696 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4697 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4698 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4699 pub struct CResult_SiPrefixNoneZ {
4700 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
4701 /// `err` or `result` depending on the state of `result_ok`.
4702 pub contents: CResult_SiPrefixNoneZPtr,
4703 /// Whether this CResult_SiPrefixNoneZ represents a success state.
4704 pub result_ok: bool,
4707 /// Creates a new CResult_SiPrefixNoneZ in the success state.
4708 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
4709 CResult_SiPrefixNoneZ {
4710 contents: CResult_SiPrefixNoneZPtr {
4711 result: Box::into_raw(Box::new(o)),
4717 /// Creates a new CResult_SiPrefixNoneZ in the error state.
4718 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
4719 CResult_SiPrefixNoneZ {
4720 contents: CResult_SiPrefixNoneZPtr {
4721 err: std::ptr::null_mut(),
4727 /// Frees any resources used by the CResult_SiPrefixNoneZ.
4728 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
4729 impl Drop for CResult_SiPrefixNoneZ {
4730 fn drop(&mut self) {
4732 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4733 let _ = unsafe { Box::from_raw(self.contents.result) };
4739 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
4740 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
4741 let contents = if o.result_ok {
4742 let result = unsafe { o.contents.result };
4743 unsafe { o.contents.result = std::ptr::null_mut() };
4744 CResult_SiPrefixNoneZPtr { result }
4746 let _ = unsafe { Box::from_raw(o.contents.err) };
4747 o.contents.err = std::ptr::null_mut();
4748 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
4752 result_ok: o.result_ok,
4756 impl Clone for CResult_SiPrefixNoneZ {
4757 fn clone(&self) -> Self {
4759 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
4760 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
4763 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
4764 err: std::ptr::null_mut()
4770 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
4771 /// but with all dynamically-allocated buffers duplicated in new buffers.
4772 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
4774 /// The contents of CResult_InvoiceNoneZ
4775 pub union CResult_InvoiceNoneZPtr {
4776 /// A pointer to the contents in the success state.
4777 /// Reading from this pointer when `result_ok` is not set is undefined.
4778 pub result: *mut crate::lightning_invoice::Invoice,
4779 /// Note that this value is always NULL, as there are no contents in the Err variant
4780 pub err: *mut std::ffi::c_void,
4783 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
4784 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
4785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4786 pub struct CResult_InvoiceNoneZ {
4787 /// The contents of this CResult_InvoiceNoneZ, accessible via either
4788 /// `err` or `result` depending on the state of `result_ok`.
4789 pub contents: CResult_InvoiceNoneZPtr,
4790 /// Whether this CResult_InvoiceNoneZ represents a success state.
4791 pub result_ok: bool,
4794 /// Creates a new CResult_InvoiceNoneZ in the success state.
4795 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
4796 CResult_InvoiceNoneZ {
4797 contents: CResult_InvoiceNoneZPtr {
4798 result: Box::into_raw(Box::new(o)),
4804 /// Creates a new CResult_InvoiceNoneZ in the error state.
4805 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
4806 CResult_InvoiceNoneZ {
4807 contents: CResult_InvoiceNoneZPtr {
4808 err: std::ptr::null_mut(),
4814 /// Frees any resources used by the CResult_InvoiceNoneZ.
4815 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
4816 impl Drop for CResult_InvoiceNoneZ {
4817 fn drop(&mut self) {
4819 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4820 let _ = unsafe { Box::from_raw(self.contents.result) };
4826 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
4827 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
4828 let contents = if o.result_ok {
4829 let result = unsafe { o.contents.result };
4830 unsafe { o.contents.result = std::ptr::null_mut() };
4831 CResult_InvoiceNoneZPtr { result }
4833 let _ = unsafe { Box::from_raw(o.contents.err) };
4834 o.contents.err = std::ptr::null_mut();
4835 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
4839 result_ok: o.result_ok,
4843 impl Clone for CResult_InvoiceNoneZ {
4844 fn clone(&self) -> Self {
4846 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
4847 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
4850 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
4851 err: std::ptr::null_mut()
4857 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
4858 /// but with all dynamically-allocated buffers duplicated in new buffers.
4859 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
4861 /// The contents of CResult_SignedRawInvoiceNoneZ
4862 pub union CResult_SignedRawInvoiceNoneZPtr {
4863 /// A pointer to the contents in the success state.
4864 /// Reading from this pointer when `result_ok` is not set is undefined.
4865 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
4866 /// Note that this value is always NULL, as there are no contents in the Err variant
4867 pub err: *mut std::ffi::c_void,
4870 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4871 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4872 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4873 pub struct CResult_SignedRawInvoiceNoneZ {
4874 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4875 /// `err` or `result` depending on the state of `result_ok`.
4876 pub contents: CResult_SignedRawInvoiceNoneZPtr,
4877 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4878 pub result_ok: bool,
4881 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
4882 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
4883 CResult_SignedRawInvoiceNoneZ {
4884 contents: CResult_SignedRawInvoiceNoneZPtr {
4885 result: Box::into_raw(Box::new(o)),
4891 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
4892 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
4893 CResult_SignedRawInvoiceNoneZ {
4894 contents: CResult_SignedRawInvoiceNoneZPtr {
4895 err: std::ptr::null_mut(),
4901 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
4902 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
4903 impl Drop for CResult_SignedRawInvoiceNoneZ {
4904 fn drop(&mut self) {
4906 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4907 let _ = unsafe { Box::from_raw(self.contents.result) };
4913 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
4914 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
4915 let contents = if o.result_ok {
4916 let result = unsafe { o.contents.result };
4917 unsafe { o.contents.result = std::ptr::null_mut() };
4918 CResult_SignedRawInvoiceNoneZPtr { result }
4920 let _ = unsafe { Box::from_raw(o.contents.err) };
4921 o.contents.err = std::ptr::null_mut();
4922 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
4926 result_ok: o.result_ok,
4930 impl Clone for CResult_SignedRawInvoiceNoneZ {
4931 fn clone(&self) -> Self {
4933 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
4934 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
4937 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
4938 err: std::ptr::null_mut()
4944 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
4945 /// but with all dynamically-allocated buffers duplicated in new buffers.
4946 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
4948 /// A tuple of 3 elements. See the individual fields for the types contained.
4949 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4950 /// The element at position 0
4951 pub a: crate::lightning_invoice::RawInvoice,
4952 /// The element at position 1
4953 pub b: crate::c_types::ThirtyTwoBytes,
4954 /// The element at position 2
4955 pub c: crate::lightning_invoice::InvoiceSignature,
4957 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4958 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
4966 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4967 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
4968 (self.a, self.b, self.c)
4971 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4972 fn clone(&self) -> Self {
4981 /// Creates a new tuple which has the same data as `orig`
4982 /// but with all dynamically-allocated buffers duplicated in new buffers.
4983 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { orig.clone() }
4984 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
4986 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 {
4987 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
4991 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
4992 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
4994 /// The contents of CResult_PayeePubKeyErrorZ
4995 pub union CResult_PayeePubKeyErrorZPtr {
4996 /// A pointer to the contents in the success state.
4997 /// Reading from this pointer when `result_ok` is not set is undefined.
4998 pub result: *mut crate::lightning_invoice::PayeePubKey,
4999 /// A pointer to the contents in the error state.
5000 /// Reading from this pointer when `result_ok` is set is undefined.
5001 pub err: *mut crate::c_types::Secp256k1Error,
5004 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5005 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5007 pub struct CResult_PayeePubKeyErrorZ {
5008 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5009 /// `err` or `result` depending on the state of `result_ok`.
5010 pub contents: CResult_PayeePubKeyErrorZPtr,
5011 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
5012 pub result_ok: bool,
5015 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
5016 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
5017 CResult_PayeePubKeyErrorZ {
5018 contents: CResult_PayeePubKeyErrorZPtr {
5019 result: Box::into_raw(Box::new(o)),
5025 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
5026 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
5027 CResult_PayeePubKeyErrorZ {
5028 contents: CResult_PayeePubKeyErrorZPtr {
5029 err: Box::into_raw(Box::new(e)),
5035 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
5036 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
5037 impl Drop for CResult_PayeePubKeyErrorZ {
5038 fn drop(&mut self) {
5040 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5041 let _ = unsafe { Box::from_raw(self.contents.result) };
5044 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5045 let _ = unsafe { Box::from_raw(self.contents.err) };
5050 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
5051 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
5052 let contents = if o.result_ok {
5053 let result = unsafe { o.contents.result };
5054 unsafe { o.contents.result = std::ptr::null_mut() };
5055 CResult_PayeePubKeyErrorZPtr { result }
5057 let err = unsafe { o.contents.err };
5058 unsafe { o.contents.err = std::ptr::null_mut(); }
5059 CResult_PayeePubKeyErrorZPtr { err }
5063 result_ok: o.result_ok,
5067 impl Clone for CResult_PayeePubKeyErrorZ {
5068 fn clone(&self) -> Self {
5070 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
5071 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
5074 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
5075 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5081 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
5082 /// but with all dynamically-allocated buffers duplicated in new buffers.
5083 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { orig.clone() }
5085 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5086 /// This corresponds to std::vector in C++
5087 pub struct CVec_PrivateRouteZ {
5088 /// The elements in the array.
5089 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5090 pub data: *mut crate::lightning_invoice::PrivateRoute,
5091 /// The number of elements pointed to by `data`.
5094 impl CVec_PrivateRouteZ {
5095 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5096 if self.datalen == 0 { return Vec::new(); }
5097 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5098 self.data = std::ptr::null_mut();
5102 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5103 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5106 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5107 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5108 let datalen = v.len();
5109 let data = Box::into_raw(v.into_boxed_slice());
5110 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5114 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5115 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5116 impl Drop for CVec_PrivateRouteZ {
5117 fn drop(&mut self) {
5118 if self.datalen == 0 { return; }
5119 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5122 impl Clone for CVec_PrivateRouteZ {
5123 fn clone(&self) -> Self {
5124 let mut res = Vec::new();
5125 if self.datalen == 0 { return Self::from(res); }
5126 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5131 /// The contents of CResult_PositiveTimestampCreationErrorZ
5132 pub union CResult_PositiveTimestampCreationErrorZPtr {
5133 /// A pointer to the contents in the success state.
5134 /// Reading from this pointer when `result_ok` is not set is undefined.
5135 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5136 /// A pointer to the contents in the error state.
5137 /// Reading from this pointer when `result_ok` is set is undefined.
5138 pub err: *mut crate::lightning_invoice::CreationError,
5141 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5142 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5144 pub struct CResult_PositiveTimestampCreationErrorZ {
5145 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5146 /// `err` or `result` depending on the state of `result_ok`.
5147 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5148 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5149 pub result_ok: bool,
5152 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5153 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5154 CResult_PositiveTimestampCreationErrorZ {
5155 contents: CResult_PositiveTimestampCreationErrorZPtr {
5156 result: Box::into_raw(Box::new(o)),
5162 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5163 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5164 CResult_PositiveTimestampCreationErrorZ {
5165 contents: CResult_PositiveTimestampCreationErrorZPtr {
5166 err: Box::into_raw(Box::new(e)),
5172 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5173 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5174 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5175 fn drop(&mut self) {
5177 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5178 let _ = unsafe { Box::from_raw(self.contents.result) };
5181 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5182 let _ = unsafe { Box::from_raw(self.contents.err) };
5187 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5188 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5189 let contents = if o.result_ok {
5190 let result = unsafe { o.contents.result };
5191 unsafe { o.contents.result = std::ptr::null_mut() };
5192 CResult_PositiveTimestampCreationErrorZPtr { result }
5194 let err = unsafe { o.contents.err };
5195 unsafe { o.contents.err = std::ptr::null_mut(); }
5196 CResult_PositiveTimestampCreationErrorZPtr { err }
5200 result_ok: o.result_ok,
5204 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5205 fn clone(&self) -> Self {
5207 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5208 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5211 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5212 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5218 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5219 /// but with all dynamically-allocated buffers duplicated in new buffers.
5220 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
5222 /// The contents of CResult_NoneSemanticErrorZ
5223 pub union CResult_NoneSemanticErrorZPtr {
5224 /// Note that this value is always NULL, as there are no contents in the OK variant
5225 pub result: *mut std::ffi::c_void,
5226 /// A pointer to the contents in the error state.
5227 /// Reading from this pointer when `result_ok` is set is undefined.
5228 pub err: *mut crate::lightning_invoice::SemanticError,
5231 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5232 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5234 pub struct CResult_NoneSemanticErrorZ {
5235 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5236 /// `err` or `result` depending on the state of `result_ok`.
5237 pub contents: CResult_NoneSemanticErrorZPtr,
5238 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5239 pub result_ok: bool,
5242 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5243 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5244 CResult_NoneSemanticErrorZ {
5245 contents: CResult_NoneSemanticErrorZPtr {
5246 result: std::ptr::null_mut(),
5252 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5253 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5254 CResult_NoneSemanticErrorZ {
5255 contents: CResult_NoneSemanticErrorZPtr {
5256 err: Box::into_raw(Box::new(e)),
5262 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5263 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5264 impl Drop for CResult_NoneSemanticErrorZ {
5265 fn drop(&mut self) {
5268 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5269 let _ = unsafe { Box::from_raw(self.contents.err) };
5274 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5275 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5276 let contents = if o.result_ok {
5277 let _ = unsafe { Box::from_raw(o.contents.result) };
5278 o.contents.result = std::ptr::null_mut();
5279 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5281 let err = unsafe { o.contents.err };
5282 unsafe { o.contents.err = std::ptr::null_mut(); }
5283 CResult_NoneSemanticErrorZPtr { err }
5287 result_ok: o.result_ok,
5291 impl Clone for CResult_NoneSemanticErrorZ {
5292 fn clone(&self) -> Self {
5294 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5295 result: std::ptr::null_mut()
5298 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5299 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5305 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5306 /// but with all dynamically-allocated buffers duplicated in new buffers.
5307 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
5309 /// The contents of CResult_InvoiceSemanticErrorZ
5310 pub union CResult_InvoiceSemanticErrorZPtr {
5311 /// A pointer to the contents in the success state.
5312 /// Reading from this pointer when `result_ok` is not set is undefined.
5313 pub result: *mut crate::lightning_invoice::Invoice,
5314 /// A pointer to the contents in the error state.
5315 /// Reading from this pointer when `result_ok` is set is undefined.
5316 pub err: *mut crate::lightning_invoice::SemanticError,
5319 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5320 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5321 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5322 pub struct CResult_InvoiceSemanticErrorZ {
5323 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5324 /// `err` or `result` depending on the state of `result_ok`.
5325 pub contents: CResult_InvoiceSemanticErrorZPtr,
5326 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5327 pub result_ok: bool,
5330 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5331 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5332 CResult_InvoiceSemanticErrorZ {
5333 contents: CResult_InvoiceSemanticErrorZPtr {
5334 result: Box::into_raw(Box::new(o)),
5340 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5341 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5342 CResult_InvoiceSemanticErrorZ {
5343 contents: CResult_InvoiceSemanticErrorZPtr {
5344 err: Box::into_raw(Box::new(e)),
5350 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
5351 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5352 impl Drop for CResult_InvoiceSemanticErrorZ {
5353 fn drop(&mut self) {
5355 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5356 let _ = unsafe { Box::from_raw(self.contents.result) };
5359 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5360 let _ = unsafe { Box::from_raw(self.contents.err) };
5365 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5366 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
5367 let contents = if o.result_ok {
5368 let result = unsafe { o.contents.result };
5369 unsafe { o.contents.result = std::ptr::null_mut() };
5370 CResult_InvoiceSemanticErrorZPtr { result }
5372 let err = unsafe { o.contents.err };
5373 unsafe { o.contents.err = std::ptr::null_mut(); }
5374 CResult_InvoiceSemanticErrorZPtr { err }
5378 result_ok: o.result_ok,
5382 impl Clone for CResult_InvoiceSemanticErrorZ {
5383 fn clone(&self) -> Self {
5385 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5386 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5389 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
5390 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5396 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
5397 /// but with all dynamically-allocated buffers duplicated in new buffers.
5398 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
5400 /// The contents of CResult_DescriptionCreationErrorZ
5401 pub union CResult_DescriptionCreationErrorZPtr {
5402 /// A pointer to the contents in the success state.
5403 /// Reading from this pointer when `result_ok` is not set is undefined.
5404 pub result: *mut crate::lightning_invoice::Description,
5405 /// A pointer to the contents in the error state.
5406 /// Reading from this pointer when `result_ok` is set is undefined.
5407 pub err: *mut crate::lightning_invoice::CreationError,
5410 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5411 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5412 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5413 pub struct CResult_DescriptionCreationErrorZ {
5414 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5415 /// `err` or `result` depending on the state of `result_ok`.
5416 pub contents: CResult_DescriptionCreationErrorZPtr,
5417 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5418 pub result_ok: bool,
5421 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5422 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5423 CResult_DescriptionCreationErrorZ {
5424 contents: CResult_DescriptionCreationErrorZPtr {
5425 result: Box::into_raw(Box::new(o)),
5431 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5432 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5433 CResult_DescriptionCreationErrorZ {
5434 contents: CResult_DescriptionCreationErrorZPtr {
5435 err: Box::into_raw(Box::new(e)),
5441 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
5442 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5443 impl Drop for CResult_DescriptionCreationErrorZ {
5444 fn drop(&mut self) {
5446 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5447 let _ = unsafe { Box::from_raw(self.contents.result) };
5450 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5451 let _ = unsafe { Box::from_raw(self.contents.err) };
5456 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5457 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
5458 let contents = if o.result_ok {
5459 let result = unsafe { o.contents.result };
5460 unsafe { o.contents.result = std::ptr::null_mut() };
5461 CResult_DescriptionCreationErrorZPtr { result }
5463 let err = unsafe { o.contents.err };
5464 unsafe { o.contents.err = std::ptr::null_mut(); }
5465 CResult_DescriptionCreationErrorZPtr { err }
5469 result_ok: o.result_ok,
5473 impl Clone for CResult_DescriptionCreationErrorZ {
5474 fn clone(&self) -> Self {
5476 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5477 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5480 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5481 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5487 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5488 /// but with all dynamically-allocated buffers duplicated in new buffers.
5489 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
5491 /// The contents of CResult_ExpiryTimeCreationErrorZ
5492 pub union CResult_ExpiryTimeCreationErrorZPtr {
5493 /// A pointer to the contents in the success state.
5494 /// Reading from this pointer when `result_ok` is not set is undefined.
5495 pub result: *mut crate::lightning_invoice::ExpiryTime,
5496 /// A pointer to the contents in the error state.
5497 /// Reading from this pointer when `result_ok` is set is undefined.
5498 pub err: *mut crate::lightning_invoice::CreationError,
5501 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5502 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5504 pub struct CResult_ExpiryTimeCreationErrorZ {
5505 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5506 /// `err` or `result` depending on the state of `result_ok`.
5507 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5508 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5509 pub result_ok: bool,
5512 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5513 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5514 CResult_ExpiryTimeCreationErrorZ {
5515 contents: CResult_ExpiryTimeCreationErrorZPtr {
5516 result: Box::into_raw(Box::new(o)),
5522 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5523 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5524 CResult_ExpiryTimeCreationErrorZ {
5525 contents: CResult_ExpiryTimeCreationErrorZPtr {
5526 err: Box::into_raw(Box::new(e)),
5532 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
5533 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
5534 impl Drop for CResult_ExpiryTimeCreationErrorZ {
5535 fn drop(&mut self) {
5537 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5538 let _ = unsafe { Box::from_raw(self.contents.result) };
5541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5542 let _ = unsafe { Box::from_raw(self.contents.err) };
5547 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
5548 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
5549 let contents = if o.result_ok {
5550 let result = unsafe { o.contents.result };
5551 unsafe { o.contents.result = std::ptr::null_mut() };
5552 CResult_ExpiryTimeCreationErrorZPtr { result }
5554 let err = unsafe { o.contents.err };
5555 unsafe { o.contents.err = std::ptr::null_mut(); }
5556 CResult_ExpiryTimeCreationErrorZPtr { err }
5560 result_ok: o.result_ok,
5564 impl Clone for CResult_ExpiryTimeCreationErrorZ {
5565 fn clone(&self) -> Self {
5567 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
5568 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
5571 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
5572 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5578 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
5579 /// but with all dynamically-allocated buffers duplicated in new buffers.
5580 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
5582 /// The contents of CResult_PrivateRouteCreationErrorZ
5583 pub union CResult_PrivateRouteCreationErrorZPtr {
5584 /// A pointer to the contents in the success state.
5585 /// Reading from this pointer when `result_ok` is not set is undefined.
5586 pub result: *mut crate::lightning_invoice::PrivateRoute,
5587 /// A pointer to the contents in the error state.
5588 /// Reading from this pointer when `result_ok` is set is undefined.
5589 pub err: *mut crate::lightning_invoice::CreationError,
5592 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5593 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5595 pub struct CResult_PrivateRouteCreationErrorZ {
5596 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5597 /// `err` or `result` depending on the state of `result_ok`.
5598 pub contents: CResult_PrivateRouteCreationErrorZPtr,
5599 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5600 pub result_ok: bool,
5603 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
5604 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
5605 CResult_PrivateRouteCreationErrorZ {
5606 contents: CResult_PrivateRouteCreationErrorZPtr {
5607 result: Box::into_raw(Box::new(o)),
5613 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
5614 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
5615 CResult_PrivateRouteCreationErrorZ {
5616 contents: CResult_PrivateRouteCreationErrorZPtr {
5617 err: Box::into_raw(Box::new(e)),
5623 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
5624 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
5625 impl Drop for CResult_PrivateRouteCreationErrorZ {
5626 fn drop(&mut self) {
5628 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5629 let _ = unsafe { Box::from_raw(self.contents.result) };
5632 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5633 let _ = unsafe { Box::from_raw(self.contents.err) };
5638 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
5639 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
5640 let contents = if o.result_ok {
5641 let result = unsafe { o.contents.result };
5642 unsafe { o.contents.result = std::ptr::null_mut() };
5643 CResult_PrivateRouteCreationErrorZPtr { result }
5645 let err = unsafe { o.contents.err };
5646 unsafe { o.contents.err = std::ptr::null_mut(); }
5647 CResult_PrivateRouteCreationErrorZPtr { err }
5651 result_ok: o.result_ok,
5655 impl Clone for CResult_PrivateRouteCreationErrorZ {
5656 fn clone(&self) -> Self {
5658 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
5659 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
5662 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
5663 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5669 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
5670 /// but with all dynamically-allocated buffers duplicated in new buffers.
5671 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { orig.clone() }
5673 /// The contents of CResult_StringErrorZ
5674 pub union CResult_StringErrorZPtr {
5675 /// A pointer to the contents in the success state.
5676 /// Reading from this pointer when `result_ok` is not set is undefined.
5677 pub result: *mut crate::c_types::Str,
5678 /// A pointer to the contents in the error state.
5679 /// Reading from this pointer when `result_ok` is set is undefined.
5680 pub err: *mut crate::c_types::Secp256k1Error,
5683 /// A CResult_StringErrorZ represents the result of a fallible operation,
5684 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5685 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5686 pub struct CResult_StringErrorZ {
5687 /// The contents of this CResult_StringErrorZ, accessible via either
5688 /// `err` or `result` depending on the state of `result_ok`.
5689 pub contents: CResult_StringErrorZPtr,
5690 /// Whether this CResult_StringErrorZ represents a success state.
5691 pub result_ok: bool,
5694 /// Creates a new CResult_StringErrorZ in the success state.
5695 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
5696 CResult_StringErrorZ {
5697 contents: CResult_StringErrorZPtr {
5698 result: Box::into_raw(Box::new(o)),
5704 /// Creates a new CResult_StringErrorZ in the error state.
5705 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
5706 CResult_StringErrorZ {
5707 contents: CResult_StringErrorZPtr {
5708 err: Box::into_raw(Box::new(e)),
5714 /// Frees any resources used by the CResult_StringErrorZ.
5715 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
5716 impl Drop for CResult_StringErrorZ {
5717 fn drop(&mut self) {
5719 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5720 let _ = unsafe { Box::from_raw(self.contents.result) };
5723 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5724 let _ = unsafe { Box::from_raw(self.contents.err) };
5729 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
5730 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
5731 let contents = if o.result_ok {
5732 let result = unsafe { o.contents.result };
5733 unsafe { o.contents.result = std::ptr::null_mut() };
5734 CResult_StringErrorZPtr { result }
5736 let err = unsafe { o.contents.err };
5737 unsafe { o.contents.err = std::ptr::null_mut(); }
5738 CResult_StringErrorZPtr { err }
5742 result_ok: o.result_ok,
5747 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5748 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5749 /// A pointer to the contents in the success state.
5750 /// Reading from this pointer when `result_ok` is not set is undefined.
5751 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
5752 /// A pointer to the contents in the error state.
5753 /// Reading from this pointer when `result_ok` is set is undefined.
5754 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5757 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5758 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5760 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
5761 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5762 /// `err` or `result` depending on the state of `result_ok`.
5763 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
5764 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5765 pub result_ok: bool,
5768 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
5769 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5770 CResult_ChannelMonitorUpdateDecodeErrorZ {
5771 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5772 result: Box::into_raw(Box::new(o)),
5778 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
5779 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5780 CResult_ChannelMonitorUpdateDecodeErrorZ {
5781 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5782 err: Box::into_raw(Box::new(e)),
5788 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
5789 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
5790 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
5791 fn drop(&mut self) {
5793 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5794 let _ = unsafe { Box::from_raw(self.contents.result) };
5797 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5798 let _ = unsafe { Box::from_raw(self.contents.err) };
5803 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
5804 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5805 let contents = if o.result_ok {
5806 let result = unsafe { o.contents.result };
5807 unsafe { o.contents.result = std::ptr::null_mut() };
5808 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
5810 let err = unsafe { o.contents.err };
5811 unsafe { o.contents.err = std::ptr::null_mut(); }
5812 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
5816 result_ok: o.result_ok,
5820 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
5821 fn clone(&self) -> Self {
5823 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5824 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
5827 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5828 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5834 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
5835 /// but with all dynamically-allocated buffers duplicated in new buffers.
5836 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
5838 /// The contents of CResult_HTLCUpdateDecodeErrorZ
5839 pub union CResult_HTLCUpdateDecodeErrorZPtr {
5840 /// A pointer to the contents in the success state.
5841 /// Reading from this pointer when `result_ok` is not set is undefined.
5842 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
5843 /// A pointer to the contents in the error state.
5844 /// Reading from this pointer when `result_ok` is set is undefined.
5845 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5848 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5849 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5851 pub struct CResult_HTLCUpdateDecodeErrorZ {
5852 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5853 /// `err` or `result` depending on the state of `result_ok`.
5854 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
5855 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5856 pub result_ok: bool,
5859 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
5860 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
5861 CResult_HTLCUpdateDecodeErrorZ {
5862 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5863 result: Box::into_raw(Box::new(o)),
5869 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
5870 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
5871 CResult_HTLCUpdateDecodeErrorZ {
5872 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5873 err: Box::into_raw(Box::new(e)),
5879 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
5880 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
5881 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
5882 fn drop(&mut self) {
5884 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5885 let _ = unsafe { Box::from_raw(self.contents.result) };
5888 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5889 let _ = unsafe { Box::from_raw(self.contents.err) };
5894 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
5895 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5896 let contents = if o.result_ok {
5897 let result = unsafe { o.contents.result };
5898 unsafe { o.contents.result = std::ptr::null_mut() };
5899 CResult_HTLCUpdateDecodeErrorZPtr { result }
5901 let err = unsafe { o.contents.err };
5902 unsafe { o.contents.err = std::ptr::null_mut(); }
5903 CResult_HTLCUpdateDecodeErrorZPtr { err }
5907 result_ok: o.result_ok,
5911 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
5912 fn clone(&self) -> Self {
5914 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5915 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
5918 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5919 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5925 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
5926 /// but with all dynamically-allocated buffers duplicated in new buffers.
5927 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
5929 /// The contents of CResult_NoneMonitorUpdateErrorZ
5930 pub union CResult_NoneMonitorUpdateErrorZPtr {
5931 /// Note that this value is always NULL, as there are no contents in the OK variant
5932 pub result: *mut std::ffi::c_void,
5933 /// A pointer to the contents in the error state.
5934 /// Reading from this pointer when `result_ok` is set is undefined.
5935 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
5938 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5939 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5941 pub struct CResult_NoneMonitorUpdateErrorZ {
5942 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5943 /// `err` or `result` depending on the state of `result_ok`.
5944 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
5945 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5946 pub result_ok: bool,
5949 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
5950 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
5951 CResult_NoneMonitorUpdateErrorZ {
5952 contents: CResult_NoneMonitorUpdateErrorZPtr {
5953 result: std::ptr::null_mut(),
5959 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
5960 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
5961 CResult_NoneMonitorUpdateErrorZ {
5962 contents: CResult_NoneMonitorUpdateErrorZPtr {
5963 err: Box::into_raw(Box::new(e)),
5969 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
5970 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
5971 impl Drop for CResult_NoneMonitorUpdateErrorZ {
5972 fn drop(&mut self) {
5975 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5976 let _ = unsafe { Box::from_raw(self.contents.err) };
5981 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
5982 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
5983 let contents = if o.result_ok {
5984 let _ = unsafe { Box::from_raw(o.contents.result) };
5985 o.contents.result = std::ptr::null_mut();
5986 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
5988 let err = unsafe { o.contents.err };
5989 unsafe { o.contents.err = std::ptr::null_mut(); }
5990 CResult_NoneMonitorUpdateErrorZPtr { err }
5994 result_ok: o.result_ok,
5998 impl Clone for CResult_NoneMonitorUpdateErrorZ {
5999 fn clone(&self) -> Self {
6001 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
6002 result: std::ptr::null_mut()
6005 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
6006 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
6012 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
6013 /// but with all dynamically-allocated buffers duplicated in new buffers.
6014 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
6016 /// A tuple of 2 elements. See the individual fields for the types contained.
6017 pub struct C2Tuple_OutPointScriptZ {
6018 /// The element at position 0
6019 pub a: crate::lightning::chain::transaction::OutPoint,
6020 /// The element at position 1
6021 pub b: crate::c_types::derived::CVec_u8Z,
6023 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
6024 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
6031 impl C2Tuple_OutPointScriptZ {
6032 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
6036 impl Clone for C2Tuple_OutPointScriptZ {
6037 fn clone(&self) -> Self {
6045 /// Creates a new tuple which has the same data as `orig`
6046 /// but with all dynamically-allocated buffers duplicated in new buffers.
6047 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
6048 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
6050 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
6051 C2Tuple_OutPointScriptZ { a, b, }
6055 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
6056 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
6058 /// A tuple of 2 elements. See the individual fields for the types contained.
6059 pub struct C2Tuple_u32ScriptZ {
6060 /// The element at position 0
6062 /// The element at position 1
6063 pub b: crate::c_types::derived::CVec_u8Z,
6065 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
6066 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
6073 impl C2Tuple_u32ScriptZ {
6074 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
6078 impl Clone for C2Tuple_u32ScriptZ {
6079 fn clone(&self) -> Self {
6087 /// Creates a new tuple which has the same data as `orig`
6088 /// but with all dynamically-allocated buffers duplicated in new buffers.
6089 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
6090 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6092 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6093 C2Tuple_u32ScriptZ { a, b, }
6097 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6098 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6100 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6101 /// This corresponds to std::vector in C++
6102 pub struct CVec_C2Tuple_u32ScriptZZ {
6103 /// The elements in the array.
6104 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6105 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6106 /// The number of elements pointed to by `data`.
6109 impl CVec_C2Tuple_u32ScriptZZ {
6110 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6111 if self.datalen == 0 { return Vec::new(); }
6112 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6113 self.data = std::ptr::null_mut();
6117 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6118 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6121 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6122 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6123 let datalen = v.len();
6124 let data = Box::into_raw(v.into_boxed_slice());
6125 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6129 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6130 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6131 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6132 fn drop(&mut self) {
6133 if self.datalen == 0 { return; }
6134 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6137 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6138 fn clone(&self) -> Self {
6139 let mut res = Vec::new();
6140 if self.datalen == 0 { return Self::from(res); }
6141 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6146 /// A tuple of 2 elements. See the individual fields for the types contained.
6147 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6148 /// The element at position 0
6149 pub a: crate::c_types::ThirtyTwoBytes,
6150 /// The element at position 1
6151 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6153 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6154 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6161 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6162 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6166 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6167 fn clone(&self) -> Self {
6175 /// Creates a new tuple which has the same data as `orig`
6176 /// but with all dynamically-allocated buffers duplicated in new buffers.
6177 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { orig.clone() }
6178 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6180 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 {
6181 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6185 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6186 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6188 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6189 /// This corresponds to std::vector in C++
6190 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6191 /// The elements in the array.
6192 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6193 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6194 /// The number of elements pointed to by `data`.
6197 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6198 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6199 if self.datalen == 0 { return Vec::new(); }
6200 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6201 self.data = std::ptr::null_mut();
6205 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6206 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6209 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6210 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6211 let datalen = v.len();
6212 let data = Box::into_raw(v.into_boxed_slice());
6213 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6217 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6218 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6219 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6220 fn drop(&mut self) {
6221 if self.datalen == 0 { return; }
6222 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6225 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6226 fn clone(&self) -> Self {
6227 let mut res = Vec::new();
6228 if self.datalen == 0 { return Self::from(res); }
6229 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6234 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6235 /// This corresponds to std::vector in C++
6236 pub struct CVec_EventZ {
6237 /// The elements in the array.
6238 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6239 pub data: *mut crate::lightning::util::events::Event,
6240 /// The number of elements pointed to by `data`.
6244 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6245 if self.datalen == 0 { return Vec::new(); }
6246 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6247 self.data = std::ptr::null_mut();
6251 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6252 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6255 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6256 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6257 let datalen = v.len();
6258 let data = Box::into_raw(v.into_boxed_slice());
6259 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6263 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6264 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6265 impl Drop for CVec_EventZ {
6266 fn drop(&mut self) {
6267 if self.datalen == 0 { return; }
6268 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6271 impl Clone for CVec_EventZ {
6272 fn clone(&self) -> Self {
6273 let mut res = Vec::new();
6274 if self.datalen == 0 { return Self::from(res); }
6275 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6280 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6281 /// This corresponds to std::vector in C++
6282 pub struct CVec_TransactionZ {
6283 /// The elements in the array.
6284 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6285 pub data: *mut crate::c_types::Transaction,
6286 /// The number of elements pointed to by `data`.
6289 impl CVec_TransactionZ {
6290 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6291 if self.datalen == 0 { return Vec::new(); }
6292 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6293 self.data = std::ptr::null_mut();
6297 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6298 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6301 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6302 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6303 let datalen = v.len();
6304 let data = Box::into_raw(v.into_boxed_slice());
6305 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6309 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6310 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6311 impl Drop for CVec_TransactionZ {
6312 fn drop(&mut self) {
6313 if self.datalen == 0 { return; }
6314 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6317 impl Clone for CVec_TransactionZ {
6318 fn clone(&self) -> Self {
6319 let mut res = Vec::new();
6320 if self.datalen == 0 { return Self::from(res); }
6321 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6326 /// A tuple of 2 elements. See the individual fields for the types contained.
6327 pub struct C2Tuple_u32TxOutZ {
6328 /// The element at position 0
6330 /// The element at position 1
6331 pub b: crate::c_types::TxOut,
6333 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6334 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6341 impl C2Tuple_u32TxOutZ {
6342 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6346 impl Clone for C2Tuple_u32TxOutZ {
6347 fn clone(&self) -> Self {
6355 /// Creates a new tuple which has the same data as `orig`
6356 /// but with all dynamically-allocated buffers duplicated in new buffers.
6357 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
6358 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6360 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6361 C2Tuple_u32TxOutZ { a, b, }
6365 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6366 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6368 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6369 /// This corresponds to std::vector in C++
6370 pub struct CVec_C2Tuple_u32TxOutZZ {
6371 /// The elements in the array.
6372 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6373 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6374 /// The number of elements pointed to by `data`.
6377 impl CVec_C2Tuple_u32TxOutZZ {
6378 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6379 if self.datalen == 0 { return Vec::new(); }
6380 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6381 self.data = std::ptr::null_mut();
6385 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6386 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6389 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6390 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6391 let datalen = v.len();
6392 let data = Box::into_raw(v.into_boxed_slice());
6393 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6397 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6398 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6399 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6400 fn drop(&mut self) {
6401 if self.datalen == 0 { return; }
6402 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6405 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6406 fn clone(&self) -> Self {
6407 let mut res = Vec::new();
6408 if self.datalen == 0 { return Self::from(res); }
6409 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6414 /// A tuple of 2 elements. See the individual fields for the types contained.
6415 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6416 /// The element at position 0
6417 pub a: crate::c_types::ThirtyTwoBytes,
6418 /// The element at position 1
6419 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6421 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6422 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6429 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6430 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6434 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6435 fn clone(&self) -> Self {
6443 /// Creates a new tuple which has the same data as `orig`
6444 /// but with all dynamically-allocated buffers duplicated in new buffers.
6445 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { orig.clone() }
6446 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6448 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 {
6449 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6453 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6454 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6456 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6457 /// This corresponds to std::vector in C++
6458 pub struct CVec_TransactionOutputsZ {
6459 /// The elements in the array.
6460 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6461 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6462 /// The number of elements pointed to by `data`.
6465 impl CVec_TransactionOutputsZ {
6466 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6467 if self.datalen == 0 { return Vec::new(); }
6468 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6469 self.data = std::ptr::null_mut();
6473 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6474 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6477 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6478 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6479 let datalen = v.len();
6480 let data = Box::into_raw(v.into_boxed_slice());
6481 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6485 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6486 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6487 impl Drop for CVec_TransactionOutputsZ {
6488 fn drop(&mut self) {
6489 if self.datalen == 0 { return; }
6490 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6493 impl Clone for CVec_TransactionOutputsZ {
6494 fn clone(&self) -> Self {
6495 let mut res = Vec::new();
6496 if self.datalen == 0 { return Self::from(res); }
6497 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6502 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6503 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6504 /// A pointer to the contents in the success state.
6505 /// Reading from this pointer when `result_ok` is not set is undefined.
6506 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
6507 /// A pointer to the contents in the error state.
6508 /// Reading from this pointer when `result_ok` is set is undefined.
6509 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6512 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6513 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6515 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6516 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6517 /// `err` or `result` depending on the state of `result_ok`.
6518 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
6519 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6520 pub result_ok: bool,
6523 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
6524 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6525 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6526 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6527 result: Box::into_raw(Box::new(o)),
6533 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
6534 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6535 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6536 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6537 err: Box::into_raw(Box::new(e)),
6543 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
6544 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
6545 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6546 fn drop(&mut self) {
6548 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6549 let _ = unsafe { Box::from_raw(self.contents.result) };
6552 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6553 let _ = unsafe { Box::from_raw(self.contents.err) };
6558 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6559 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6560 let contents = if o.result_ok {
6561 let result = unsafe { o.contents.result };
6562 unsafe { o.contents.result = std::ptr::null_mut() };
6563 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
6565 let err = unsafe { o.contents.err };
6566 unsafe { o.contents.err = std::ptr::null_mut(); }
6567 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
6571 result_ok: o.result_ok,
6576 /// The contents of CResult_boolLightningErrorZ
6577 pub union CResult_boolLightningErrorZPtr {
6578 /// A pointer to the contents in the success state.
6579 /// Reading from this pointer when `result_ok` is not set is undefined.
6580 pub result: *mut bool,
6581 /// A pointer to the contents in the error state.
6582 /// Reading from this pointer when `result_ok` is set is undefined.
6583 pub err: *mut crate::lightning::ln::msgs::LightningError,
6586 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6587 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6589 pub struct CResult_boolLightningErrorZ {
6590 /// The contents of this CResult_boolLightningErrorZ, accessible via either
6591 /// `err` or `result` depending on the state of `result_ok`.
6592 pub contents: CResult_boolLightningErrorZPtr,
6593 /// Whether this CResult_boolLightningErrorZ represents a success state.
6594 pub result_ok: bool,
6597 /// Creates a new CResult_boolLightningErrorZ in the success state.
6598 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6599 CResult_boolLightningErrorZ {
6600 contents: CResult_boolLightningErrorZPtr {
6601 result: Box::into_raw(Box::new(o)),
6607 /// Creates a new CResult_boolLightningErrorZ in the error state.
6608 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6609 CResult_boolLightningErrorZ {
6610 contents: CResult_boolLightningErrorZPtr {
6611 err: Box::into_raw(Box::new(e)),
6617 /// Frees any resources used by the CResult_boolLightningErrorZ.
6618 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6619 impl Drop for CResult_boolLightningErrorZ {
6620 fn drop(&mut self) {
6622 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6623 let _ = unsafe { Box::from_raw(self.contents.result) };
6626 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6627 let _ = unsafe { Box::from_raw(self.contents.err) };
6632 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6633 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6634 let contents = if o.result_ok {
6635 let result = unsafe { o.contents.result };
6636 unsafe { o.contents.result = std::ptr::null_mut() };
6637 CResult_boolLightningErrorZPtr { result }
6639 let err = unsafe { o.contents.err };
6640 unsafe { o.contents.err = std::ptr::null_mut(); }
6641 CResult_boolLightningErrorZPtr { err }
6645 result_ok: o.result_ok,
6649 impl Clone for CResult_boolLightningErrorZ {
6650 fn clone(&self) -> Self {
6652 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6653 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6656 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6657 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6663 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6664 /// but with all dynamically-allocated buffers duplicated in new buffers.
6665 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
6667 /// A tuple of 3 elements. See the individual fields for the types contained.
6668 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6669 /// The element at position 0
6670 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6671 /// The element at position 1
6672 pub b: crate::lightning::ln::msgs::ChannelUpdate,
6673 /// The element at position 2
6674 pub c: crate::lightning::ln::msgs::ChannelUpdate,
6676 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6677 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6685 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6686 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6687 (self.a, self.b, self.c)
6690 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6691 fn clone(&self) -> Self {
6700 /// Creates a new tuple which has the same data as `orig`
6701 /// but with all dynamically-allocated buffers duplicated in new buffers.
6702 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
6703 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6705 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 {
6706 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6710 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6711 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6713 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6714 /// This corresponds to std::vector in C++
6715 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6716 /// The elements in the array.
6717 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6718 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
6719 /// The number of elements pointed to by `data`.
6722 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6723 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
6724 if self.datalen == 0 { return Vec::new(); }
6725 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6726 self.data = std::ptr::null_mut();
6730 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
6731 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6734 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6735 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
6736 let datalen = v.len();
6737 let data = Box::into_raw(v.into_boxed_slice());
6738 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6742 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6743 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6744 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6745 fn drop(&mut self) {
6746 if self.datalen == 0 { return; }
6747 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6750 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6751 fn clone(&self) -> Self {
6752 let mut res = Vec::new();
6753 if self.datalen == 0 { return Self::from(res); }
6754 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6759 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6760 /// This corresponds to std::vector in C++
6761 pub struct CVec_NodeAnnouncementZ {
6762 /// The elements in the array.
6763 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6764 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
6765 /// The number of elements pointed to by `data`.
6768 impl CVec_NodeAnnouncementZ {
6769 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
6770 if self.datalen == 0 { return Vec::new(); }
6771 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6772 self.data = std::ptr::null_mut();
6776 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
6777 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6780 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
6781 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
6782 let datalen = v.len();
6783 let data = Box::into_raw(v.into_boxed_slice());
6784 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6788 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6789 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
6790 impl Drop for CVec_NodeAnnouncementZ {
6791 fn drop(&mut self) {
6792 if self.datalen == 0 { return; }
6793 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6796 impl Clone for CVec_NodeAnnouncementZ {
6797 fn clone(&self) -> Self {
6798 let mut res = Vec::new();
6799 if self.datalen == 0 { return Self::from(res); }
6800 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6805 /// The contents of CResult_NoneLightningErrorZ
6806 pub union CResult_NoneLightningErrorZPtr {
6807 /// Note that this value is always NULL, as there are no contents in the OK variant
6808 pub result: *mut std::ffi::c_void,
6809 /// A pointer to the contents in the error state.
6810 /// Reading from this pointer when `result_ok` is set is undefined.
6811 pub err: *mut crate::lightning::ln::msgs::LightningError,
6814 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6815 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6816 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6817 pub struct CResult_NoneLightningErrorZ {
6818 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6819 /// `err` or `result` depending on the state of `result_ok`.
6820 pub contents: CResult_NoneLightningErrorZPtr,
6821 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6822 pub result_ok: bool,
6825 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6826 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6827 CResult_NoneLightningErrorZ {
6828 contents: CResult_NoneLightningErrorZPtr {
6829 result: std::ptr::null_mut(),
6835 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6836 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6837 CResult_NoneLightningErrorZ {
6838 contents: CResult_NoneLightningErrorZPtr {
6839 err: Box::into_raw(Box::new(e)),
6845 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6846 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6847 impl Drop for CResult_NoneLightningErrorZ {
6848 fn drop(&mut self) {
6851 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6852 let _ = unsafe { Box::from_raw(self.contents.err) };
6857 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6858 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6859 let contents = if o.result_ok {
6860 let _ = unsafe { Box::from_raw(o.contents.result) };
6861 o.contents.result = std::ptr::null_mut();
6862 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
6864 let err = unsafe { o.contents.err };
6865 unsafe { o.contents.err = std::ptr::null_mut(); }
6866 CResult_NoneLightningErrorZPtr { err }
6870 result_ok: o.result_ok,
6874 impl Clone for CResult_NoneLightningErrorZ {
6875 fn clone(&self) -> Self {
6877 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6878 result: std::ptr::null_mut()
6881 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6882 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6888 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6889 /// but with all dynamically-allocated buffers duplicated in new buffers.
6890 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
6892 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
6893 /// This corresponds to std::vector in C++
6894 pub struct CVec_PublicKeyZ {
6895 /// The elements in the array.
6896 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6897 pub data: *mut crate::c_types::PublicKey,
6898 /// The number of elements pointed to by `data`.
6901 impl CVec_PublicKeyZ {
6902 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
6903 if self.datalen == 0 { return Vec::new(); }
6904 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6905 self.data = std::ptr::null_mut();
6909 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
6910 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6913 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
6914 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
6915 let datalen = v.len();
6916 let data = Box::into_raw(v.into_boxed_slice());
6917 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6921 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6922 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
6923 impl Drop for CVec_PublicKeyZ {
6924 fn drop(&mut self) {
6925 if self.datalen == 0 { return; }
6926 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6929 impl Clone for CVec_PublicKeyZ {
6930 fn clone(&self) -> Self {
6931 let mut res = Vec::new();
6932 if self.datalen == 0 { return Self::from(res); }
6933 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6938 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
6939 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
6940 /// A pointer to the contents in the success state.
6941 /// Reading from this pointer when `result_ok` is not set is undefined.
6942 pub result: *mut crate::c_types::derived::CVec_u8Z,
6943 /// A pointer to the contents in the error state.
6944 /// Reading from this pointer when `result_ok` is set is undefined.
6945 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6948 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
6949 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6951 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
6952 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
6953 /// `err` or `result` depending on the state of `result_ok`.
6954 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
6955 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
6956 pub result_ok: bool,
6959 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
6960 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
6961 CResult_CVec_u8ZPeerHandleErrorZ {
6962 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6963 result: Box::into_raw(Box::new(o)),
6969 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
6970 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
6971 CResult_CVec_u8ZPeerHandleErrorZ {
6972 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6973 err: Box::into_raw(Box::new(e)),
6979 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
6980 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
6981 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
6982 fn drop(&mut self) {
6984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6985 let _ = unsafe { Box::from_raw(self.contents.result) };
6988 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6989 let _ = unsafe { Box::from_raw(self.contents.err) };
6994 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
6995 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6996 let contents = if o.result_ok {
6997 let result = unsafe { o.contents.result };
6998 unsafe { o.contents.result = std::ptr::null_mut() };
6999 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
7001 let err = unsafe { o.contents.err };
7002 unsafe { o.contents.err = std::ptr::null_mut(); }
7003 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
7007 result_ok: o.result_ok,
7011 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
7012 fn clone(&self) -> Self {
7014 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7015 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
7018 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7019 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7025 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
7026 /// but with all dynamically-allocated buffers duplicated in new buffers.
7027 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
7029 /// The contents of CResult_NonePeerHandleErrorZ
7030 pub union CResult_NonePeerHandleErrorZPtr {
7031 /// Note that this value is always NULL, as there are no contents in the OK variant
7032 pub result: *mut std::ffi::c_void,
7033 /// A pointer to the contents in the error state.
7034 /// Reading from this pointer when `result_ok` is set is undefined.
7035 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7038 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7039 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7040 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7041 pub struct CResult_NonePeerHandleErrorZ {
7042 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7043 /// `err` or `result` depending on the state of `result_ok`.
7044 pub contents: CResult_NonePeerHandleErrorZPtr,
7045 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
7046 pub result_ok: bool,
7049 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
7050 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
7051 CResult_NonePeerHandleErrorZ {
7052 contents: CResult_NonePeerHandleErrorZPtr {
7053 result: std::ptr::null_mut(),
7059 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
7060 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
7061 CResult_NonePeerHandleErrorZ {
7062 contents: CResult_NonePeerHandleErrorZPtr {
7063 err: Box::into_raw(Box::new(e)),
7069 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
7070 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
7071 impl Drop for CResult_NonePeerHandleErrorZ {
7072 fn drop(&mut self) {
7075 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7076 let _ = unsafe { Box::from_raw(self.contents.err) };
7081 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
7082 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7083 let contents = if o.result_ok {
7084 let _ = unsafe { Box::from_raw(o.contents.result) };
7085 o.contents.result = std::ptr::null_mut();
7086 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
7088 let err = unsafe { o.contents.err };
7089 unsafe { o.contents.err = std::ptr::null_mut(); }
7090 CResult_NonePeerHandleErrorZPtr { err }
7094 result_ok: o.result_ok,
7098 impl Clone for CResult_NonePeerHandleErrorZ {
7099 fn clone(&self) -> Self {
7101 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
7102 result: std::ptr::null_mut()
7105 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
7106 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7112 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
7113 /// but with all dynamically-allocated buffers duplicated in new buffers.
7114 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
7116 /// The contents of CResult_boolPeerHandleErrorZ
7117 pub union CResult_boolPeerHandleErrorZPtr {
7118 /// A pointer to the contents in the success state.
7119 /// Reading from this pointer when `result_ok` is not set is undefined.
7120 pub result: *mut bool,
7121 /// A pointer to the contents in the error state.
7122 /// Reading from this pointer when `result_ok` is set is undefined.
7123 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7126 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7127 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7129 pub struct CResult_boolPeerHandleErrorZ {
7130 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7131 /// `err` or `result` depending on the state of `result_ok`.
7132 pub contents: CResult_boolPeerHandleErrorZPtr,
7133 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7134 pub result_ok: bool,
7137 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7138 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7139 CResult_boolPeerHandleErrorZ {
7140 contents: CResult_boolPeerHandleErrorZPtr {
7141 result: Box::into_raw(Box::new(o)),
7147 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7148 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7149 CResult_boolPeerHandleErrorZ {
7150 contents: CResult_boolPeerHandleErrorZPtr {
7151 err: Box::into_raw(Box::new(e)),
7157 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7158 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7159 impl Drop for CResult_boolPeerHandleErrorZ {
7160 fn drop(&mut self) {
7162 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7163 let _ = unsafe { Box::from_raw(self.contents.result) };
7166 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7167 let _ = unsafe { Box::from_raw(self.contents.err) };
7172 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7173 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7174 let contents = if o.result_ok {
7175 let result = unsafe { o.contents.result };
7176 unsafe { o.contents.result = std::ptr::null_mut() };
7177 CResult_boolPeerHandleErrorZPtr { result }
7179 let err = unsafe { o.contents.err };
7180 unsafe { o.contents.err = std::ptr::null_mut(); }
7181 CResult_boolPeerHandleErrorZPtr { err }
7185 result_ok: o.result_ok,
7189 impl Clone for CResult_boolPeerHandleErrorZ {
7190 fn clone(&self) -> Self {
7192 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7193 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7196 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
7197 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7203 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7204 /// but with all dynamically-allocated buffers duplicated in new buffers.
7205 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
7207 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7208 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
7209 /// A pointer to the contents in the success state.
7210 /// Reading from this pointer when `result_ok` is not set is undefined.
7211 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
7212 /// A pointer to the contents in the error state.
7213 /// Reading from this pointer when `result_ok` is set is undefined.
7214 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7217 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7218 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7219 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7220 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7221 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7222 /// `err` or `result` depending on the state of `result_ok`.
7223 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7224 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7225 pub result_ok: bool,
7228 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7229 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7230 CResult_DirectionalChannelInfoDecodeErrorZ {
7231 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7232 result: Box::into_raw(Box::new(o)),
7238 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7239 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7240 CResult_DirectionalChannelInfoDecodeErrorZ {
7241 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7242 err: Box::into_raw(Box::new(e)),
7248 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
7249 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7250 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
7251 fn drop(&mut self) {
7253 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7254 let _ = unsafe { Box::from_raw(self.contents.result) };
7257 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7258 let _ = unsafe { Box::from_raw(self.contents.err) };
7263 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7264 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7265 let contents = if o.result_ok {
7266 let result = unsafe { o.contents.result };
7267 unsafe { o.contents.result = std::ptr::null_mut() };
7268 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
7270 let err = unsafe { o.contents.err };
7271 unsafe { o.contents.err = std::ptr::null_mut(); }
7272 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7276 result_ok: o.result_ok,
7280 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7281 fn clone(&self) -> Self {
7283 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7284 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7287 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7288 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7294 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7295 /// but with all dynamically-allocated buffers duplicated in new buffers.
7296 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
7298 /// The contents of CResult_ChannelInfoDecodeErrorZ
7299 pub union CResult_ChannelInfoDecodeErrorZPtr {
7300 /// A pointer to the contents in the success state.
7301 /// Reading from this pointer when `result_ok` is not set is undefined.
7302 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
7303 /// A pointer to the contents in the error state.
7304 /// Reading from this pointer when `result_ok` is set is undefined.
7305 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7308 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7309 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7310 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7311 pub struct CResult_ChannelInfoDecodeErrorZ {
7312 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7313 /// `err` or `result` depending on the state of `result_ok`.
7314 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7315 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7316 pub result_ok: bool,
7319 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7320 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7321 CResult_ChannelInfoDecodeErrorZ {
7322 contents: CResult_ChannelInfoDecodeErrorZPtr {
7323 result: Box::into_raw(Box::new(o)),
7329 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7330 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7331 CResult_ChannelInfoDecodeErrorZ {
7332 contents: CResult_ChannelInfoDecodeErrorZPtr {
7333 err: Box::into_raw(Box::new(e)),
7339 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7340 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7341 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7342 fn drop(&mut self) {
7344 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7345 let _ = unsafe { Box::from_raw(self.contents.result) };
7348 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7349 let _ = unsafe { Box::from_raw(self.contents.err) };
7354 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7355 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7356 let contents = if o.result_ok {
7357 let result = unsafe { o.contents.result };
7358 unsafe { o.contents.result = std::ptr::null_mut() };
7359 CResult_ChannelInfoDecodeErrorZPtr { result }
7361 let err = unsafe { o.contents.err };
7362 unsafe { o.contents.err = std::ptr::null_mut(); }
7363 CResult_ChannelInfoDecodeErrorZPtr { err }
7367 result_ok: o.result_ok,
7371 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7372 fn clone(&self) -> Self {
7374 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7375 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7378 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7379 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7385 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7386 /// but with all dynamically-allocated buffers duplicated in new buffers.
7387 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
7389 /// The contents of CResult_RoutingFeesDecodeErrorZ
7390 pub union CResult_RoutingFeesDecodeErrorZPtr {
7391 /// A pointer to the contents in the success state.
7392 /// Reading from this pointer when `result_ok` is not set is undefined.
7393 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
7394 /// A pointer to the contents in the error state.
7395 /// Reading from this pointer when `result_ok` is set is undefined.
7396 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7399 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7400 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7402 pub struct CResult_RoutingFeesDecodeErrorZ {
7403 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7404 /// `err` or `result` depending on the state of `result_ok`.
7405 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7406 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7407 pub result_ok: bool,
7410 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7411 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7412 CResult_RoutingFeesDecodeErrorZ {
7413 contents: CResult_RoutingFeesDecodeErrorZPtr {
7414 result: Box::into_raw(Box::new(o)),
7420 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7421 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7422 CResult_RoutingFeesDecodeErrorZ {
7423 contents: CResult_RoutingFeesDecodeErrorZPtr {
7424 err: Box::into_raw(Box::new(e)),
7430 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7431 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7432 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7433 fn drop(&mut self) {
7435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7436 let _ = unsafe { Box::from_raw(self.contents.result) };
7439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7440 let _ = unsafe { Box::from_raw(self.contents.err) };
7445 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7446 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7447 let contents = if o.result_ok {
7448 let result = unsafe { o.contents.result };
7449 unsafe { o.contents.result = std::ptr::null_mut() };
7450 CResult_RoutingFeesDecodeErrorZPtr { result }
7452 let err = unsafe { o.contents.err };
7453 unsafe { o.contents.err = std::ptr::null_mut(); }
7454 CResult_RoutingFeesDecodeErrorZPtr { err }
7458 result_ok: o.result_ok,
7462 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7463 fn clone(&self) -> Self {
7465 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7466 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
7469 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7470 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7476 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7477 /// but with all dynamically-allocated buffers duplicated in new buffers.
7478 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
7480 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7481 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7482 /// A pointer to the contents in the success state.
7483 /// Reading from this pointer when `result_ok` is not set is undefined.
7484 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
7485 /// A pointer to the contents in the error state.
7486 /// Reading from this pointer when `result_ok` is set is undefined.
7487 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7490 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7491 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7492 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7493 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7494 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7495 /// `err` or `result` depending on the state of `result_ok`.
7496 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7497 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7498 pub result_ok: bool,
7501 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7502 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7503 CResult_NodeAnnouncementInfoDecodeErrorZ {
7504 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7505 result: Box::into_raw(Box::new(o)),
7511 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7512 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7513 CResult_NodeAnnouncementInfoDecodeErrorZ {
7514 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7515 err: Box::into_raw(Box::new(e)),
7521 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7522 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7523 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7524 fn drop(&mut self) {
7526 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7527 let _ = unsafe { Box::from_raw(self.contents.result) };
7530 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7531 let _ = unsafe { Box::from_raw(self.contents.err) };
7536 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7537 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7538 let contents = if o.result_ok {
7539 let result = unsafe { o.contents.result };
7540 unsafe { o.contents.result = std::ptr::null_mut() };
7541 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7543 let err = unsafe { o.contents.err };
7544 unsafe { o.contents.err = std::ptr::null_mut(); }
7545 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7549 result_ok: o.result_ok,
7553 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7554 fn clone(&self) -> Self {
7556 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7557 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7560 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7561 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7567 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7568 /// but with all dynamically-allocated buffers duplicated in new buffers.
7569 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
7571 /// A dynamically-allocated array of u64s of arbitrary size.
7572 /// This corresponds to std::vector in C++
7573 pub struct CVec_u64Z {
7574 /// The elements in the array.
7575 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7577 /// The number of elements pointed to by `data`.
7581 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
7582 if self.datalen == 0 { return Vec::new(); }
7583 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7584 self.data = std::ptr::null_mut();
7588 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
7589 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7592 impl From<Vec<u64>> for CVec_u64Z {
7593 fn from(v: Vec<u64>) -> Self {
7594 let datalen = v.len();
7595 let data = Box::into_raw(v.into_boxed_slice());
7596 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7600 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7601 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
7602 impl Drop for CVec_u64Z {
7603 fn drop(&mut self) {
7604 if self.datalen == 0 { return; }
7605 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7608 impl Clone for CVec_u64Z {
7609 fn clone(&self) -> Self {
7610 let mut res = Vec::new();
7611 if self.datalen == 0 { return Self::from(res); }
7612 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7617 /// The contents of CResult_NodeInfoDecodeErrorZ
7618 pub union CResult_NodeInfoDecodeErrorZPtr {
7619 /// A pointer to the contents in the success state.
7620 /// Reading from this pointer when `result_ok` is not set is undefined.
7621 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
7622 /// A pointer to the contents in the error state.
7623 /// Reading from this pointer when `result_ok` is set is undefined.
7624 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7627 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7628 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7629 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7630 pub struct CResult_NodeInfoDecodeErrorZ {
7631 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7632 /// `err` or `result` depending on the state of `result_ok`.
7633 pub contents: CResult_NodeInfoDecodeErrorZPtr,
7634 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7635 pub result_ok: bool,
7638 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7639 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7640 CResult_NodeInfoDecodeErrorZ {
7641 contents: CResult_NodeInfoDecodeErrorZPtr {
7642 result: Box::into_raw(Box::new(o)),
7648 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7649 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7650 CResult_NodeInfoDecodeErrorZ {
7651 contents: CResult_NodeInfoDecodeErrorZPtr {
7652 err: Box::into_raw(Box::new(e)),
7658 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7659 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7660 impl Drop for CResult_NodeInfoDecodeErrorZ {
7661 fn drop(&mut self) {
7663 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7664 let _ = unsafe { Box::from_raw(self.contents.result) };
7667 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7668 let _ = unsafe { Box::from_raw(self.contents.err) };
7673 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7674 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7675 let contents = if o.result_ok {
7676 let result = unsafe { o.contents.result };
7677 unsafe { o.contents.result = std::ptr::null_mut() };
7678 CResult_NodeInfoDecodeErrorZPtr { result }
7680 let err = unsafe { o.contents.err };
7681 unsafe { o.contents.err = std::ptr::null_mut(); }
7682 CResult_NodeInfoDecodeErrorZPtr { err }
7686 result_ok: o.result_ok,
7690 impl Clone for CResult_NodeInfoDecodeErrorZ {
7691 fn clone(&self) -> Self {
7693 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7694 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
7697 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7698 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7704 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7705 /// but with all dynamically-allocated buffers duplicated in new buffers.
7706 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
7708 /// The contents of CResult_NetworkGraphDecodeErrorZ
7709 pub union CResult_NetworkGraphDecodeErrorZPtr {
7710 /// A pointer to the contents in the success state.
7711 /// Reading from this pointer when `result_ok` is not set is undefined.
7712 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
7713 /// A pointer to the contents in the error state.
7714 /// Reading from this pointer when `result_ok` is set is undefined.
7715 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7718 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7719 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7721 pub struct CResult_NetworkGraphDecodeErrorZ {
7722 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7723 /// `err` or `result` depending on the state of `result_ok`.
7724 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7725 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7726 pub result_ok: bool,
7729 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7730 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7731 CResult_NetworkGraphDecodeErrorZ {
7732 contents: CResult_NetworkGraphDecodeErrorZPtr {
7733 result: Box::into_raw(Box::new(o)),
7739 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7740 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7741 CResult_NetworkGraphDecodeErrorZ {
7742 contents: CResult_NetworkGraphDecodeErrorZPtr {
7743 err: Box::into_raw(Box::new(e)),
7749 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7750 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7751 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7752 fn drop(&mut self) {
7754 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7755 let _ = unsafe { Box::from_raw(self.contents.result) };
7758 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7759 let _ = unsafe { Box::from_raw(self.contents.err) };
7764 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7765 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7766 let contents = if o.result_ok {
7767 let result = unsafe { o.contents.result };
7768 unsafe { o.contents.result = std::ptr::null_mut() };
7769 CResult_NetworkGraphDecodeErrorZPtr { result }
7771 let err = unsafe { o.contents.err };
7772 unsafe { o.contents.err = std::ptr::null_mut(); }
7773 CResult_NetworkGraphDecodeErrorZPtr { err }
7777 result_ok: o.result_ok,
7781 impl Clone for CResult_NetworkGraphDecodeErrorZ {
7782 fn clone(&self) -> Self {
7784 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
7785 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
7788 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
7789 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7795 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
7796 /// but with all dynamically-allocated buffers duplicated in new buffers.
7797 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
7799 /// The contents of CResult_NetAddressu8Z
7800 pub union CResult_NetAddressu8ZPtr {
7801 /// A pointer to the contents in the success state.
7802 /// Reading from this pointer when `result_ok` is not set is undefined.
7803 pub result: *mut crate::lightning::ln::msgs::NetAddress,
7804 /// A pointer to the contents in the error state.
7805 /// Reading from this pointer when `result_ok` is set is undefined.
7809 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
7810 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7811 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7812 pub struct CResult_NetAddressu8Z {
7813 /// The contents of this CResult_NetAddressu8Z, accessible via either
7814 /// `err` or `result` depending on the state of `result_ok`.
7815 pub contents: CResult_NetAddressu8ZPtr,
7816 /// Whether this CResult_NetAddressu8Z represents a success state.
7817 pub result_ok: bool,
7820 /// Creates a new CResult_NetAddressu8Z in the success state.
7821 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
7822 CResult_NetAddressu8Z {
7823 contents: CResult_NetAddressu8ZPtr {
7824 result: Box::into_raw(Box::new(o)),
7830 /// Creates a new CResult_NetAddressu8Z in the error state.
7831 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
7832 CResult_NetAddressu8Z {
7833 contents: CResult_NetAddressu8ZPtr {
7834 err: Box::into_raw(Box::new(e)),
7840 /// Frees any resources used by the CResult_NetAddressu8Z.
7841 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
7842 impl Drop for CResult_NetAddressu8Z {
7843 fn drop(&mut self) {
7845 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7846 let _ = unsafe { Box::from_raw(self.contents.result) };
7849 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7850 let _ = unsafe { Box::from_raw(self.contents.err) };
7855 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
7856 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
7857 let contents = if o.result_ok {
7858 let result = unsafe { o.contents.result };
7859 unsafe { o.contents.result = std::ptr::null_mut() };
7860 CResult_NetAddressu8ZPtr { result }
7862 let err = unsafe { o.contents.err };
7863 unsafe { o.contents.err = std::ptr::null_mut(); }
7864 CResult_NetAddressu8ZPtr { err }
7868 result_ok: o.result_ok,
7872 impl Clone for CResult_NetAddressu8Z {
7873 fn clone(&self) -> Self {
7875 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
7876 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7879 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
7880 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
7886 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
7887 /// but with all dynamically-allocated buffers duplicated in new buffers.
7888 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
7890 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
7891 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7892 /// A pointer to the contents in the success state.
7893 /// Reading from this pointer when `result_ok` is not set is undefined.
7894 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
7895 /// A pointer to the contents in the error state.
7896 /// Reading from this pointer when `result_ok` is set is undefined.
7897 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7900 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
7901 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
7902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7903 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
7904 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
7905 /// `err` or `result` depending on the state of `result_ok`.
7906 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
7907 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
7908 pub result_ok: bool,
7911 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
7912 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7913 CResult_CResult_NetAddressu8ZDecodeErrorZ {
7914 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7915 result: Box::into_raw(Box::new(o)),
7921 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
7922 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7923 CResult_CResult_NetAddressu8ZDecodeErrorZ {
7924 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7925 err: Box::into_raw(Box::new(e)),
7931 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
7932 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
7933 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7934 fn drop(&mut self) {
7936 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7937 let _ = unsafe { Box::from_raw(self.contents.result) };
7940 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7941 let _ = unsafe { Box::from_raw(self.contents.err) };
7946 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7947 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
7948 let contents = if o.result_ok {
7949 let result = unsafe { o.contents.result };
7950 unsafe { o.contents.result = std::ptr::null_mut() };
7951 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
7953 let err = unsafe { o.contents.err };
7954 unsafe { o.contents.err = std::ptr::null_mut(); }
7955 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
7959 result_ok: o.result_ok,
7963 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7964 fn clone(&self) -> Self {
7966 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7967 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
7970 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7971 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7977 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
7978 /// but with all dynamically-allocated buffers duplicated in new buffers.
7979 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
7981 /// The contents of CResult_NetAddressDecodeErrorZ
7982 pub union CResult_NetAddressDecodeErrorZPtr {
7983 /// A pointer to the contents in the success state.
7984 /// Reading from this pointer when `result_ok` is not set is undefined.
7985 pub result: *mut crate::lightning::ln::msgs::NetAddress,
7986 /// A pointer to the contents in the error state.
7987 /// Reading from this pointer when `result_ok` is set is undefined.
7988 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7991 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
7992 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
7993 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7994 pub struct CResult_NetAddressDecodeErrorZ {
7995 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7996 /// `err` or `result` depending on the state of `result_ok`.
7997 pub contents: CResult_NetAddressDecodeErrorZPtr,
7998 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7999 pub result_ok: bool,
8002 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
8003 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
8004 CResult_NetAddressDecodeErrorZ {
8005 contents: CResult_NetAddressDecodeErrorZPtr {
8006 result: Box::into_raw(Box::new(o)),
8012 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
8013 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
8014 CResult_NetAddressDecodeErrorZ {
8015 contents: CResult_NetAddressDecodeErrorZPtr {
8016 err: Box::into_raw(Box::new(e)),
8022 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
8023 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
8024 impl Drop for CResult_NetAddressDecodeErrorZ {
8025 fn drop(&mut self) {
8027 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8028 let _ = unsafe { Box::from_raw(self.contents.result) };
8031 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8032 let _ = unsafe { Box::from_raw(self.contents.err) };
8037 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
8038 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
8039 let contents = if o.result_ok {
8040 let result = unsafe { o.contents.result };
8041 unsafe { o.contents.result = std::ptr::null_mut() };
8042 CResult_NetAddressDecodeErrorZPtr { result }
8044 let err = unsafe { o.contents.err };
8045 unsafe { o.contents.err = std::ptr::null_mut(); }
8046 CResult_NetAddressDecodeErrorZPtr { err }
8050 result_ok: o.result_ok,
8054 impl Clone for CResult_NetAddressDecodeErrorZ {
8055 fn clone(&self) -> Self {
8057 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
8058 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8061 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
8062 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8068 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
8069 /// but with all dynamically-allocated buffers duplicated in new buffers.
8070 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
8072 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8073 /// This corresponds to std::vector in C++
8074 pub struct CVec_UpdateAddHTLCZ {
8075 /// The elements in the array.
8076 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8077 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
8078 /// The number of elements pointed to by `data`.
8081 impl CVec_UpdateAddHTLCZ {
8082 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
8083 if self.datalen == 0 { return Vec::new(); }
8084 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8085 self.data = std::ptr::null_mut();
8089 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
8090 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8093 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
8094 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
8095 let datalen = v.len();
8096 let data = Box::into_raw(v.into_boxed_slice());
8097 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8101 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8102 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
8103 impl Drop for CVec_UpdateAddHTLCZ {
8104 fn drop(&mut self) {
8105 if self.datalen == 0 { return; }
8106 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8109 impl Clone for CVec_UpdateAddHTLCZ {
8110 fn clone(&self) -> Self {
8111 let mut res = Vec::new();
8112 if self.datalen == 0 { return Self::from(res); }
8113 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8118 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8119 /// This corresponds to std::vector in C++
8120 pub struct CVec_UpdateFulfillHTLCZ {
8121 /// The elements in the array.
8122 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8123 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
8124 /// The number of elements pointed to by `data`.
8127 impl CVec_UpdateFulfillHTLCZ {
8128 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8129 if self.datalen == 0 { return Vec::new(); }
8130 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8131 self.data = std::ptr::null_mut();
8135 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8136 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8139 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8140 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8141 let datalen = v.len();
8142 let data = Box::into_raw(v.into_boxed_slice());
8143 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8147 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8148 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8149 impl Drop for CVec_UpdateFulfillHTLCZ {
8150 fn drop(&mut self) {
8151 if self.datalen == 0 { return; }
8152 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8155 impl Clone for CVec_UpdateFulfillHTLCZ {
8156 fn clone(&self) -> Self {
8157 let mut res = Vec::new();
8158 if self.datalen == 0 { return Self::from(res); }
8159 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8164 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8165 /// This corresponds to std::vector in C++
8166 pub struct CVec_UpdateFailHTLCZ {
8167 /// The elements in the array.
8168 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8169 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8170 /// The number of elements pointed to by `data`.
8173 impl CVec_UpdateFailHTLCZ {
8174 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8175 if self.datalen == 0 { return Vec::new(); }
8176 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8177 self.data = std::ptr::null_mut();
8181 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8182 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8185 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8186 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8187 let datalen = v.len();
8188 let data = Box::into_raw(v.into_boxed_slice());
8189 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8193 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8194 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8195 impl Drop for CVec_UpdateFailHTLCZ {
8196 fn drop(&mut self) {
8197 if self.datalen == 0 { return; }
8198 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8201 impl Clone for CVec_UpdateFailHTLCZ {
8202 fn clone(&self) -> Self {
8203 let mut res = Vec::new();
8204 if self.datalen == 0 { return Self::from(res); }
8205 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8210 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8211 /// This corresponds to std::vector in C++
8212 pub struct CVec_UpdateFailMalformedHTLCZ {
8213 /// The elements in the array.
8214 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8215 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8216 /// The number of elements pointed to by `data`.
8219 impl CVec_UpdateFailMalformedHTLCZ {
8220 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8221 if self.datalen == 0 { return Vec::new(); }
8222 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8223 self.data = std::ptr::null_mut();
8227 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8228 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8231 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8232 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8233 let datalen = v.len();
8234 let data = Box::into_raw(v.into_boxed_slice());
8235 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8239 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8240 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8241 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8242 fn drop(&mut self) {
8243 if self.datalen == 0 { return; }
8244 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8247 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8248 fn clone(&self) -> Self {
8249 let mut res = Vec::new();
8250 if self.datalen == 0 { return Self::from(res); }
8251 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8256 /// The contents of CResult_AcceptChannelDecodeErrorZ
8257 pub union CResult_AcceptChannelDecodeErrorZPtr {
8258 /// A pointer to the contents in the success state.
8259 /// Reading from this pointer when `result_ok` is not set is undefined.
8260 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8261 /// A pointer to the contents in the error state.
8262 /// Reading from this pointer when `result_ok` is set is undefined.
8263 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8266 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8267 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8269 pub struct CResult_AcceptChannelDecodeErrorZ {
8270 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8271 /// `err` or `result` depending on the state of `result_ok`.
8272 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8273 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8274 pub result_ok: bool,
8277 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8278 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8279 CResult_AcceptChannelDecodeErrorZ {
8280 contents: CResult_AcceptChannelDecodeErrorZPtr {
8281 result: Box::into_raw(Box::new(o)),
8287 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8288 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8289 CResult_AcceptChannelDecodeErrorZ {
8290 contents: CResult_AcceptChannelDecodeErrorZPtr {
8291 err: Box::into_raw(Box::new(e)),
8297 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8298 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8299 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8300 fn drop(&mut self) {
8302 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8303 let _ = unsafe { Box::from_raw(self.contents.result) };
8306 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8307 let _ = unsafe { Box::from_raw(self.contents.err) };
8312 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8313 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8314 let contents = if o.result_ok {
8315 let result = unsafe { o.contents.result };
8316 unsafe { o.contents.result = std::ptr::null_mut() };
8317 CResult_AcceptChannelDecodeErrorZPtr { result }
8319 let err = unsafe { o.contents.err };
8320 unsafe { o.contents.err = std::ptr::null_mut(); }
8321 CResult_AcceptChannelDecodeErrorZPtr { err }
8325 result_ok: o.result_ok,
8329 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8330 fn clone(&self) -> Self {
8332 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8333 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8336 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8337 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8343 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8344 /// but with all dynamically-allocated buffers duplicated in new buffers.
8345 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
8347 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8348 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8349 /// A pointer to the contents in the success state.
8350 /// Reading from this pointer when `result_ok` is not set is undefined.
8351 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8352 /// A pointer to the contents in the error state.
8353 /// Reading from this pointer when `result_ok` is set is undefined.
8354 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8357 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8358 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8360 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8361 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8362 /// `err` or `result` depending on the state of `result_ok`.
8363 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8364 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8365 pub result_ok: bool,
8368 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8369 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8370 CResult_AnnouncementSignaturesDecodeErrorZ {
8371 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8372 result: Box::into_raw(Box::new(o)),
8378 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8379 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8380 CResult_AnnouncementSignaturesDecodeErrorZ {
8381 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8382 err: Box::into_raw(Box::new(e)),
8388 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8389 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
8390 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
8391 fn drop(&mut self) {
8393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8394 let _ = unsafe { Box::from_raw(self.contents.result) };
8397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8398 let _ = unsafe { Box::from_raw(self.contents.err) };
8403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
8404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
8405 let contents = if o.result_ok {
8406 let result = unsafe { o.contents.result };
8407 unsafe { o.contents.result = std::ptr::null_mut() };
8408 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
8410 let err = unsafe { o.contents.err };
8411 unsafe { o.contents.err = std::ptr::null_mut(); }
8412 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
8416 result_ok: o.result_ok,
8420 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
8421 fn clone(&self) -> Self {
8423 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8424 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
8427 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8434 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8435 /// but with all dynamically-allocated buffers duplicated in new buffers.
8436 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
8438 /// The contents of CResult_ChannelReestablishDecodeErrorZ
8439 pub union CResult_ChannelReestablishDecodeErrorZPtr {
8440 /// A pointer to the contents in the success state.
8441 /// Reading from this pointer when `result_ok` is not set is undefined.
8442 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
8443 /// A pointer to the contents in the error state.
8444 /// Reading from this pointer when `result_ok` is set is undefined.
8445 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8448 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8449 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8450 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8451 pub struct CResult_ChannelReestablishDecodeErrorZ {
8452 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8453 /// `err` or `result` depending on the state of `result_ok`.
8454 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
8455 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8456 pub result_ok: bool,
8459 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8460 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
8461 CResult_ChannelReestablishDecodeErrorZ {
8462 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8463 result: Box::into_raw(Box::new(o)),
8469 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8470 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
8471 CResult_ChannelReestablishDecodeErrorZ {
8472 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8473 err: Box::into_raw(Box::new(e)),
8479 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8480 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
8481 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
8482 fn drop(&mut self) {
8484 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8485 let _ = unsafe { Box::from_raw(self.contents.result) };
8488 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8489 let _ = unsafe { Box::from_raw(self.contents.err) };
8494 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
8495 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
8496 let contents = if o.result_ok {
8497 let result = unsafe { o.contents.result };
8498 unsafe { o.contents.result = std::ptr::null_mut() };
8499 CResult_ChannelReestablishDecodeErrorZPtr { result }
8501 let err = unsafe { o.contents.err };
8502 unsafe { o.contents.err = std::ptr::null_mut(); }
8503 CResult_ChannelReestablishDecodeErrorZPtr { err }
8507 result_ok: o.result_ok,
8511 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
8512 fn clone(&self) -> Self {
8514 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8515 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
8518 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8519 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8525 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8526 /// but with all dynamically-allocated buffers duplicated in new buffers.
8527 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
8529 /// The contents of CResult_ClosingSignedDecodeErrorZ
8530 pub union CResult_ClosingSignedDecodeErrorZPtr {
8531 /// A pointer to the contents in the success state.
8532 /// Reading from this pointer when `result_ok` is not set is undefined.
8533 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
8534 /// A pointer to the contents in the error state.
8535 /// Reading from this pointer when `result_ok` is set is undefined.
8536 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8539 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8540 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8541 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8542 pub struct CResult_ClosingSignedDecodeErrorZ {
8543 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8544 /// `err` or `result` depending on the state of `result_ok`.
8545 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
8546 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8547 pub result_ok: bool,
8550 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8551 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
8552 CResult_ClosingSignedDecodeErrorZ {
8553 contents: CResult_ClosingSignedDecodeErrorZPtr {
8554 result: Box::into_raw(Box::new(o)),
8560 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8561 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
8562 CResult_ClosingSignedDecodeErrorZ {
8563 contents: CResult_ClosingSignedDecodeErrorZPtr {
8564 err: Box::into_raw(Box::new(e)),
8570 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8571 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
8572 impl Drop for CResult_ClosingSignedDecodeErrorZ {
8573 fn drop(&mut self) {
8575 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8576 let _ = unsafe { Box::from_raw(self.contents.result) };
8579 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8580 let _ = unsafe { Box::from_raw(self.contents.err) };
8585 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
8586 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8587 let contents = if o.result_ok {
8588 let result = unsafe { o.contents.result };
8589 unsafe { o.contents.result = std::ptr::null_mut() };
8590 CResult_ClosingSignedDecodeErrorZPtr { result }
8592 let err = unsafe { o.contents.err };
8593 unsafe { o.contents.err = std::ptr::null_mut(); }
8594 CResult_ClosingSignedDecodeErrorZPtr { err }
8598 result_ok: o.result_ok,
8602 impl Clone for CResult_ClosingSignedDecodeErrorZ {
8603 fn clone(&self) -> Self {
8605 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
8606 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
8609 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
8610 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8616 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8617 /// but with all dynamically-allocated buffers duplicated in new buffers.
8618 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
8620 /// The contents of CResult_CommitmentSignedDecodeErrorZ
8621 pub union CResult_CommitmentSignedDecodeErrorZPtr {
8622 /// A pointer to the contents in the success state.
8623 /// Reading from this pointer when `result_ok` is not set is undefined.
8624 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
8625 /// A pointer to the contents in the error state.
8626 /// Reading from this pointer when `result_ok` is set is undefined.
8627 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8630 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8631 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8632 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8633 pub struct CResult_CommitmentSignedDecodeErrorZ {
8634 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8635 /// `err` or `result` depending on the state of `result_ok`.
8636 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
8637 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8638 pub result_ok: bool,
8641 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8642 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
8643 CResult_CommitmentSignedDecodeErrorZ {
8644 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8645 result: Box::into_raw(Box::new(o)),
8651 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8652 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
8653 CResult_CommitmentSignedDecodeErrorZ {
8654 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8655 err: Box::into_raw(Box::new(e)),
8661 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8662 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
8663 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
8664 fn drop(&mut self) {
8666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8667 let _ = unsafe { Box::from_raw(self.contents.result) };
8670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8671 let _ = unsafe { Box::from_raw(self.contents.err) };
8676 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
8677 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8678 let contents = if o.result_ok {
8679 let result = unsafe { o.contents.result };
8680 unsafe { o.contents.result = std::ptr::null_mut() };
8681 CResult_CommitmentSignedDecodeErrorZPtr { result }
8683 let err = unsafe { o.contents.err };
8684 unsafe { o.contents.err = std::ptr::null_mut(); }
8685 CResult_CommitmentSignedDecodeErrorZPtr { err }
8689 result_ok: o.result_ok,
8693 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
8694 fn clone(&self) -> Self {
8696 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8697 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
8700 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8701 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8707 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8708 /// but with all dynamically-allocated buffers duplicated in new buffers.
8709 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
8711 /// The contents of CResult_FundingCreatedDecodeErrorZ
8712 pub union CResult_FundingCreatedDecodeErrorZPtr {
8713 /// A pointer to the contents in the success state.
8714 /// Reading from this pointer when `result_ok` is not set is undefined.
8715 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
8716 /// A pointer to the contents in the error state.
8717 /// Reading from this pointer when `result_ok` is set is undefined.
8718 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8721 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8722 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8724 pub struct CResult_FundingCreatedDecodeErrorZ {
8725 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8726 /// `err` or `result` depending on the state of `result_ok`.
8727 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
8728 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8729 pub result_ok: bool,
8732 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8733 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
8734 CResult_FundingCreatedDecodeErrorZ {
8735 contents: CResult_FundingCreatedDecodeErrorZPtr {
8736 result: Box::into_raw(Box::new(o)),
8742 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8743 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
8744 CResult_FundingCreatedDecodeErrorZ {
8745 contents: CResult_FundingCreatedDecodeErrorZPtr {
8746 err: Box::into_raw(Box::new(e)),
8752 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8753 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
8754 impl Drop for CResult_FundingCreatedDecodeErrorZ {
8755 fn drop(&mut self) {
8757 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8758 let _ = unsafe { Box::from_raw(self.contents.result) };
8761 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8762 let _ = unsafe { Box::from_raw(self.contents.err) };
8767 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
8768 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
8769 let contents = if o.result_ok {
8770 let result = unsafe { o.contents.result };
8771 unsafe { o.contents.result = std::ptr::null_mut() };
8772 CResult_FundingCreatedDecodeErrorZPtr { result }
8774 let err = unsafe { o.contents.err };
8775 unsafe { o.contents.err = std::ptr::null_mut(); }
8776 CResult_FundingCreatedDecodeErrorZPtr { err }
8780 result_ok: o.result_ok,
8784 impl Clone for CResult_FundingCreatedDecodeErrorZ {
8785 fn clone(&self) -> Self {
8787 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
8788 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
8791 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
8792 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8798 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8799 /// but with all dynamically-allocated buffers duplicated in new buffers.
8800 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
8802 /// The contents of CResult_FundingSignedDecodeErrorZ
8803 pub union CResult_FundingSignedDecodeErrorZPtr {
8804 /// A pointer to the contents in the success state.
8805 /// Reading from this pointer when `result_ok` is not set is undefined.
8806 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
8807 /// A pointer to the contents in the error state.
8808 /// Reading from this pointer when `result_ok` is set is undefined.
8809 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8812 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8813 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8814 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8815 pub struct CResult_FundingSignedDecodeErrorZ {
8816 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8817 /// `err` or `result` depending on the state of `result_ok`.
8818 pub contents: CResult_FundingSignedDecodeErrorZPtr,
8819 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8820 pub result_ok: bool,
8823 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8824 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
8825 CResult_FundingSignedDecodeErrorZ {
8826 contents: CResult_FundingSignedDecodeErrorZPtr {
8827 result: Box::into_raw(Box::new(o)),
8833 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8834 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
8835 CResult_FundingSignedDecodeErrorZ {
8836 contents: CResult_FundingSignedDecodeErrorZPtr {
8837 err: Box::into_raw(Box::new(e)),
8843 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8844 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
8845 impl Drop for CResult_FundingSignedDecodeErrorZ {
8846 fn drop(&mut self) {
8848 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8849 let _ = unsafe { Box::from_raw(self.contents.result) };
8852 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8853 let _ = unsafe { Box::from_raw(self.contents.err) };
8858 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
8859 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8860 let contents = if o.result_ok {
8861 let result = unsafe { o.contents.result };
8862 unsafe { o.contents.result = std::ptr::null_mut() };
8863 CResult_FundingSignedDecodeErrorZPtr { result }
8865 let err = unsafe { o.contents.err };
8866 unsafe { o.contents.err = std::ptr::null_mut(); }
8867 CResult_FundingSignedDecodeErrorZPtr { err }
8871 result_ok: o.result_ok,
8875 impl Clone for CResult_FundingSignedDecodeErrorZ {
8876 fn clone(&self) -> Self {
8878 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
8879 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
8882 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
8883 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8889 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
8890 /// but with all dynamically-allocated buffers duplicated in new buffers.
8891 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
8893 /// The contents of CResult_FundingLockedDecodeErrorZ
8894 pub union CResult_FundingLockedDecodeErrorZPtr {
8895 /// A pointer to the contents in the success state.
8896 /// Reading from this pointer when `result_ok` is not set is undefined.
8897 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
8898 /// A pointer to the contents in the error state.
8899 /// Reading from this pointer when `result_ok` is set is undefined.
8900 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8903 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8904 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
8905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8906 pub struct CResult_FundingLockedDecodeErrorZ {
8907 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8908 /// `err` or `result` depending on the state of `result_ok`.
8909 pub contents: CResult_FundingLockedDecodeErrorZPtr,
8910 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8911 pub result_ok: bool,
8914 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8915 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
8916 CResult_FundingLockedDecodeErrorZ {
8917 contents: CResult_FundingLockedDecodeErrorZPtr {
8918 result: Box::into_raw(Box::new(o)),
8924 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8925 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
8926 CResult_FundingLockedDecodeErrorZ {
8927 contents: CResult_FundingLockedDecodeErrorZPtr {
8928 err: Box::into_raw(Box::new(e)),
8934 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
8935 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
8936 impl Drop for CResult_FundingLockedDecodeErrorZ {
8937 fn drop(&mut self) {
8939 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8940 let _ = unsafe { Box::from_raw(self.contents.result) };
8943 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8944 let _ = unsafe { Box::from_raw(self.contents.err) };
8949 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
8950 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
8951 let contents = if o.result_ok {
8952 let result = unsafe { o.contents.result };
8953 unsafe { o.contents.result = std::ptr::null_mut() };
8954 CResult_FundingLockedDecodeErrorZPtr { result }
8956 let err = unsafe { o.contents.err };
8957 unsafe { o.contents.err = std::ptr::null_mut(); }
8958 CResult_FundingLockedDecodeErrorZPtr { err }
8962 result_ok: o.result_ok,
8966 impl Clone for CResult_FundingLockedDecodeErrorZ {
8967 fn clone(&self) -> Self {
8969 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
8970 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
8973 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
8974 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8980 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
8981 /// but with all dynamically-allocated buffers duplicated in new buffers.
8982 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
8984 /// The contents of CResult_InitDecodeErrorZ
8985 pub union CResult_InitDecodeErrorZPtr {
8986 /// A pointer to the contents in the success state.
8987 /// Reading from this pointer when `result_ok` is not set is undefined.
8988 pub result: *mut crate::lightning::ln::msgs::Init,
8989 /// A pointer to the contents in the error state.
8990 /// Reading from this pointer when `result_ok` is set is undefined.
8991 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8994 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
8995 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
8996 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8997 pub struct CResult_InitDecodeErrorZ {
8998 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
8999 /// `err` or `result` depending on the state of `result_ok`.
9000 pub contents: CResult_InitDecodeErrorZPtr,
9001 /// Whether this CResult_InitDecodeErrorZ represents a success state.
9002 pub result_ok: bool,
9005 /// Creates a new CResult_InitDecodeErrorZ in the success state.
9006 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
9007 CResult_InitDecodeErrorZ {
9008 contents: CResult_InitDecodeErrorZPtr {
9009 result: Box::into_raw(Box::new(o)),
9015 /// Creates a new CResult_InitDecodeErrorZ in the error state.
9016 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
9017 CResult_InitDecodeErrorZ {
9018 contents: CResult_InitDecodeErrorZPtr {
9019 err: Box::into_raw(Box::new(e)),
9025 /// Frees any resources used by the CResult_InitDecodeErrorZ.
9026 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
9027 impl Drop for CResult_InitDecodeErrorZ {
9028 fn drop(&mut self) {
9030 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9031 let _ = unsafe { Box::from_raw(self.contents.result) };
9034 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9035 let _ = unsafe { Box::from_raw(self.contents.err) };
9040 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
9041 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
9042 let contents = if o.result_ok {
9043 let result = unsafe { o.contents.result };
9044 unsafe { o.contents.result = std::ptr::null_mut() };
9045 CResult_InitDecodeErrorZPtr { result }
9047 let err = unsafe { o.contents.err };
9048 unsafe { o.contents.err = std::ptr::null_mut(); }
9049 CResult_InitDecodeErrorZPtr { err }
9053 result_ok: o.result_ok,
9057 impl Clone for CResult_InitDecodeErrorZ {
9058 fn clone(&self) -> Self {
9060 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
9061 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
9064 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
9065 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9071 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
9072 /// but with all dynamically-allocated buffers duplicated in new buffers.
9073 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
9075 /// The contents of CResult_OpenChannelDecodeErrorZ
9076 pub union CResult_OpenChannelDecodeErrorZPtr {
9077 /// A pointer to the contents in the success state.
9078 /// Reading from this pointer when `result_ok` is not set is undefined.
9079 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
9080 /// A pointer to the contents in the error state.
9081 /// Reading from this pointer when `result_ok` is set is undefined.
9082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9085 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9086 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9088 pub struct CResult_OpenChannelDecodeErrorZ {
9089 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9090 /// `err` or `result` depending on the state of `result_ok`.
9091 pub contents: CResult_OpenChannelDecodeErrorZPtr,
9092 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9093 pub result_ok: bool,
9096 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9097 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
9098 CResult_OpenChannelDecodeErrorZ {
9099 contents: CResult_OpenChannelDecodeErrorZPtr {
9100 result: Box::into_raw(Box::new(o)),
9106 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9107 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
9108 CResult_OpenChannelDecodeErrorZ {
9109 contents: CResult_OpenChannelDecodeErrorZPtr {
9110 err: Box::into_raw(Box::new(e)),
9116 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9117 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
9118 impl Drop for CResult_OpenChannelDecodeErrorZ {
9119 fn drop(&mut self) {
9121 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9122 let _ = unsafe { Box::from_raw(self.contents.result) };
9125 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9126 let _ = unsafe { Box::from_raw(self.contents.err) };
9131 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9132 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9133 let contents = if o.result_ok {
9134 let result = unsafe { o.contents.result };
9135 unsafe { o.contents.result = std::ptr::null_mut() };
9136 CResult_OpenChannelDecodeErrorZPtr { result }
9138 let err = unsafe { o.contents.err };
9139 unsafe { o.contents.err = std::ptr::null_mut(); }
9140 CResult_OpenChannelDecodeErrorZPtr { err }
9144 result_ok: o.result_ok,
9148 impl Clone for CResult_OpenChannelDecodeErrorZ {
9149 fn clone(&self) -> Self {
9151 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9152 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9155 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9156 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9162 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9163 /// but with all dynamically-allocated buffers duplicated in new buffers.
9164 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
9166 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9167 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9168 /// A pointer to the contents in the success state.
9169 /// Reading from this pointer when `result_ok` is not set is undefined.
9170 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9171 /// A pointer to the contents in the error state.
9172 /// Reading from this pointer when `result_ok` is set is undefined.
9173 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9176 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9177 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9179 pub struct CResult_RevokeAndACKDecodeErrorZ {
9180 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9181 /// `err` or `result` depending on the state of `result_ok`.
9182 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9183 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9184 pub result_ok: bool,
9187 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9188 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9189 CResult_RevokeAndACKDecodeErrorZ {
9190 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9191 result: Box::into_raw(Box::new(o)),
9197 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9198 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9199 CResult_RevokeAndACKDecodeErrorZ {
9200 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9201 err: Box::into_raw(Box::new(e)),
9207 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9208 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9209 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9210 fn drop(&mut self) {
9212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9213 let _ = unsafe { Box::from_raw(self.contents.result) };
9216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9217 let _ = unsafe { Box::from_raw(self.contents.err) };
9222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9224 let contents = if o.result_ok {
9225 let result = unsafe { o.contents.result };
9226 unsafe { o.contents.result = std::ptr::null_mut() };
9227 CResult_RevokeAndACKDecodeErrorZPtr { result }
9229 let err = unsafe { o.contents.err };
9230 unsafe { o.contents.err = std::ptr::null_mut(); }
9231 CResult_RevokeAndACKDecodeErrorZPtr { err }
9235 result_ok: o.result_ok,
9239 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9240 fn clone(&self) -> Self {
9242 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9243 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9246 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9247 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9253 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9254 /// but with all dynamically-allocated buffers duplicated in new buffers.
9255 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
9257 /// The contents of CResult_ShutdownDecodeErrorZ
9258 pub union CResult_ShutdownDecodeErrorZPtr {
9259 /// A pointer to the contents in the success state.
9260 /// Reading from this pointer when `result_ok` is not set is undefined.
9261 pub result: *mut crate::lightning::ln::msgs::Shutdown,
9262 /// A pointer to the contents in the error state.
9263 /// Reading from this pointer when `result_ok` is set is undefined.
9264 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9267 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9268 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9270 pub struct CResult_ShutdownDecodeErrorZ {
9271 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9272 /// `err` or `result` depending on the state of `result_ok`.
9273 pub contents: CResult_ShutdownDecodeErrorZPtr,
9274 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9275 pub result_ok: bool,
9278 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9279 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9280 CResult_ShutdownDecodeErrorZ {
9281 contents: CResult_ShutdownDecodeErrorZPtr {
9282 result: Box::into_raw(Box::new(o)),
9288 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9289 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
9290 CResult_ShutdownDecodeErrorZ {
9291 contents: CResult_ShutdownDecodeErrorZPtr {
9292 err: Box::into_raw(Box::new(e)),
9298 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9299 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
9300 impl Drop for CResult_ShutdownDecodeErrorZ {
9301 fn drop(&mut self) {
9303 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9304 let _ = unsafe { Box::from_raw(self.contents.result) };
9307 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9308 let _ = unsafe { Box::from_raw(self.contents.err) };
9313 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
9314 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
9315 let contents = if o.result_ok {
9316 let result = unsafe { o.contents.result };
9317 unsafe { o.contents.result = std::ptr::null_mut() };
9318 CResult_ShutdownDecodeErrorZPtr { result }
9320 let err = unsafe { o.contents.err };
9321 unsafe { o.contents.err = std::ptr::null_mut(); }
9322 CResult_ShutdownDecodeErrorZPtr { err }
9326 result_ok: o.result_ok,
9330 impl Clone for CResult_ShutdownDecodeErrorZ {
9331 fn clone(&self) -> Self {
9333 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
9334 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
9337 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
9338 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9344 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9345 /// but with all dynamically-allocated buffers duplicated in new buffers.
9346 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
9348 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
9349 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
9350 /// A pointer to the contents in the success state.
9351 /// Reading from this pointer when `result_ok` is not set is undefined.
9352 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9353 /// A pointer to the contents in the error state.
9354 /// Reading from this pointer when `result_ok` is set is undefined.
9355 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9358 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9359 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9360 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9361 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
9362 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9363 /// `err` or `result` depending on the state of `result_ok`.
9364 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
9365 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9366 pub result_ok: bool,
9369 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9370 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
9371 CResult_UpdateFailHTLCDecodeErrorZ {
9372 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9373 result: Box::into_raw(Box::new(o)),
9379 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9380 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
9381 CResult_UpdateFailHTLCDecodeErrorZ {
9382 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9383 err: Box::into_raw(Box::new(e)),
9389 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9390 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
9391 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
9392 fn drop(&mut self) {
9394 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9395 let _ = unsafe { Box::from_raw(self.contents.result) };
9398 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9399 let _ = unsafe { Box::from_raw(self.contents.err) };
9404 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
9405 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9406 let contents = if o.result_ok {
9407 let result = unsafe { o.contents.result };
9408 unsafe { o.contents.result = std::ptr::null_mut() };
9409 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
9411 let err = unsafe { o.contents.err };
9412 unsafe { o.contents.err = std::ptr::null_mut(); }
9413 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
9417 result_ok: o.result_ok,
9421 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
9422 fn clone(&self) -> Self {
9424 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9425 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
9428 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9429 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9435 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9436 /// but with all dynamically-allocated buffers duplicated in new buffers.
9437 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
9439 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9440 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9441 /// A pointer to the contents in the success state.
9442 /// Reading from this pointer when `result_ok` is not set is undefined.
9443 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9444 /// A pointer to the contents in the error state.
9445 /// Reading from this pointer when `result_ok` is set is undefined.
9446 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9449 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9450 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9452 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9453 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9454 /// `err` or `result` depending on the state of `result_ok`.
9455 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
9456 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9457 pub result_ok: bool,
9460 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9461 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9462 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9463 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9464 result: Box::into_raw(Box::new(o)),
9470 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9471 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9472 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9473 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9474 err: Box::into_raw(Box::new(e)),
9480 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9481 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
9482 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9483 fn drop(&mut self) {
9485 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9486 let _ = unsafe { Box::from_raw(self.contents.result) };
9489 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9490 let _ = unsafe { Box::from_raw(self.contents.err) };
9495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9496 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9497 let contents = if o.result_ok {
9498 let result = unsafe { o.contents.result };
9499 unsafe { o.contents.result = std::ptr::null_mut() };
9500 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
9502 let err = unsafe { o.contents.err };
9503 unsafe { o.contents.err = std::ptr::null_mut(); }
9504 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
9508 result_ok: o.result_ok,
9512 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9513 fn clone(&self) -> Self {
9515 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9516 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
9519 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9520 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9526 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9527 /// but with all dynamically-allocated buffers duplicated in new buffers.
9528 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
9530 /// The contents of CResult_UpdateFeeDecodeErrorZ
9531 pub union CResult_UpdateFeeDecodeErrorZPtr {
9532 /// A pointer to the contents in the success state.
9533 /// Reading from this pointer when `result_ok` is not set is undefined.
9534 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
9535 /// A pointer to the contents in the error state.
9536 /// Reading from this pointer when `result_ok` is set is undefined.
9537 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9540 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9541 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9542 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9543 pub struct CResult_UpdateFeeDecodeErrorZ {
9544 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9545 /// `err` or `result` depending on the state of `result_ok`.
9546 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
9547 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9548 pub result_ok: bool,
9551 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9552 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
9553 CResult_UpdateFeeDecodeErrorZ {
9554 contents: CResult_UpdateFeeDecodeErrorZPtr {
9555 result: Box::into_raw(Box::new(o)),
9561 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9562 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
9563 CResult_UpdateFeeDecodeErrorZ {
9564 contents: CResult_UpdateFeeDecodeErrorZPtr {
9565 err: Box::into_raw(Box::new(e)),
9571 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9572 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
9573 impl Drop for CResult_UpdateFeeDecodeErrorZ {
9574 fn drop(&mut self) {
9576 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9577 let _ = unsafe { Box::from_raw(self.contents.result) };
9580 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9581 let _ = unsafe { Box::from_raw(self.contents.err) };
9586 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
9587 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
9588 let contents = if o.result_ok {
9589 let result = unsafe { o.contents.result };
9590 unsafe { o.contents.result = std::ptr::null_mut() };
9591 CResult_UpdateFeeDecodeErrorZPtr { result }
9593 let err = unsafe { o.contents.err };
9594 unsafe { o.contents.err = std::ptr::null_mut(); }
9595 CResult_UpdateFeeDecodeErrorZPtr { err }
9599 result_ok: o.result_ok,
9603 impl Clone for CResult_UpdateFeeDecodeErrorZ {
9604 fn clone(&self) -> Self {
9606 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
9607 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
9610 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
9611 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9617 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9618 /// but with all dynamically-allocated buffers duplicated in new buffers.
9619 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
9621 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9622 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9623 /// A pointer to the contents in the success state.
9624 /// Reading from this pointer when `result_ok` is not set is undefined.
9625 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9626 /// A pointer to the contents in the error state.
9627 /// Reading from this pointer when `result_ok` is set is undefined.
9628 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9631 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9632 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9633 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9634 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
9635 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9636 /// `err` or `result` depending on the state of `result_ok`.
9637 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
9638 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9639 pub result_ok: bool,
9642 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9643 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9644 CResult_UpdateFulfillHTLCDecodeErrorZ {
9645 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9646 result: Box::into_raw(Box::new(o)),
9652 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9653 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9654 CResult_UpdateFulfillHTLCDecodeErrorZ {
9655 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9656 err: Box::into_raw(Box::new(e)),
9662 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9663 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
9664 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
9665 fn drop(&mut self) {
9667 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9668 let _ = unsafe { Box::from_raw(self.contents.result) };
9671 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9672 let _ = unsafe { Box::from_raw(self.contents.err) };
9677 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
9678 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9679 let contents = if o.result_ok {
9680 let result = unsafe { o.contents.result };
9681 unsafe { o.contents.result = std::ptr::null_mut() };
9682 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
9684 let err = unsafe { o.contents.err };
9685 unsafe { o.contents.err = std::ptr::null_mut(); }
9686 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
9690 result_ok: o.result_ok,
9694 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
9695 fn clone(&self) -> Self {
9697 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9698 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
9701 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9702 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9708 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9709 /// but with all dynamically-allocated buffers duplicated in new buffers.
9710 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
9712 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
9713 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
9714 /// A pointer to the contents in the success state.
9715 /// Reading from this pointer when `result_ok` is not set is undefined.
9716 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9717 /// A pointer to the contents in the error state.
9718 /// Reading from this pointer when `result_ok` is set is undefined.
9719 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9722 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9723 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9725 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
9726 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9727 /// `err` or `result` depending on the state of `result_ok`.
9728 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
9729 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9730 pub result_ok: bool,
9733 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9734 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
9735 CResult_UpdateAddHTLCDecodeErrorZ {
9736 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9737 result: Box::into_raw(Box::new(o)),
9743 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9744 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
9745 CResult_UpdateAddHTLCDecodeErrorZ {
9746 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9747 err: Box::into_raw(Box::new(e)),
9753 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
9754 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
9755 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
9756 fn drop(&mut self) {
9758 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9759 let _ = unsafe { Box::from_raw(self.contents.result) };
9762 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9763 let _ = unsafe { Box::from_raw(self.contents.err) };
9768 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
9769 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9770 let contents = if o.result_ok {
9771 let result = unsafe { o.contents.result };
9772 unsafe { o.contents.result = std::ptr::null_mut() };
9773 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
9775 let err = unsafe { o.contents.err };
9776 unsafe { o.contents.err = std::ptr::null_mut(); }
9777 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
9781 result_ok: o.result_ok,
9785 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
9786 fn clone(&self) -> Self {
9788 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9789 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
9792 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9793 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9799 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9800 /// but with all dynamically-allocated buffers duplicated in new buffers.
9801 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
9803 /// The contents of CResult_PingDecodeErrorZ
9804 pub union CResult_PingDecodeErrorZPtr {
9805 /// A pointer to the contents in the success state.
9806 /// Reading from this pointer when `result_ok` is not set is undefined.
9807 pub result: *mut crate::lightning::ln::msgs::Ping,
9808 /// A pointer to the contents in the error state.
9809 /// Reading from this pointer when `result_ok` is set is undefined.
9810 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9813 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9814 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9816 pub struct CResult_PingDecodeErrorZ {
9817 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
9818 /// `err` or `result` depending on the state of `result_ok`.
9819 pub contents: CResult_PingDecodeErrorZPtr,
9820 /// Whether this CResult_PingDecodeErrorZ represents a success state.
9821 pub result_ok: bool,
9824 /// Creates a new CResult_PingDecodeErrorZ in the success state.
9825 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
9826 CResult_PingDecodeErrorZ {
9827 contents: CResult_PingDecodeErrorZPtr {
9828 result: Box::into_raw(Box::new(o)),
9834 /// Creates a new CResult_PingDecodeErrorZ in the error state.
9835 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
9836 CResult_PingDecodeErrorZ {
9837 contents: CResult_PingDecodeErrorZPtr {
9838 err: Box::into_raw(Box::new(e)),
9844 /// Frees any resources used by the CResult_PingDecodeErrorZ.
9845 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
9846 impl Drop for CResult_PingDecodeErrorZ {
9847 fn drop(&mut self) {
9849 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9850 let _ = unsafe { Box::from_raw(self.contents.result) };
9853 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9854 let _ = unsafe { Box::from_raw(self.contents.err) };
9859 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
9860 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
9861 let contents = if o.result_ok {
9862 let result = unsafe { o.contents.result };
9863 unsafe { o.contents.result = std::ptr::null_mut() };
9864 CResult_PingDecodeErrorZPtr { result }
9866 let err = unsafe { o.contents.err };
9867 unsafe { o.contents.err = std::ptr::null_mut(); }
9868 CResult_PingDecodeErrorZPtr { err }
9872 result_ok: o.result_ok,
9876 impl Clone for CResult_PingDecodeErrorZ {
9877 fn clone(&self) -> Self {
9879 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
9880 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
9883 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
9884 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9890 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
9891 /// but with all dynamically-allocated buffers duplicated in new buffers.
9892 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
9894 /// The contents of CResult_PongDecodeErrorZ
9895 pub union CResult_PongDecodeErrorZPtr {
9896 /// A pointer to the contents in the success state.
9897 /// Reading from this pointer when `result_ok` is not set is undefined.
9898 pub result: *mut crate::lightning::ln::msgs::Pong,
9899 /// A pointer to the contents in the error state.
9900 /// Reading from this pointer when `result_ok` is set is undefined.
9901 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9904 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9905 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9907 pub struct CResult_PongDecodeErrorZ {
9908 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
9909 /// `err` or `result` depending on the state of `result_ok`.
9910 pub contents: CResult_PongDecodeErrorZPtr,
9911 /// Whether this CResult_PongDecodeErrorZ represents a success state.
9912 pub result_ok: bool,
9915 /// Creates a new CResult_PongDecodeErrorZ in the success state.
9916 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
9917 CResult_PongDecodeErrorZ {
9918 contents: CResult_PongDecodeErrorZPtr {
9919 result: Box::into_raw(Box::new(o)),
9925 /// Creates a new CResult_PongDecodeErrorZ in the error state.
9926 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
9927 CResult_PongDecodeErrorZ {
9928 contents: CResult_PongDecodeErrorZPtr {
9929 err: Box::into_raw(Box::new(e)),
9935 /// Frees any resources used by the CResult_PongDecodeErrorZ.
9936 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
9937 impl Drop for CResult_PongDecodeErrorZ {
9938 fn drop(&mut self) {
9940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9941 let _ = unsafe { Box::from_raw(self.contents.result) };
9944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9945 let _ = unsafe { Box::from_raw(self.contents.err) };
9950 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
9951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
9952 let contents = if o.result_ok {
9953 let result = unsafe { o.contents.result };
9954 unsafe { o.contents.result = std::ptr::null_mut() };
9955 CResult_PongDecodeErrorZPtr { result }
9957 let err = unsafe { o.contents.err };
9958 unsafe { o.contents.err = std::ptr::null_mut(); }
9959 CResult_PongDecodeErrorZPtr { err }
9963 result_ok: o.result_ok,
9967 impl Clone for CResult_PongDecodeErrorZ {
9968 fn clone(&self) -> Self {
9970 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
9971 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
9974 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
9975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9981 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
9982 /// but with all dynamically-allocated buffers duplicated in new buffers.
9983 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
9985 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9986 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9987 /// A pointer to the contents in the success state.
9988 /// Reading from this pointer when `result_ok` is not set is undefined.
9989 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
9990 /// A pointer to the contents in the error state.
9991 /// Reading from this pointer when `result_ok` is set is undefined.
9992 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9995 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9996 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9997 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9998 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9999 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10000 /// `err` or `result` depending on the state of `result_ok`.
10001 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
10002 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10003 pub result_ok: bool,
10006 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10007 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10008 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10009 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10010 result: Box::into_raw(Box::new(o)),
10016 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10017 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10018 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10019 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10020 err: Box::into_raw(Box::new(e)),
10026 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10027 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
10028 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10029 fn drop(&mut self) {
10030 if self.result_ok {
10031 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10032 let _ = unsafe { Box::from_raw(self.contents.result) };
10035 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10036 let _ = unsafe { Box::from_raw(self.contents.err) };
10041 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10042 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10043 let contents = if o.result_ok {
10044 let result = unsafe { o.contents.result };
10045 unsafe { o.contents.result = std::ptr::null_mut() };
10046 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
10048 let err = unsafe { o.contents.err };
10049 unsafe { o.contents.err = std::ptr::null_mut(); }
10050 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
10054 result_ok: o.result_ok,
10058 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10059 fn clone(&self) -> Self {
10060 if self.result_ok {
10061 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10062 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10065 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10066 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10072 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10073 /// but with all dynamically-allocated buffers duplicated in new buffers.
10074 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
10076 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
10077 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
10078 /// A pointer to the contents in the success state.
10079 /// Reading from this pointer when `result_ok` is not set is undefined.
10080 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
10081 /// A pointer to the contents in the error state.
10082 /// Reading from this pointer when `result_ok` is set is undefined.
10083 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10086 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10087 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10089 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
10090 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10091 /// `err` or `result` depending on the state of `result_ok`.
10092 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
10093 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10094 pub result_ok: bool,
10097 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10098 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
10099 CResult_ChannelAnnouncementDecodeErrorZ {
10100 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10101 result: Box::into_raw(Box::new(o)),
10107 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10108 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
10109 CResult_ChannelAnnouncementDecodeErrorZ {
10110 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10111 err: Box::into_raw(Box::new(e)),
10117 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10118 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
10119 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
10120 fn drop(&mut self) {
10121 if self.result_ok {
10122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10123 let _ = unsafe { Box::from_raw(self.contents.result) };
10126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10127 let _ = unsafe { Box::from_raw(self.contents.err) };
10132 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10133 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10134 let contents = if o.result_ok {
10135 let result = unsafe { o.contents.result };
10136 unsafe { o.contents.result = std::ptr::null_mut() };
10137 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10139 let err = unsafe { o.contents.err };
10140 unsafe { o.contents.err = std::ptr::null_mut(); }
10141 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10145 result_ok: o.result_ok,
10149 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10150 fn clone(&self) -> Self {
10151 if self.result_ok {
10152 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10153 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10156 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10157 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10163 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10164 /// but with all dynamically-allocated buffers duplicated in new buffers.
10165 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
10167 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10168 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10169 /// A pointer to the contents in the success state.
10170 /// Reading from this pointer when `result_ok` is not set is undefined.
10171 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10172 /// A pointer to the contents in the error state.
10173 /// Reading from this pointer when `result_ok` is set is undefined.
10174 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10177 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10178 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10180 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10181 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10182 /// `err` or `result` depending on the state of `result_ok`.
10183 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10184 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10185 pub result_ok: bool,
10188 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10189 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10190 CResult_UnsignedChannelUpdateDecodeErrorZ {
10191 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10192 result: Box::into_raw(Box::new(o)),
10198 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10199 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10200 CResult_UnsignedChannelUpdateDecodeErrorZ {
10201 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10202 err: Box::into_raw(Box::new(e)),
10208 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10209 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10210 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10211 fn drop(&mut self) {
10212 if self.result_ok {
10213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10214 let _ = unsafe { Box::from_raw(self.contents.result) };
10217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10218 let _ = unsafe { Box::from_raw(self.contents.err) };
10223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10225 let contents = if o.result_ok {
10226 let result = unsafe { o.contents.result };
10227 unsafe { o.contents.result = std::ptr::null_mut() };
10228 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10230 let err = unsafe { o.contents.err };
10231 unsafe { o.contents.err = std::ptr::null_mut(); }
10232 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10236 result_ok: o.result_ok,
10240 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10241 fn clone(&self) -> Self {
10242 if self.result_ok {
10243 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10244 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10247 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10254 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10255 /// but with all dynamically-allocated buffers duplicated in new buffers.
10256 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
10258 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10259 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10260 /// A pointer to the contents in the success state.
10261 /// Reading from this pointer when `result_ok` is not set is undefined.
10262 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10263 /// A pointer to the contents in the error state.
10264 /// Reading from this pointer when `result_ok` is set is undefined.
10265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10268 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10269 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10271 pub struct CResult_ChannelUpdateDecodeErrorZ {
10272 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10273 /// `err` or `result` depending on the state of `result_ok`.
10274 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10275 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10276 pub result_ok: bool,
10279 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10280 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10281 CResult_ChannelUpdateDecodeErrorZ {
10282 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10283 result: Box::into_raw(Box::new(o)),
10289 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10290 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
10291 CResult_ChannelUpdateDecodeErrorZ {
10292 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10293 err: Box::into_raw(Box::new(e)),
10299 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10300 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
10301 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
10302 fn drop(&mut self) {
10303 if self.result_ok {
10304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10305 let _ = unsafe { Box::from_raw(self.contents.result) };
10308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10309 let _ = unsafe { Box::from_raw(self.contents.err) };
10314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
10315 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10316 let contents = if o.result_ok {
10317 let result = unsafe { o.contents.result };
10318 unsafe { o.contents.result = std::ptr::null_mut() };
10319 CResult_ChannelUpdateDecodeErrorZPtr { result }
10321 let err = unsafe { o.contents.err };
10322 unsafe { o.contents.err = std::ptr::null_mut(); }
10323 CResult_ChannelUpdateDecodeErrorZPtr { err }
10327 result_ok: o.result_ok,
10331 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
10332 fn clone(&self) -> Self {
10333 if self.result_ok {
10334 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10335 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
10338 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10345 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10346 /// but with all dynamically-allocated buffers duplicated in new buffers.
10347 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
10349 /// The contents of CResult_ErrorMessageDecodeErrorZ
10350 pub union CResult_ErrorMessageDecodeErrorZPtr {
10351 /// A pointer to the contents in the success state.
10352 /// Reading from this pointer when `result_ok` is not set is undefined.
10353 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
10354 /// A pointer to the contents in the error state.
10355 /// Reading from this pointer when `result_ok` is set is undefined.
10356 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10359 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10360 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10362 pub struct CResult_ErrorMessageDecodeErrorZ {
10363 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10364 /// `err` or `result` depending on the state of `result_ok`.
10365 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
10366 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10367 pub result_ok: bool,
10370 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10371 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
10372 CResult_ErrorMessageDecodeErrorZ {
10373 contents: CResult_ErrorMessageDecodeErrorZPtr {
10374 result: Box::into_raw(Box::new(o)),
10380 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10381 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
10382 CResult_ErrorMessageDecodeErrorZ {
10383 contents: CResult_ErrorMessageDecodeErrorZPtr {
10384 err: Box::into_raw(Box::new(e)),
10390 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10391 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
10392 impl Drop for CResult_ErrorMessageDecodeErrorZ {
10393 fn drop(&mut self) {
10394 if self.result_ok {
10395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10396 let _ = unsafe { Box::from_raw(self.contents.result) };
10399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10400 let _ = unsafe { Box::from_raw(self.contents.err) };
10405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
10406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
10407 let contents = if o.result_ok {
10408 let result = unsafe { o.contents.result };
10409 unsafe { o.contents.result = std::ptr::null_mut() };
10410 CResult_ErrorMessageDecodeErrorZPtr { result }
10412 let err = unsafe { o.contents.err };
10413 unsafe { o.contents.err = std::ptr::null_mut(); }
10414 CResult_ErrorMessageDecodeErrorZPtr { err }
10418 result_ok: o.result_ok,
10422 impl Clone for CResult_ErrorMessageDecodeErrorZ {
10423 fn clone(&self) -> Self {
10424 if self.result_ok {
10425 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
10426 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
10429 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
10430 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10436 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10437 /// but with all dynamically-allocated buffers duplicated in new buffers.
10438 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
10440 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10441 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10442 /// A pointer to the contents in the success state.
10443 /// Reading from this pointer when `result_ok` is not set is undefined.
10444 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
10445 /// A pointer to the contents in the error state.
10446 /// Reading from this pointer when `result_ok` is set is undefined.
10447 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10450 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10451 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10453 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10454 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10455 /// `err` or `result` depending on the state of `result_ok`.
10456 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
10457 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10458 pub result_ok: bool,
10461 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10462 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10463 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10464 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10465 result: Box::into_raw(Box::new(o)),
10471 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10472 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10473 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10474 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10475 err: Box::into_raw(Box::new(e)),
10481 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10482 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
10483 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10484 fn drop(&mut self) {
10485 if self.result_ok {
10486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10487 let _ = unsafe { Box::from_raw(self.contents.result) };
10490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10491 let _ = unsafe { Box::from_raw(self.contents.err) };
10496 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10497 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10498 let contents = if o.result_ok {
10499 let result = unsafe { o.contents.result };
10500 unsafe { o.contents.result = std::ptr::null_mut() };
10501 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
10503 let err = unsafe { o.contents.err };
10504 unsafe { o.contents.err = std::ptr::null_mut(); }
10505 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
10509 result_ok: o.result_ok,
10513 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10514 fn clone(&self) -> Self {
10515 if self.result_ok {
10516 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10517 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10520 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10521 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10527 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10528 /// but with all dynamically-allocated buffers duplicated in new buffers.
10529 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
10531 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
10532 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
10533 /// A pointer to the contents in the success state.
10534 /// Reading from this pointer when `result_ok` is not set is undefined.
10535 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10536 /// A pointer to the contents in the error state.
10537 /// Reading from this pointer when `result_ok` is set is undefined.
10538 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10541 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10542 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10544 pub struct CResult_NodeAnnouncementDecodeErrorZ {
10545 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10546 /// `err` or `result` depending on the state of `result_ok`.
10547 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
10548 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10549 pub result_ok: bool,
10552 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10553 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
10554 CResult_NodeAnnouncementDecodeErrorZ {
10555 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10556 result: Box::into_raw(Box::new(o)),
10562 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10563 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
10564 CResult_NodeAnnouncementDecodeErrorZ {
10565 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10566 err: Box::into_raw(Box::new(e)),
10572 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10573 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
10574 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
10575 fn drop(&mut self) {
10576 if self.result_ok {
10577 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10578 let _ = unsafe { Box::from_raw(self.contents.result) };
10581 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10582 let _ = unsafe { Box::from_raw(self.contents.err) };
10587 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
10588 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10589 let contents = if o.result_ok {
10590 let result = unsafe { o.contents.result };
10591 unsafe { o.contents.result = std::ptr::null_mut() };
10592 CResult_NodeAnnouncementDecodeErrorZPtr { result }
10594 let err = unsafe { o.contents.err };
10595 unsafe { o.contents.err = std::ptr::null_mut(); }
10596 CResult_NodeAnnouncementDecodeErrorZPtr { err }
10600 result_ok: o.result_ok,
10604 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
10605 fn clone(&self) -> Self {
10606 if self.result_ok {
10607 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10608 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10611 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10612 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10618 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10619 /// but with all dynamically-allocated buffers duplicated in new buffers.
10620 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
10622 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10623 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
10624 /// A pointer to the contents in the success state.
10625 /// Reading from this pointer when `result_ok` is not set is undefined.
10626 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
10627 /// A pointer to the contents in the error state.
10628 /// Reading from this pointer when `result_ok` is set is undefined.
10629 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10632 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10633 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10635 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
10636 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10637 /// `err` or `result` depending on the state of `result_ok`.
10638 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
10639 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10640 pub result_ok: bool,
10643 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10644 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10645 CResult_QueryShortChannelIdsDecodeErrorZ {
10646 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10647 result: Box::into_raw(Box::new(o)),
10653 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10654 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10655 CResult_QueryShortChannelIdsDecodeErrorZ {
10656 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10657 err: Box::into_raw(Box::new(e)),
10663 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10664 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
10665 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
10666 fn drop(&mut self) {
10667 if self.result_ok {
10668 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10669 let _ = unsafe { Box::from_raw(self.contents.result) };
10672 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10673 let _ = unsafe { Box::from_raw(self.contents.err) };
10678 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
10679 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
10680 let contents = if o.result_ok {
10681 let result = unsafe { o.contents.result };
10682 unsafe { o.contents.result = std::ptr::null_mut() };
10683 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
10685 let err = unsafe { o.contents.err };
10686 unsafe { o.contents.err = std::ptr::null_mut(); }
10687 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
10691 result_ok: o.result_ok,
10695 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
10696 fn clone(&self) -> Self {
10697 if self.result_ok {
10698 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10699 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
10702 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10703 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10709 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10710 /// but with all dynamically-allocated buffers duplicated in new buffers.
10711 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
10713 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10714 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10715 /// A pointer to the contents in the success state.
10716 /// Reading from this pointer when `result_ok` is not set is undefined.
10717 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
10718 /// A pointer to the contents in the error state.
10719 /// Reading from this pointer when `result_ok` is set is undefined.
10720 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10723 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10724 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10726 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10727 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10728 /// `err` or `result` depending on the state of `result_ok`.
10729 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
10730 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10731 pub result_ok: bool,
10734 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10735 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10736 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10737 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10738 result: Box::into_raw(Box::new(o)),
10744 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10745 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10746 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10747 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10748 err: Box::into_raw(Box::new(e)),
10754 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10755 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
10756 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10757 fn drop(&mut self) {
10758 if self.result_ok {
10759 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10760 let _ = unsafe { Box::from_raw(self.contents.result) };
10763 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10764 let _ = unsafe { Box::from_raw(self.contents.err) };
10769 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10770 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
10771 let contents = if o.result_ok {
10772 let result = unsafe { o.contents.result };
10773 unsafe { o.contents.result = std::ptr::null_mut() };
10774 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
10776 let err = unsafe { o.contents.err };
10777 unsafe { o.contents.err = std::ptr::null_mut(); }
10778 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
10782 result_ok: o.result_ok,
10786 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10787 fn clone(&self) -> Self {
10788 if self.result_ok {
10789 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10790 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
10793 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10794 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10800 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10801 /// but with all dynamically-allocated buffers duplicated in new buffers.
10802 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
10804 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
10805 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
10806 /// A pointer to the contents in the success state.
10807 /// Reading from this pointer when `result_ok` is not set is undefined.
10808 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
10809 /// A pointer to the contents in the error state.
10810 /// Reading from this pointer when `result_ok` is set is undefined.
10811 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10814 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10815 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10816 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10817 pub struct CResult_QueryChannelRangeDecodeErrorZ {
10818 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10819 /// `err` or `result` depending on the state of `result_ok`.
10820 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
10821 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10822 pub result_ok: bool,
10825 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10826 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
10827 CResult_QueryChannelRangeDecodeErrorZ {
10828 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10829 result: Box::into_raw(Box::new(o)),
10835 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10836 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
10837 CResult_QueryChannelRangeDecodeErrorZ {
10838 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10839 err: Box::into_raw(Box::new(e)),
10845 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10846 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
10847 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
10848 fn drop(&mut self) {
10849 if self.result_ok {
10850 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10851 let _ = unsafe { Box::from_raw(self.contents.result) };
10854 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10855 let _ = unsafe { Box::from_raw(self.contents.err) };
10860 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
10861 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10862 let contents = if o.result_ok {
10863 let result = unsafe { o.contents.result };
10864 unsafe { o.contents.result = std::ptr::null_mut() };
10865 CResult_QueryChannelRangeDecodeErrorZPtr { result }
10867 let err = unsafe { o.contents.err };
10868 unsafe { o.contents.err = std::ptr::null_mut(); }
10869 CResult_QueryChannelRangeDecodeErrorZPtr { err }
10873 result_ok: o.result_ok,
10877 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
10878 fn clone(&self) -> Self {
10879 if self.result_ok {
10880 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10881 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
10884 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10885 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10891 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10892 /// but with all dynamically-allocated buffers duplicated in new buffers.
10893 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
10895 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
10896 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
10897 /// A pointer to the contents in the success state.
10898 /// Reading from this pointer when `result_ok` is not set is undefined.
10899 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
10900 /// A pointer to the contents in the error state.
10901 /// Reading from this pointer when `result_ok` is set is undefined.
10902 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10905 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10906 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10907 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10908 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
10909 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10910 /// `err` or `result` depending on the state of `result_ok`.
10911 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
10912 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10913 pub result_ok: bool,
10916 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10917 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
10918 CResult_ReplyChannelRangeDecodeErrorZ {
10919 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10920 result: Box::into_raw(Box::new(o)),
10926 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10927 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
10928 CResult_ReplyChannelRangeDecodeErrorZ {
10929 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10930 err: Box::into_raw(Box::new(e)),
10936 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10937 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
10938 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
10939 fn drop(&mut self) {
10940 if self.result_ok {
10941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10942 let _ = unsafe { Box::from_raw(self.contents.result) };
10945 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10946 let _ = unsafe { Box::from_raw(self.contents.err) };
10951 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
10952 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10953 let contents = if o.result_ok {
10954 let result = unsafe { o.contents.result };
10955 unsafe { o.contents.result = std::ptr::null_mut() };
10956 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
10958 let err = unsafe { o.contents.err };
10959 unsafe { o.contents.err = std::ptr::null_mut(); }
10960 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
10964 result_ok: o.result_ok,
10968 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
10969 fn clone(&self) -> Self {
10970 if self.result_ok {
10971 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10972 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
10975 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10976 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10982 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10983 /// but with all dynamically-allocated buffers duplicated in new buffers.
10984 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
10986 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
10987 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
10988 /// A pointer to the contents in the success state.
10989 /// Reading from this pointer when `result_ok` is not set is undefined.
10990 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
10991 /// A pointer to the contents in the error state.
10992 /// Reading from this pointer when `result_ok` is set is undefined.
10993 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10996 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10997 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10999 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
11000 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
11001 /// `err` or `result` depending on the state of `result_ok`.
11002 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
11003 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
11004 pub result_ok: bool,
11007 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11008 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
11009 CResult_GossipTimestampFilterDecodeErrorZ {
11010 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11011 result: Box::into_raw(Box::new(o)),
11017 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11018 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
11019 CResult_GossipTimestampFilterDecodeErrorZ {
11020 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11021 err: Box::into_raw(Box::new(e)),
11027 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11028 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
11029 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
11030 fn drop(&mut self) {
11031 if self.result_ok {
11032 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11033 let _ = unsafe { Box::from_raw(self.contents.result) };
11036 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11037 let _ = unsafe { Box::from_raw(self.contents.err) };
11042 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
11043 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
11044 let contents = if o.result_ok {
11045 let result = unsafe { o.contents.result };
11046 unsafe { o.contents.result = std::ptr::null_mut() };
11047 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
11049 let err = unsafe { o.contents.err };
11050 unsafe { o.contents.err = std::ptr::null_mut(); }
11051 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
11055 result_ok: o.result_ok,
11059 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
11060 fn clone(&self) -> Self {
11061 if self.result_ok {
11062 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11063 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
11066 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11067 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11073 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11074 /// but with all dynamically-allocated buffers duplicated in new buffers.
11075 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
11077 /// The contents of CResult_InvoiceSignOrCreationErrorZ
11078 pub union CResult_InvoiceSignOrCreationErrorZPtr {
11079 /// A pointer to the contents in the success state.
11080 /// Reading from this pointer when `result_ok` is not set is undefined.
11081 pub result: *mut crate::lightning_invoice::Invoice,
11082 /// A pointer to the contents in the error state.
11083 /// Reading from this pointer when `result_ok` is set is undefined.
11084 pub err: *mut crate::lightning_invoice::SignOrCreationError,
11087 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11088 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11090 pub struct CResult_InvoiceSignOrCreationErrorZ {
11091 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11092 /// `err` or `result` depending on the state of `result_ok`.
11093 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
11094 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11095 pub result_ok: bool,
11098 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11099 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
11100 CResult_InvoiceSignOrCreationErrorZ {
11101 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11102 result: Box::into_raw(Box::new(o)),
11108 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11109 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
11110 CResult_InvoiceSignOrCreationErrorZ {
11111 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11112 err: Box::into_raw(Box::new(e)),
11118 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11119 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
11120 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
11121 fn drop(&mut self) {
11122 if self.result_ok {
11123 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11124 let _ = unsafe { Box::from_raw(self.contents.result) };
11127 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11128 let _ = unsafe { Box::from_raw(self.contents.err) };
11133 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11134 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11135 let contents = if o.result_ok {
11136 let result = unsafe { o.contents.result };
11137 unsafe { o.contents.result = std::ptr::null_mut() };
11138 CResult_InvoiceSignOrCreationErrorZPtr { result }
11140 let err = unsafe { o.contents.err };
11141 unsafe { o.contents.err = std::ptr::null_mut(); }
11142 CResult_InvoiceSignOrCreationErrorZPtr { err }
11146 result_ok: o.result_ok,
11150 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11151 fn clone(&self) -> Self {
11152 if self.result_ok {
11153 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11154 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11157 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11158 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11164 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11165 /// but with all dynamically-allocated buffers duplicated in new buffers.
11166 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }