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_ShutdownScriptDecodeErrorZ
1224 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1225 /// A pointer to the contents in the success state.
1226 /// Reading from this pointer when `result_ok` is not set is undefined.
1227 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1228 /// A pointer to the contents in the error state.
1229 /// Reading from this pointer when `result_ok` is set is undefined.
1230 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1233 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1234 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1236 pub struct CResult_ShutdownScriptDecodeErrorZ {
1237 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1238 /// `err` or `result` depending on the state of `result_ok`.
1239 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1240 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1241 pub result_ok: bool,
1244 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1245 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1246 CResult_ShutdownScriptDecodeErrorZ {
1247 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1248 result: Box::into_raw(Box::new(o)),
1254 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1255 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1256 CResult_ShutdownScriptDecodeErrorZ {
1257 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1258 err: Box::into_raw(Box::new(e)),
1264 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1265 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1266 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1267 fn drop(&mut self) {
1269 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1270 let _ = unsafe { Box::from_raw(self.contents.result) };
1273 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1274 let _ = unsafe { Box::from_raw(self.contents.err) };
1279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1280 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1281 let contents = if o.result_ok {
1282 let result = unsafe { o.contents.result };
1283 unsafe { o.contents.result = std::ptr::null_mut() };
1284 CResult_ShutdownScriptDecodeErrorZPtr { result }
1286 let err = unsafe { o.contents.err };
1287 unsafe { o.contents.err = std::ptr::null_mut(); }
1288 CResult_ShutdownScriptDecodeErrorZPtr { err }
1292 result_ok: o.result_ok,
1296 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1297 fn clone(&self) -> Self {
1299 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1300 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1303 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1304 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1310 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1311 /// but with all dynamically-allocated buffers duplicated in new buffers.
1312 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { orig.clone() }
1314 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1315 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1316 /// A pointer to the contents in the success state.
1317 /// Reading from this pointer when `result_ok` is not set is undefined.
1318 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1319 /// A pointer to the contents in the error state.
1320 /// Reading from this pointer when `result_ok` is set is undefined.
1321 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1324 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1325 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1327 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1328 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1329 /// `err` or `result` depending on the state of `result_ok`.
1330 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1331 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1332 pub result_ok: bool,
1335 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1336 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1337 CResult_ShutdownScriptInvalidShutdownScriptZ {
1338 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1339 result: Box::into_raw(Box::new(o)),
1345 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1346 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1347 CResult_ShutdownScriptInvalidShutdownScriptZ {
1348 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1349 err: Box::into_raw(Box::new(e)),
1355 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1356 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1357 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1358 fn drop(&mut self) {
1360 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1361 let _ = unsafe { Box::from_raw(self.contents.result) };
1364 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1365 let _ = unsafe { Box::from_raw(self.contents.err) };
1370 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1371 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1372 let contents = if o.result_ok {
1373 let result = unsafe { o.contents.result };
1374 unsafe { o.contents.result = std::ptr::null_mut() };
1375 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1377 let err = unsafe { o.contents.err };
1378 unsafe { o.contents.err = std::ptr::null_mut(); }
1379 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1383 result_ok: o.result_ok,
1388 /// The contents of CResult_NoneErrorZ
1389 pub union CResult_NoneErrorZPtr {
1390 /// Note that this value is always NULL, as there are no contents in the OK variant
1391 pub result: *mut std::ffi::c_void,
1392 /// A pointer to the contents in the error state.
1393 /// Reading from this pointer when `result_ok` is set is undefined.
1394 pub err: *mut crate::c_types::IOError,
1397 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1398 /// containing a () on success and a crate::c_types::IOError on failure.
1399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1400 pub struct CResult_NoneErrorZ {
1401 /// The contents of this CResult_NoneErrorZ, accessible via either
1402 /// `err` or `result` depending on the state of `result_ok`.
1403 pub contents: CResult_NoneErrorZPtr,
1404 /// Whether this CResult_NoneErrorZ represents a success state.
1405 pub result_ok: bool,
1408 /// Creates a new CResult_NoneErrorZ in the success state.
1409 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1410 CResult_NoneErrorZ {
1411 contents: CResult_NoneErrorZPtr {
1412 result: std::ptr::null_mut(),
1418 /// Creates a new CResult_NoneErrorZ in the error state.
1419 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1420 CResult_NoneErrorZ {
1421 contents: CResult_NoneErrorZPtr {
1422 err: Box::into_raw(Box::new(e)),
1428 /// Frees any resources used by the CResult_NoneErrorZ.
1429 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1430 impl Drop for CResult_NoneErrorZ {
1431 fn drop(&mut self) {
1434 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1435 let _ = unsafe { Box::from_raw(self.contents.err) };
1440 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1441 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1442 let contents = if o.result_ok {
1443 let _ = unsafe { Box::from_raw(o.contents.result) };
1444 o.contents.result = std::ptr::null_mut();
1445 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1447 let err = unsafe { o.contents.err };
1448 unsafe { o.contents.err = std::ptr::null_mut(); }
1449 CResult_NoneErrorZPtr { err }
1453 result_ok: o.result_ok,
1457 impl Clone for CResult_NoneErrorZ {
1458 fn clone(&self) -> Self {
1460 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1461 result: std::ptr::null_mut()
1464 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1465 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1471 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1472 /// but with all dynamically-allocated buffers duplicated in new buffers.
1473 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { orig.clone() }
1475 /// The contents of CResult_RouteHopDecodeErrorZ
1476 pub union CResult_RouteHopDecodeErrorZPtr {
1477 /// A pointer to the contents in the success state.
1478 /// Reading from this pointer when `result_ok` is not set is undefined.
1479 pub result: *mut crate::lightning::routing::router::RouteHop,
1480 /// A pointer to the contents in the error state.
1481 /// Reading from this pointer when `result_ok` is set is undefined.
1482 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1485 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1486 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1487 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1488 pub struct CResult_RouteHopDecodeErrorZ {
1489 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1490 /// `err` or `result` depending on the state of `result_ok`.
1491 pub contents: CResult_RouteHopDecodeErrorZPtr,
1492 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1493 pub result_ok: bool,
1496 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1497 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1498 CResult_RouteHopDecodeErrorZ {
1499 contents: CResult_RouteHopDecodeErrorZPtr {
1500 result: Box::into_raw(Box::new(o)),
1506 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1507 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1508 CResult_RouteHopDecodeErrorZ {
1509 contents: CResult_RouteHopDecodeErrorZPtr {
1510 err: Box::into_raw(Box::new(e)),
1516 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1517 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1518 impl Drop for CResult_RouteHopDecodeErrorZ {
1519 fn drop(&mut self) {
1521 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1522 let _ = unsafe { Box::from_raw(self.contents.result) };
1525 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1526 let _ = unsafe { Box::from_raw(self.contents.err) };
1531 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1532 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1533 let contents = if o.result_ok {
1534 let result = unsafe { o.contents.result };
1535 unsafe { o.contents.result = std::ptr::null_mut() };
1536 CResult_RouteHopDecodeErrorZPtr { result }
1538 let err = unsafe { o.contents.err };
1539 unsafe { o.contents.err = std::ptr::null_mut(); }
1540 CResult_RouteHopDecodeErrorZPtr { err }
1544 result_ok: o.result_ok,
1548 impl Clone for CResult_RouteHopDecodeErrorZ {
1549 fn clone(&self) -> Self {
1551 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1552 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1555 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1556 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1562 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1563 /// but with all dynamically-allocated buffers duplicated in new buffers.
1564 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { orig.clone() }
1566 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1567 /// This corresponds to std::vector in C++
1568 pub struct CVec_RouteHopZ {
1569 /// The elements in the array.
1570 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1571 pub data: *mut crate::lightning::routing::router::RouteHop,
1572 /// The number of elements pointed to by `data`.
1575 impl CVec_RouteHopZ {
1576 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1577 if self.datalen == 0 { return Vec::new(); }
1578 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1579 self.data = std::ptr::null_mut();
1583 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1584 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1587 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1588 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1589 let datalen = v.len();
1590 let data = Box::into_raw(v.into_boxed_slice());
1591 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1595 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1596 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1597 impl Drop for CVec_RouteHopZ {
1598 fn drop(&mut self) {
1599 if self.datalen == 0 { return; }
1600 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1603 impl Clone for CVec_RouteHopZ {
1604 fn clone(&self) -> Self {
1605 let mut res = Vec::new();
1606 if self.datalen == 0 { return Self::from(res); }
1607 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1612 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1613 /// This corresponds to std::vector in C++
1614 pub struct CVec_CVec_RouteHopZZ {
1615 /// The elements in the array.
1616 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1617 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1618 /// The number of elements pointed to by `data`.
1621 impl CVec_CVec_RouteHopZZ {
1622 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1623 if self.datalen == 0 { return Vec::new(); }
1624 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1625 self.data = std::ptr::null_mut();
1629 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1630 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1633 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1634 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1635 let datalen = v.len();
1636 let data = Box::into_raw(v.into_boxed_slice());
1637 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1641 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1642 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1643 impl Drop for CVec_CVec_RouteHopZZ {
1644 fn drop(&mut self) {
1645 if self.datalen == 0 { return; }
1646 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1649 impl Clone for CVec_CVec_RouteHopZZ {
1650 fn clone(&self) -> Self {
1651 let mut res = Vec::new();
1652 if self.datalen == 0 { return Self::from(res); }
1653 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1658 /// The contents of CResult_RouteDecodeErrorZ
1659 pub union CResult_RouteDecodeErrorZPtr {
1660 /// A pointer to the contents in the success state.
1661 /// Reading from this pointer when `result_ok` is not set is undefined.
1662 pub result: *mut crate::lightning::routing::router::Route,
1663 /// A pointer to the contents in the error state.
1664 /// Reading from this pointer when `result_ok` is set is undefined.
1665 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1668 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1669 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1671 pub struct CResult_RouteDecodeErrorZ {
1672 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1673 /// `err` or `result` depending on the state of `result_ok`.
1674 pub contents: CResult_RouteDecodeErrorZPtr,
1675 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1676 pub result_ok: bool,
1679 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1680 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1681 CResult_RouteDecodeErrorZ {
1682 contents: CResult_RouteDecodeErrorZPtr {
1683 result: Box::into_raw(Box::new(o)),
1689 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1690 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1691 CResult_RouteDecodeErrorZ {
1692 contents: CResult_RouteDecodeErrorZPtr {
1693 err: Box::into_raw(Box::new(e)),
1699 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1700 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1701 impl Drop for CResult_RouteDecodeErrorZ {
1702 fn drop(&mut self) {
1704 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1705 let _ = unsafe { Box::from_raw(self.contents.result) };
1708 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1709 let _ = unsafe { Box::from_raw(self.contents.err) };
1714 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1715 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1716 let contents = if o.result_ok {
1717 let result = unsafe { o.contents.result };
1718 unsafe { o.contents.result = std::ptr::null_mut() };
1719 CResult_RouteDecodeErrorZPtr { result }
1721 let err = unsafe { o.contents.err };
1722 unsafe { o.contents.err = std::ptr::null_mut(); }
1723 CResult_RouteDecodeErrorZPtr { err }
1727 result_ok: o.result_ok,
1731 impl Clone for CResult_RouteDecodeErrorZ {
1732 fn clone(&self) -> Self {
1734 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1735 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1738 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1739 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1745 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1746 /// but with all dynamically-allocated buffers duplicated in new buffers.
1747 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
1750 /// An enum which can either contain a u64 or not
1751 pub enum COption_u64Z {
1752 /// When we're in this state, this COption_u64Z contains a u64
1754 /// When we're in this state, this COption_u64Z contains nothing
1758 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1759 if let Self::Some(_) = self { true } else { false }
1761 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1762 if let Self::Some(v) = self { v } else { unreachable!() }
1766 /// Constructs a new COption_u64Z containing a u64
1767 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1768 COption_u64Z::Some(o)
1771 /// Constructs a new COption_u64Z containing nothing
1772 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1776 /// Frees any resources associated with the u64, if we are in the Some state
1777 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1779 /// Creates a new COption_u64Z which has the same data as `orig`
1780 /// but with all dynamically-allocated buffers duplicated in new buffers.
1781 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1783 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1784 /// This corresponds to std::vector in C++
1785 pub struct CVec_ChannelDetailsZ {
1786 /// The elements in the array.
1787 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1788 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
1789 /// The number of elements pointed to by `data`.
1792 impl CVec_ChannelDetailsZ {
1793 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
1794 if self.datalen == 0 { return Vec::new(); }
1795 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1796 self.data = std::ptr::null_mut();
1800 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
1801 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1804 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1805 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
1806 let datalen = v.len();
1807 let data = Box::into_raw(v.into_boxed_slice());
1808 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1812 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1813 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1814 impl Drop for CVec_ChannelDetailsZ {
1815 fn drop(&mut self) {
1816 if self.datalen == 0 { return; }
1817 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1820 impl Clone for CVec_ChannelDetailsZ {
1821 fn clone(&self) -> Self {
1822 let mut res = Vec::new();
1823 if self.datalen == 0 { return Self::from(res); }
1824 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1829 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1830 /// This corresponds to std::vector in C++
1831 pub struct CVec_RouteHintZ {
1832 /// The elements in the array.
1833 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1834 pub data: *mut crate::lightning::routing::router::RouteHint,
1835 /// The number of elements pointed to by `data`.
1838 impl CVec_RouteHintZ {
1839 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1840 if self.datalen == 0 { return Vec::new(); }
1841 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1842 self.data = std::ptr::null_mut();
1846 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1847 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1850 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1851 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1852 let datalen = v.len();
1853 let data = Box::into_raw(v.into_boxed_slice());
1854 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1859 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1860 impl Drop for CVec_RouteHintZ {
1861 fn drop(&mut self) {
1862 if self.datalen == 0 { return; }
1863 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1866 impl Clone for CVec_RouteHintZ {
1867 fn clone(&self) -> Self {
1868 let mut res = Vec::new();
1869 if self.datalen == 0 { return Self::from(res); }
1870 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1875 /// The contents of CResult_RouteLightningErrorZ
1876 pub union CResult_RouteLightningErrorZPtr {
1877 /// A pointer to the contents in the success state.
1878 /// Reading from this pointer when `result_ok` is not set is undefined.
1879 pub result: *mut crate::lightning::routing::router::Route,
1880 /// A pointer to the contents in the error state.
1881 /// Reading from this pointer when `result_ok` is set is undefined.
1882 pub err: *mut crate::lightning::ln::msgs::LightningError,
1885 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1886 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1888 pub struct CResult_RouteLightningErrorZ {
1889 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
1890 /// `err` or `result` depending on the state of `result_ok`.
1891 pub contents: CResult_RouteLightningErrorZPtr,
1892 /// Whether this CResult_RouteLightningErrorZ represents a success state.
1893 pub result_ok: bool,
1896 /// Creates a new CResult_RouteLightningErrorZ in the success state.
1897 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
1898 CResult_RouteLightningErrorZ {
1899 contents: CResult_RouteLightningErrorZPtr {
1900 result: Box::into_raw(Box::new(o)),
1906 /// Creates a new CResult_RouteLightningErrorZ in the error state.
1907 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
1908 CResult_RouteLightningErrorZ {
1909 contents: CResult_RouteLightningErrorZPtr {
1910 err: Box::into_raw(Box::new(e)),
1916 /// Frees any resources used by the CResult_RouteLightningErrorZ.
1917 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
1918 impl Drop for CResult_RouteLightningErrorZ {
1919 fn drop(&mut self) {
1921 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1922 let _ = unsafe { Box::from_raw(self.contents.result) };
1925 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1926 let _ = unsafe { Box::from_raw(self.contents.err) };
1931 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
1932 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
1933 let contents = if o.result_ok {
1934 let result = unsafe { o.contents.result };
1935 unsafe { o.contents.result = std::ptr::null_mut() };
1936 CResult_RouteLightningErrorZPtr { result }
1938 let err = unsafe { o.contents.err };
1939 unsafe { o.contents.err = std::ptr::null_mut(); }
1940 CResult_RouteLightningErrorZPtr { err }
1944 result_ok: o.result_ok,
1948 impl Clone for CResult_RouteLightningErrorZ {
1949 fn clone(&self) -> Self {
1951 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
1952 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1955 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
1956 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1962 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
1963 /// but with all dynamically-allocated buffers duplicated in new buffers.
1964 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
1966 /// The contents of CResult_TxOutAccessErrorZ
1967 pub union CResult_TxOutAccessErrorZPtr {
1968 /// A pointer to the contents in the success state.
1969 /// Reading from this pointer when `result_ok` is not set is undefined.
1970 pub result: *mut crate::c_types::TxOut,
1971 /// A pointer to the contents in the error state.
1972 /// Reading from this pointer when `result_ok` is set is undefined.
1973 pub err: *mut crate::lightning::chain::AccessError,
1976 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1977 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1978 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1979 pub struct CResult_TxOutAccessErrorZ {
1980 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
1981 /// `err` or `result` depending on the state of `result_ok`.
1982 pub contents: CResult_TxOutAccessErrorZPtr,
1983 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
1984 pub result_ok: bool,
1987 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
1988 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
1989 CResult_TxOutAccessErrorZ {
1990 contents: CResult_TxOutAccessErrorZPtr {
1991 result: Box::into_raw(Box::new(o)),
1997 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
1998 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
1999 CResult_TxOutAccessErrorZ {
2000 contents: CResult_TxOutAccessErrorZPtr {
2001 err: Box::into_raw(Box::new(e)),
2007 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2008 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2009 impl Drop for CResult_TxOutAccessErrorZ {
2010 fn drop(&mut self) {
2012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2013 let _ = unsafe { Box::from_raw(self.contents.result) };
2016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2017 let _ = unsafe { Box::from_raw(self.contents.err) };
2022 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2023 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2024 let contents = if o.result_ok {
2025 let result = unsafe { o.contents.result };
2026 unsafe { o.contents.result = std::ptr::null_mut() };
2027 CResult_TxOutAccessErrorZPtr { result }
2029 let err = unsafe { o.contents.err };
2030 unsafe { o.contents.err = std::ptr::null_mut(); }
2031 CResult_TxOutAccessErrorZPtr { err }
2035 result_ok: o.result_ok,
2039 impl Clone for CResult_TxOutAccessErrorZ {
2040 fn clone(&self) -> Self {
2042 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2043 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2046 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2047 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2053 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2054 /// but with all dynamically-allocated buffers duplicated in new buffers.
2055 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
2057 /// A tuple of 2 elements. See the individual fields for the types contained.
2058 pub struct C2Tuple_usizeTransactionZ {
2059 /// The element at position 0
2061 /// The element at position 1
2062 pub b: crate::c_types::Transaction,
2064 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2065 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2072 impl C2Tuple_usizeTransactionZ {
2073 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2077 impl Clone for C2Tuple_usizeTransactionZ {
2078 fn clone(&self) -> Self {
2086 /// Creates a new tuple which has the same data as `orig`
2087 /// but with all dynamically-allocated buffers duplicated in new buffers.
2088 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { orig.clone() }
2089 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2091 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2092 C2Tuple_usizeTransactionZ { a, b, }
2096 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2097 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2099 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2100 /// This corresponds to std::vector in C++
2101 pub struct CVec_C2Tuple_usizeTransactionZZ {
2102 /// The elements in the array.
2103 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2104 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2105 /// The number of elements pointed to by `data`.
2108 impl CVec_C2Tuple_usizeTransactionZZ {
2109 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2110 if self.datalen == 0 { return Vec::new(); }
2111 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2112 self.data = std::ptr::null_mut();
2116 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2117 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2120 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2121 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2122 let datalen = v.len();
2123 let data = Box::into_raw(v.into_boxed_slice());
2124 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2128 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2129 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2130 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2131 fn drop(&mut self) {
2132 if self.datalen == 0 { return; }
2133 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2136 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2137 fn clone(&self) -> Self {
2138 let mut res = Vec::new();
2139 if self.datalen == 0 { return Self::from(res); }
2140 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2145 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2146 /// This corresponds to std::vector in C++
2147 pub struct CVec_TxidZ {
2148 /// The elements in the array.
2149 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2150 pub data: *mut crate::c_types::ThirtyTwoBytes,
2151 /// The number of elements pointed to by `data`.
2155 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2156 if self.datalen == 0 { return Vec::new(); }
2157 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2158 self.data = std::ptr::null_mut();
2162 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2163 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2166 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2167 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2168 let datalen = v.len();
2169 let data = Box::into_raw(v.into_boxed_slice());
2170 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2174 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2175 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2176 impl Drop for CVec_TxidZ {
2177 fn drop(&mut self) {
2178 if self.datalen == 0 { return; }
2179 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2182 impl Clone for CVec_TxidZ {
2183 fn clone(&self) -> Self {
2184 let mut res = Vec::new();
2185 if self.datalen == 0 { return Self::from(res); }
2186 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2191 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2192 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2193 /// Note that this value is always NULL, as there are no contents in the OK variant
2194 pub result: *mut std::ffi::c_void,
2195 /// A pointer to the contents in the error state.
2196 /// Reading from this pointer when `result_ok` is set is undefined.
2197 pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2200 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2201 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2203 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2204 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2205 /// `err` or `result` depending on the state of `result_ok`.
2206 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2207 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2208 pub result_ok: bool,
2211 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2212 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2213 CResult_NoneChannelMonitorUpdateErrZ {
2214 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2215 result: std::ptr::null_mut(),
2221 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2222 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2223 CResult_NoneChannelMonitorUpdateErrZ {
2224 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2225 err: Box::into_raw(Box::new(e)),
2231 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2232 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2233 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2234 fn drop(&mut self) {
2237 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2238 let _ = unsafe { Box::from_raw(self.contents.err) };
2243 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2244 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2245 let contents = if o.result_ok {
2246 let _ = unsafe { Box::from_raw(o.contents.result) };
2247 o.contents.result = std::ptr::null_mut();
2248 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2250 let err = unsafe { o.contents.err };
2251 unsafe { o.contents.err = std::ptr::null_mut(); }
2252 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2256 result_ok: o.result_ok,
2260 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2261 fn clone(&self) -> Self {
2263 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2264 result: std::ptr::null_mut()
2267 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2268 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2274 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2275 /// but with all dynamically-allocated buffers duplicated in new buffers.
2276 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2278 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2279 /// This corresponds to std::vector in C++
2280 pub struct CVec_MonitorEventZ {
2281 /// The elements in the array.
2282 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2283 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2284 /// The number of elements pointed to by `data`.
2287 impl CVec_MonitorEventZ {
2288 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2289 if self.datalen == 0 { return Vec::new(); }
2290 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2291 self.data = std::ptr::null_mut();
2295 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2296 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2299 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2300 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2301 let datalen = v.len();
2302 let data = Box::into_raw(v.into_boxed_slice());
2303 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2307 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2308 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2309 impl Drop for CVec_MonitorEventZ {
2310 fn drop(&mut self) {
2311 if self.datalen == 0 { return; }
2312 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2315 impl Clone for CVec_MonitorEventZ {
2316 fn clone(&self) -> Self {
2317 let mut res = Vec::new();
2318 if self.datalen == 0 { return Self::from(res); }
2319 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2325 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2326 pub enum COption_C2Tuple_usizeTransactionZZ {
2327 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2328 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2329 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2332 impl COption_C2Tuple_usizeTransactionZZ {
2333 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2334 if let Self::Some(_) = self { true } else { false }
2336 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2337 if let Self::Some(v) = self { v } else { unreachable!() }
2341 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2342 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2343 COption_C2Tuple_usizeTransactionZZ::Some(o)
2346 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2347 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2348 COption_C2Tuple_usizeTransactionZZ::None
2351 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2352 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2354 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2355 /// but with all dynamically-allocated buffers duplicated in new buffers.
2356 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { orig.clone() }
2358 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2359 /// This corresponds to std::vector in C++
2360 pub struct CVec_SpendableOutputDescriptorZ {
2361 /// The elements in the array.
2362 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2363 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2364 /// The number of elements pointed to by `data`.
2367 impl CVec_SpendableOutputDescriptorZ {
2368 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2369 if self.datalen == 0 { return Vec::new(); }
2370 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2371 self.data = std::ptr::null_mut();
2375 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2376 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2379 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2380 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2381 let datalen = v.len();
2382 let data = Box::into_raw(v.into_boxed_slice());
2383 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2387 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2388 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2389 impl Drop for CVec_SpendableOutputDescriptorZ {
2390 fn drop(&mut self) {
2391 if self.datalen == 0 { return; }
2392 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2395 impl Clone for CVec_SpendableOutputDescriptorZ {
2396 fn clone(&self) -> Self {
2397 let mut res = Vec::new();
2398 if self.datalen == 0 { return Self::from(res); }
2399 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2404 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2405 /// This corresponds to std::vector in C++
2406 pub struct CVec_MessageSendEventZ {
2407 /// The elements in the array.
2408 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2409 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2410 /// The number of elements pointed to by `data`.
2413 impl CVec_MessageSendEventZ {
2414 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2415 if self.datalen == 0 { return Vec::new(); }
2416 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2417 self.data = std::ptr::null_mut();
2421 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2422 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2425 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2426 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2427 let datalen = v.len();
2428 let data = Box::into_raw(v.into_boxed_slice());
2429 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2433 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2434 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2435 impl Drop for CVec_MessageSendEventZ {
2436 fn drop(&mut self) {
2437 if self.datalen == 0 { return; }
2438 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2441 impl Clone for CVec_MessageSendEventZ {
2442 fn clone(&self) -> Self {
2443 let mut res = Vec::new();
2444 if self.datalen == 0 { return Self::from(res); }
2445 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2450 /// The contents of CResult_InitFeaturesDecodeErrorZ
2451 pub union CResult_InitFeaturesDecodeErrorZPtr {
2452 /// A pointer to the contents in the success state.
2453 /// Reading from this pointer when `result_ok` is not set is undefined.
2454 pub result: *mut crate::lightning::ln::features::InitFeatures,
2455 /// A pointer to the contents in the error state.
2456 /// Reading from this pointer when `result_ok` is set is undefined.
2457 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2460 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2461 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2463 pub struct CResult_InitFeaturesDecodeErrorZ {
2464 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2465 /// `err` or `result` depending on the state of `result_ok`.
2466 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2467 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2468 pub result_ok: bool,
2471 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2472 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2473 CResult_InitFeaturesDecodeErrorZ {
2474 contents: CResult_InitFeaturesDecodeErrorZPtr {
2475 result: Box::into_raw(Box::new(o)),
2481 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
2482 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
2483 CResult_InitFeaturesDecodeErrorZ {
2484 contents: CResult_InitFeaturesDecodeErrorZPtr {
2485 err: Box::into_raw(Box::new(e)),
2491 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
2492 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
2493 impl Drop for CResult_InitFeaturesDecodeErrorZ {
2494 fn drop(&mut self) {
2496 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2497 let _ = unsafe { Box::from_raw(self.contents.result) };
2500 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2501 let _ = unsafe { Box::from_raw(self.contents.err) };
2506 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
2507 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2508 let contents = if o.result_ok {
2509 let result = unsafe { o.contents.result };
2510 unsafe { o.contents.result = std::ptr::null_mut() };
2511 CResult_InitFeaturesDecodeErrorZPtr { result }
2513 let err = unsafe { o.contents.err };
2514 unsafe { o.contents.err = std::ptr::null_mut(); }
2515 CResult_InitFeaturesDecodeErrorZPtr { err }
2519 result_ok: o.result_ok,
2524 /// The contents of CResult_NodeFeaturesDecodeErrorZ
2525 pub union CResult_NodeFeaturesDecodeErrorZPtr {
2526 /// A pointer to the contents in the success state.
2527 /// Reading from this pointer when `result_ok` is not set is undefined.
2528 pub result: *mut crate::lightning::ln::features::NodeFeatures,
2529 /// A pointer to the contents in the error state.
2530 /// Reading from this pointer when `result_ok` is set is undefined.
2531 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2534 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2535 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2537 pub struct CResult_NodeFeaturesDecodeErrorZ {
2538 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2539 /// `err` or `result` depending on the state of `result_ok`.
2540 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
2541 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2542 pub result_ok: bool,
2545 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2546 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2547 CResult_NodeFeaturesDecodeErrorZ {
2548 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2549 result: Box::into_raw(Box::new(o)),
2555 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2556 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2557 CResult_NodeFeaturesDecodeErrorZ {
2558 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2559 err: Box::into_raw(Box::new(e)),
2565 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2566 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2567 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2568 fn drop(&mut self) {
2570 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2571 let _ = unsafe { Box::from_raw(self.contents.result) };
2574 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2575 let _ = unsafe { Box::from_raw(self.contents.err) };
2580 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2581 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2582 let contents = if o.result_ok {
2583 let result = unsafe { o.contents.result };
2584 unsafe { o.contents.result = std::ptr::null_mut() };
2585 CResult_NodeFeaturesDecodeErrorZPtr { result }
2587 let err = unsafe { o.contents.err };
2588 unsafe { o.contents.err = std::ptr::null_mut(); }
2589 CResult_NodeFeaturesDecodeErrorZPtr { err }
2593 result_ok: o.result_ok,
2598 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2599 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2600 /// A pointer to the contents in the success state.
2601 /// Reading from this pointer when `result_ok` is not set is undefined.
2602 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
2603 /// A pointer to the contents in the error state.
2604 /// Reading from this pointer when `result_ok` is set is undefined.
2605 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2608 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2609 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2611 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2612 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2613 /// `err` or `result` depending on the state of `result_ok`.
2614 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2615 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2616 pub result_ok: bool,
2619 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2620 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2621 CResult_ChannelFeaturesDecodeErrorZ {
2622 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2623 result: Box::into_raw(Box::new(o)),
2629 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2630 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2631 CResult_ChannelFeaturesDecodeErrorZ {
2632 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2633 err: Box::into_raw(Box::new(e)),
2639 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2640 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2641 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
2642 fn drop(&mut self) {
2644 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2645 let _ = unsafe { Box::from_raw(self.contents.result) };
2648 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2649 let _ = unsafe { Box::from_raw(self.contents.err) };
2654 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2655 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2656 let contents = if o.result_ok {
2657 let result = unsafe { o.contents.result };
2658 unsafe { o.contents.result = std::ptr::null_mut() };
2659 CResult_ChannelFeaturesDecodeErrorZPtr { result }
2661 let err = unsafe { o.contents.err };
2662 unsafe { o.contents.err = std::ptr::null_mut(); }
2663 CResult_ChannelFeaturesDecodeErrorZPtr { err }
2667 result_ok: o.result_ok,
2672 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2673 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
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::ln::features::InvoiceFeatures,
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_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2683 /// containing a crate::lightning::ln::features::InvoiceFeatures 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_InvoiceFeaturesDecodeErrorZ {
2686 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2687 /// `err` or `result` depending on the state of `result_ok`.
2688 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2689 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2690 pub result_ok: bool,
2693 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2694 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2695 CResult_InvoiceFeaturesDecodeErrorZ {
2696 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2697 result: Box::into_raw(Box::new(o)),
2703 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2704 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2705 CResult_InvoiceFeaturesDecodeErrorZ {
2706 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2707 err: Box::into_raw(Box::new(e)),
2713 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2714 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2715 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
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::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2729 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, 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_InvoiceFeaturesDecodeErrorZPtr { result }
2735 let err = unsafe { o.contents.err };
2736 unsafe { o.contents.err = std::ptr::null_mut(); }
2737 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2741 result_ok: o.result_ok,
2746 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2747 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2748 /// A pointer to the contents in the success state.
2749 /// Reading from this pointer when `result_ok` is not set is undefined.
2750 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
2751 /// A pointer to the contents in the error state.
2752 /// Reading from this pointer when `result_ok` is set is undefined.
2753 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2756 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2757 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2759 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2760 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2761 /// `err` or `result` depending on the state of `result_ok`.
2762 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
2763 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2764 pub result_ok: bool,
2767 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
2768 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2769 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2770 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2771 result: Box::into_raw(Box::new(o)),
2777 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
2778 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2779 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2780 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2781 err: Box::into_raw(Box::new(e)),
2787 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
2788 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
2789 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2790 fn drop(&mut self) {
2792 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2793 let _ = unsafe { Box::from_raw(self.contents.result) };
2796 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2797 let _ = unsafe { Box::from_raw(self.contents.err) };
2802 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2803 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2804 let contents = if o.result_ok {
2805 let result = unsafe { o.contents.result };
2806 unsafe { o.contents.result = std::ptr::null_mut() };
2807 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
2809 let err = unsafe { o.contents.err };
2810 unsafe { o.contents.err = std::ptr::null_mut(); }
2811 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
2815 result_ok: o.result_ok,
2819 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2820 fn clone(&self) -> Self {
2822 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2823 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2826 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2827 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2833 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2834 /// but with all dynamically-allocated buffers duplicated in new buffers.
2835 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2837 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2838 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2839 /// A pointer to the contents in the success state.
2840 /// Reading from this pointer when `result_ok` is not set is undefined.
2841 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
2842 /// A pointer to the contents in the error state.
2843 /// Reading from this pointer when `result_ok` is set is undefined.
2844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2847 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2848 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2850 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2851 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2852 /// `err` or `result` depending on the state of `result_ok`.
2853 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
2854 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2855 pub result_ok: bool,
2858 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
2859 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2860 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2861 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2862 result: Box::into_raw(Box::new(o)),
2868 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
2869 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2870 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2871 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2872 err: Box::into_raw(Box::new(e)),
2878 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
2879 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
2880 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2881 fn drop(&mut self) {
2883 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2884 let _ = unsafe { Box::from_raw(self.contents.result) };
2887 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2888 let _ = unsafe { Box::from_raw(self.contents.err) };
2893 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2894 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2895 let contents = if o.result_ok {
2896 let result = unsafe { o.contents.result };
2897 unsafe { o.contents.result = std::ptr::null_mut() };
2898 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
2900 let err = unsafe { o.contents.err };
2901 unsafe { o.contents.err = std::ptr::null_mut(); }
2902 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
2906 result_ok: o.result_ok,
2910 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2911 fn clone(&self) -> Self {
2913 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2914 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2917 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2918 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2924 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2925 /// but with all dynamically-allocated buffers duplicated in new buffers.
2926 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2928 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
2929 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2930 /// A pointer to the contents in the success state.
2931 /// Reading from this pointer when `result_ok` is not set is undefined.
2932 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2933 /// A pointer to the contents in the error state.
2934 /// Reading from this pointer when `result_ok` is set is undefined.
2935 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2938 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2939 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2941 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
2942 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
2943 /// `err` or `result` depending on the state of `result_ok`.
2944 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
2945 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
2946 pub result_ok: bool,
2949 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
2950 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2951 CResult_SpendableOutputDescriptorDecodeErrorZ {
2952 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2953 result: Box::into_raw(Box::new(o)),
2959 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
2960 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2961 CResult_SpendableOutputDescriptorDecodeErrorZ {
2962 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2963 err: Box::into_raw(Box::new(e)),
2969 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
2970 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
2971 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
2972 fn drop(&mut self) {
2974 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2975 let _ = unsafe { Box::from_raw(self.contents.result) };
2978 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2979 let _ = unsafe { Box::from_raw(self.contents.err) };
2984 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
2985 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2986 let contents = if o.result_ok {
2987 let result = unsafe { o.contents.result };
2988 unsafe { o.contents.result = std::ptr::null_mut() };
2989 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
2991 let err = unsafe { o.contents.err };
2992 unsafe { o.contents.err = std::ptr::null_mut(); }
2993 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
2997 result_ok: o.result_ok,
3001 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3002 fn clone(&self) -> Self {
3004 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3005 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3008 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3009 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3015 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3016 /// but with all dynamically-allocated buffers duplicated in new buffers.
3017 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
3019 /// A tuple of 2 elements. See the individual fields for the types contained.
3020 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3021 /// The element at position 0
3022 pub a: crate::c_types::Signature,
3023 /// The element at position 1
3024 pub b: crate::c_types::derived::CVec_SignatureZ,
3026 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3027 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3034 impl C2Tuple_SignatureCVec_SignatureZZ {
3035 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3039 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3040 fn clone(&self) -> Self {
3048 /// Creates a new tuple which has the same data as `orig`
3049 /// but with all dynamically-allocated buffers duplicated in new buffers.
3050 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
3051 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3053 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3054 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3058 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3059 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3061 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3062 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3063 /// A pointer to the contents in the success state.
3064 /// Reading from this pointer when `result_ok` is not set is undefined.
3065 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3066 /// Note that this value is always NULL, as there are no contents in the Err variant
3067 pub err: *mut std::ffi::c_void,
3070 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3071 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3073 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3074 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3075 /// `err` or `result` depending on the state of `result_ok`.
3076 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3077 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3078 pub result_ok: bool,
3081 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3082 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3083 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3084 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3085 result: Box::into_raw(Box::new(o)),
3091 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3092 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3093 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3094 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3095 err: std::ptr::null_mut(),
3101 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3102 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3103 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3104 fn drop(&mut self) {
3106 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3107 let _ = unsafe { Box::from_raw(self.contents.result) };
3113 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3114 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3115 let contents = if o.result_ok {
3116 let result = unsafe { o.contents.result };
3117 unsafe { o.contents.result = std::ptr::null_mut() };
3118 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3120 let _ = unsafe { Box::from_raw(o.contents.err) };
3121 o.contents.err = std::ptr::null_mut();
3122 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3126 result_ok: o.result_ok,
3130 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3131 fn clone(&self) -> Self {
3133 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3134 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3137 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3138 err: std::ptr::null_mut()
3144 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3145 /// but with all dynamically-allocated buffers duplicated in new buffers.
3146 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
3148 /// The contents of CResult_SignatureNoneZ
3149 pub union CResult_SignatureNoneZPtr {
3150 /// A pointer to the contents in the success state.
3151 /// Reading from this pointer when `result_ok` is not set is undefined.
3152 pub result: *mut crate::c_types::Signature,
3153 /// Note that this value is always NULL, as there are no contents in the Err variant
3154 pub err: *mut std::ffi::c_void,
3157 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3158 /// containing a crate::c_types::Signature on success and a () on failure.
3159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3160 pub struct CResult_SignatureNoneZ {
3161 /// The contents of this CResult_SignatureNoneZ, accessible via either
3162 /// `err` or `result` depending on the state of `result_ok`.
3163 pub contents: CResult_SignatureNoneZPtr,
3164 /// Whether this CResult_SignatureNoneZ represents a success state.
3165 pub result_ok: bool,
3168 /// Creates a new CResult_SignatureNoneZ in the success state.
3169 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3170 CResult_SignatureNoneZ {
3171 contents: CResult_SignatureNoneZPtr {
3172 result: Box::into_raw(Box::new(o)),
3178 /// Creates a new CResult_SignatureNoneZ in the error state.
3179 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3180 CResult_SignatureNoneZ {
3181 contents: CResult_SignatureNoneZPtr {
3182 err: std::ptr::null_mut(),
3188 /// Frees any resources used by the CResult_SignatureNoneZ.
3189 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3190 impl Drop for CResult_SignatureNoneZ {
3191 fn drop(&mut self) {
3193 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3194 let _ = unsafe { Box::from_raw(self.contents.result) };
3200 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3201 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3202 let contents = if o.result_ok {
3203 let result = unsafe { o.contents.result };
3204 unsafe { o.contents.result = std::ptr::null_mut() };
3205 CResult_SignatureNoneZPtr { result }
3207 let _ = unsafe { Box::from_raw(o.contents.err) };
3208 o.contents.err = std::ptr::null_mut();
3209 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3213 result_ok: o.result_ok,
3217 impl Clone for CResult_SignatureNoneZ {
3218 fn clone(&self) -> Self {
3220 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3221 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3224 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3225 err: std::ptr::null_mut()
3231 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3232 /// but with all dynamically-allocated buffers duplicated in new buffers.
3233 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
3235 /// The contents of CResult_SignDecodeErrorZ
3236 pub union CResult_SignDecodeErrorZPtr {
3237 /// A pointer to the contents in the success state.
3238 /// Reading from this pointer when `result_ok` is not set is undefined.
3239 pub result: *mut crate::lightning::chain::keysinterface::Sign,
3240 /// A pointer to the contents in the error state.
3241 /// Reading from this pointer when `result_ok` is set is undefined.
3242 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3245 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3246 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3248 pub struct CResult_SignDecodeErrorZ {
3249 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3250 /// `err` or `result` depending on the state of `result_ok`.
3251 pub contents: CResult_SignDecodeErrorZPtr,
3252 /// Whether this CResult_SignDecodeErrorZ represents a success state.
3253 pub result_ok: bool,
3256 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3257 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3258 CResult_SignDecodeErrorZ {
3259 contents: CResult_SignDecodeErrorZPtr {
3260 result: Box::into_raw(Box::new(o)),
3266 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3267 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3268 CResult_SignDecodeErrorZ {
3269 contents: CResult_SignDecodeErrorZPtr {
3270 err: Box::into_raw(Box::new(e)),
3276 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3277 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3278 impl Drop for CResult_SignDecodeErrorZ {
3279 fn drop(&mut self) {
3281 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3282 let _ = unsafe { Box::from_raw(self.contents.result) };
3285 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3286 let _ = unsafe { Box::from_raw(self.contents.err) };
3291 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3292 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3293 let contents = if o.result_ok {
3294 let result = unsafe { o.contents.result };
3295 unsafe { o.contents.result = std::ptr::null_mut() };
3296 CResult_SignDecodeErrorZPtr { result }
3298 let err = unsafe { o.contents.err };
3299 unsafe { o.contents.err = std::ptr::null_mut(); }
3300 CResult_SignDecodeErrorZPtr { err }
3304 result_ok: o.result_ok,
3308 impl Clone for CResult_SignDecodeErrorZ {
3309 fn clone(&self) -> Self {
3311 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3312 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3315 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3316 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3322 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3323 /// but with all dynamically-allocated buffers duplicated in new buffers.
3324 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
3326 /// A dynamically-allocated array of u8s of arbitrary size.
3327 /// This corresponds to std::vector in C++
3328 pub struct CVec_u8Z {
3329 /// The elements in the array.
3330 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3332 /// The number of elements pointed to by `data`.
3336 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3337 if self.datalen == 0 { return Vec::new(); }
3338 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3339 self.data = std::ptr::null_mut();
3343 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3344 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3347 impl From<Vec<u8>> for CVec_u8Z {
3348 fn from(v: Vec<u8>) -> Self {
3349 let datalen = v.len();
3350 let data = Box::into_raw(v.into_boxed_slice());
3351 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3355 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3356 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3357 impl Drop for CVec_u8Z {
3358 fn drop(&mut self) {
3359 if self.datalen == 0 { return; }
3360 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3363 impl Clone for CVec_u8Z {
3364 fn clone(&self) -> Self {
3365 let mut res = Vec::new();
3366 if self.datalen == 0 { return Self::from(res); }
3367 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3372 /// The contents of CResult_RecoverableSignatureNoneZ
3373 pub union CResult_RecoverableSignatureNoneZPtr {
3374 /// A pointer to the contents in the success state.
3375 /// Reading from this pointer when `result_ok` is not set is undefined.
3376 pub result: *mut crate::c_types::RecoverableSignature,
3377 /// Note that this value is always NULL, as there are no contents in the Err variant
3378 pub err: *mut std::ffi::c_void,
3381 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3382 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3384 pub struct CResult_RecoverableSignatureNoneZ {
3385 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3386 /// `err` or `result` depending on the state of `result_ok`.
3387 pub contents: CResult_RecoverableSignatureNoneZPtr,
3388 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3389 pub result_ok: bool,
3392 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
3393 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
3394 CResult_RecoverableSignatureNoneZ {
3395 contents: CResult_RecoverableSignatureNoneZPtr {
3396 result: Box::into_raw(Box::new(o)),
3402 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
3403 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
3404 CResult_RecoverableSignatureNoneZ {
3405 contents: CResult_RecoverableSignatureNoneZPtr {
3406 err: std::ptr::null_mut(),
3412 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
3413 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
3414 impl Drop for CResult_RecoverableSignatureNoneZ {
3415 fn drop(&mut self) {
3417 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3418 let _ = unsafe { Box::from_raw(self.contents.result) };
3424 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
3425 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
3426 let contents = if o.result_ok {
3427 let result = unsafe { o.contents.result };
3428 unsafe { o.contents.result = std::ptr::null_mut() };
3429 CResult_RecoverableSignatureNoneZPtr { result }
3431 let _ = unsafe { Box::from_raw(o.contents.err) };
3432 o.contents.err = std::ptr::null_mut();
3433 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
3437 result_ok: o.result_ok,
3441 impl Clone for CResult_RecoverableSignatureNoneZ {
3442 fn clone(&self) -> Self {
3444 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
3445 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
3448 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
3449 err: std::ptr::null_mut()
3455 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
3456 /// but with all dynamically-allocated buffers duplicated in new buffers.
3457 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { orig.clone() }
3459 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3460 /// This corresponds to std::vector in C++
3461 pub struct CVec_CVec_u8ZZ {
3462 /// The elements in the array.
3463 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3464 pub data: *mut crate::c_types::derived::CVec_u8Z,
3465 /// The number of elements pointed to by `data`.
3468 impl CVec_CVec_u8ZZ {
3469 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3470 if self.datalen == 0 { return Vec::new(); }
3471 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3472 self.data = std::ptr::null_mut();
3476 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3477 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3480 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3481 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3482 let datalen = v.len();
3483 let data = Box::into_raw(v.into_boxed_slice());
3484 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3488 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3489 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3490 impl Drop for CVec_CVec_u8ZZ {
3491 fn drop(&mut self) {
3492 if self.datalen == 0 { return; }
3493 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3496 impl Clone for CVec_CVec_u8ZZ {
3497 fn clone(&self) -> Self {
3498 let mut res = Vec::new();
3499 if self.datalen == 0 { return Self::from(res); }
3500 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3505 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3506 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3507 /// A pointer to the contents in the success state.
3508 /// Reading from this pointer when `result_ok` is not set is undefined.
3509 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3510 /// Note that this value is always NULL, as there are no contents in the Err variant
3511 pub err: *mut std::ffi::c_void,
3514 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3515 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3517 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3518 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3519 /// `err` or `result` depending on the state of `result_ok`.
3520 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3521 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3522 pub result_ok: bool,
3525 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3526 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3527 CResult_CVec_CVec_u8ZZNoneZ {
3528 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3529 result: Box::into_raw(Box::new(o)),
3535 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3536 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3537 CResult_CVec_CVec_u8ZZNoneZ {
3538 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3539 err: std::ptr::null_mut(),
3545 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3546 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3547 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3548 fn drop(&mut self) {
3550 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3551 let _ = unsafe { Box::from_raw(self.contents.result) };
3557 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3558 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3559 let contents = if o.result_ok {
3560 let result = unsafe { o.contents.result };
3561 unsafe { o.contents.result = std::ptr::null_mut() };
3562 CResult_CVec_CVec_u8ZZNoneZPtr { result }
3564 let _ = unsafe { Box::from_raw(o.contents.err) };
3565 o.contents.err = std::ptr::null_mut();
3566 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
3570 result_ok: o.result_ok,
3574 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3575 fn clone(&self) -> Self {
3577 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3578 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3581 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3582 err: std::ptr::null_mut()
3588 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3589 /// but with all dynamically-allocated buffers duplicated in new buffers.
3590 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
3592 /// The contents of CResult_InMemorySignerDecodeErrorZ
3593 pub union CResult_InMemorySignerDecodeErrorZPtr {
3594 /// A pointer to the contents in the success state.
3595 /// Reading from this pointer when `result_ok` is not set is undefined.
3596 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
3597 /// A pointer to the contents in the error state.
3598 /// Reading from this pointer when `result_ok` is set is undefined.
3599 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3602 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3603 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3605 pub struct CResult_InMemorySignerDecodeErrorZ {
3606 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3607 /// `err` or `result` depending on the state of `result_ok`.
3608 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3609 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3610 pub result_ok: bool,
3613 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3614 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3615 CResult_InMemorySignerDecodeErrorZ {
3616 contents: CResult_InMemorySignerDecodeErrorZPtr {
3617 result: Box::into_raw(Box::new(o)),
3623 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3624 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3625 CResult_InMemorySignerDecodeErrorZ {
3626 contents: CResult_InMemorySignerDecodeErrorZPtr {
3627 err: Box::into_raw(Box::new(e)),
3633 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3634 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3635 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3636 fn drop(&mut self) {
3638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3639 let _ = unsafe { Box::from_raw(self.contents.result) };
3642 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3643 let _ = unsafe { Box::from_raw(self.contents.err) };
3648 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3649 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3650 let contents = if o.result_ok {
3651 let result = unsafe { o.contents.result };
3652 unsafe { o.contents.result = std::ptr::null_mut() };
3653 CResult_InMemorySignerDecodeErrorZPtr { result }
3655 let err = unsafe { o.contents.err };
3656 unsafe { o.contents.err = std::ptr::null_mut(); }
3657 CResult_InMemorySignerDecodeErrorZPtr { err }
3661 result_ok: o.result_ok,
3665 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3666 fn clone(&self) -> Self {
3668 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3669 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3672 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3673 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3679 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3680 /// but with all dynamically-allocated buffers duplicated in new buffers.
3681 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
3683 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3684 /// This corresponds to std::vector in C++
3685 pub struct CVec_TxOutZ {
3686 /// The elements in the array.
3687 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3688 pub data: *mut crate::c_types::TxOut,
3689 /// The number of elements pointed to by `data`.
3693 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
3694 if self.datalen == 0 { return Vec::new(); }
3695 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3696 self.data = std::ptr::null_mut();
3700 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
3701 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3704 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
3705 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
3706 let datalen = v.len();
3707 let data = Box::into_raw(v.into_boxed_slice());
3708 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3712 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3713 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
3714 impl Drop for CVec_TxOutZ {
3715 fn drop(&mut self) {
3716 if self.datalen == 0 { return; }
3717 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3720 impl Clone for CVec_TxOutZ {
3721 fn clone(&self) -> Self {
3722 let mut res = Vec::new();
3723 if self.datalen == 0 { return Self::from(res); }
3724 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3729 /// The contents of CResult_TransactionNoneZ
3730 pub union CResult_TransactionNoneZPtr {
3731 /// A pointer to the contents in the success state.
3732 /// Reading from this pointer when `result_ok` is not set is undefined.
3733 pub result: *mut crate::c_types::Transaction,
3734 /// Note that this value is always NULL, as there are no contents in the Err variant
3735 pub err: *mut std::ffi::c_void,
3738 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3739 /// containing a crate::c_types::Transaction on success and a () on failure.
3740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3741 pub struct CResult_TransactionNoneZ {
3742 /// The contents of this CResult_TransactionNoneZ, accessible via either
3743 /// `err` or `result` depending on the state of `result_ok`.
3744 pub contents: CResult_TransactionNoneZPtr,
3745 /// Whether this CResult_TransactionNoneZ represents a success state.
3746 pub result_ok: bool,
3749 /// Creates a new CResult_TransactionNoneZ in the success state.
3750 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3751 CResult_TransactionNoneZ {
3752 contents: CResult_TransactionNoneZPtr {
3753 result: Box::into_raw(Box::new(o)),
3759 /// Creates a new CResult_TransactionNoneZ in the error state.
3760 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3761 CResult_TransactionNoneZ {
3762 contents: CResult_TransactionNoneZPtr {
3763 err: std::ptr::null_mut(),
3769 /// Frees any resources used by the CResult_TransactionNoneZ.
3770 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3771 impl Drop for CResult_TransactionNoneZ {
3772 fn drop(&mut self) {
3774 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3775 let _ = unsafe { Box::from_raw(self.contents.result) };
3781 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3782 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3783 let contents = if o.result_ok {
3784 let result = unsafe { o.contents.result };
3785 unsafe { o.contents.result = std::ptr::null_mut() };
3786 CResult_TransactionNoneZPtr { result }
3788 let _ = unsafe { Box::from_raw(o.contents.err) };
3789 o.contents.err = std::ptr::null_mut();
3790 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
3794 result_ok: o.result_ok,
3798 impl Clone for CResult_TransactionNoneZ {
3799 fn clone(&self) -> Self {
3801 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3802 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3805 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3806 err: std::ptr::null_mut()
3812 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3813 /// but with all dynamically-allocated buffers duplicated in new buffers.
3814 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { orig.clone() }
3816 /// A tuple of 2 elements. See the individual fields for the types contained.
3817 pub struct C2Tuple_BlockHashChannelMonitorZ {
3818 /// The element at position 0
3819 pub a: crate::c_types::ThirtyTwoBytes,
3820 /// The element at position 1
3821 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3823 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3824 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3831 impl C2Tuple_BlockHashChannelMonitorZ {
3832 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3836 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3838 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3839 C2Tuple_BlockHashChannelMonitorZ { a, b, }
3843 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3844 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3846 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3847 /// This corresponds to std::vector in C++
3848 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
3849 /// The elements in the array.
3850 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3851 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3852 /// The number of elements pointed to by `data`.
3855 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
3856 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
3857 if self.datalen == 0 { return Vec::new(); }
3858 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3859 self.data = std::ptr::null_mut();
3863 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
3864 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3867 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3868 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
3869 let datalen = v.len();
3870 let data = Box::into_raw(v.into_boxed_slice());
3871 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3875 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3876 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
3877 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3878 fn drop(&mut self) {
3879 if self.datalen == 0 { return; }
3880 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3884 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3885 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3886 /// A pointer to the contents in the success state.
3887 /// Reading from this pointer when `result_ok` is not set is undefined.
3888 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
3889 /// A pointer to the contents in the error state.
3890 /// Reading from this pointer when `result_ok` is set is undefined.
3891 pub err: *mut crate::c_types::IOError,
3894 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3895 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3897 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3898 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3899 /// `err` or `result` depending on the state of `result_ok`.
3900 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
3901 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3902 pub result_ok: bool,
3905 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
3906 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3907 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3908 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3909 result: Box::into_raw(Box::new(o)),
3915 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
3916 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3917 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3918 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3919 err: Box::into_raw(Box::new(e)),
3925 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
3926 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
3927 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3928 fn drop(&mut self) {
3930 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3931 let _ = unsafe { Box::from_raw(self.contents.result) };
3934 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3935 let _ = unsafe { Box::from_raw(self.contents.err) };
3940 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3941 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
3942 let contents = if o.result_ok {
3943 let result = unsafe { o.contents.result };
3944 unsafe { o.contents.result = std::ptr::null_mut() };
3945 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
3947 let err = unsafe { o.contents.err };
3948 unsafe { o.contents.err = std::ptr::null_mut(); }
3949 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
3953 result_ok: o.result_ok,
3959 /// An enum which can either contain a u16 or not
3960 pub enum COption_u16Z {
3961 /// When we're in this state, this COption_u16Z contains a u16
3963 /// When we're in this state, this COption_u16Z contains nothing
3967 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3968 if let Self::Some(_) = self { true } else { false }
3970 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
3971 if let Self::Some(v) = self { v } else { unreachable!() }
3975 /// Constructs a new COption_u16Z containing a u16
3976 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
3977 COption_u16Z::Some(o)
3980 /// Constructs a new COption_u16Z containing nothing
3981 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
3985 /// Frees any resources associated with the u16, if we are in the Some state
3986 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
3988 /// Creates a new COption_u16Z which has the same data as `orig`
3989 /// but with all dynamically-allocated buffers duplicated in new buffers.
3990 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { orig.clone() }
3992 /// The contents of CResult_NoneAPIErrorZ
3993 pub union CResult_NoneAPIErrorZPtr {
3994 /// Note that this value is always NULL, as there are no contents in the OK variant
3995 pub result: *mut std::ffi::c_void,
3996 /// A pointer to the contents in the error state.
3997 /// Reading from this pointer when `result_ok` is set is undefined.
3998 pub err: *mut crate::lightning::util::errors::APIError,
4001 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4002 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4004 pub struct CResult_NoneAPIErrorZ {
4005 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4006 /// `err` or `result` depending on the state of `result_ok`.
4007 pub contents: CResult_NoneAPIErrorZPtr,
4008 /// Whether this CResult_NoneAPIErrorZ represents a success state.
4009 pub result_ok: bool,
4012 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4013 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4014 CResult_NoneAPIErrorZ {
4015 contents: CResult_NoneAPIErrorZPtr {
4016 result: std::ptr::null_mut(),
4022 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4023 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4024 CResult_NoneAPIErrorZ {
4025 contents: CResult_NoneAPIErrorZPtr {
4026 err: Box::into_raw(Box::new(e)),
4032 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4033 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4034 impl Drop for CResult_NoneAPIErrorZ {
4035 fn drop(&mut self) {
4038 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4039 let _ = unsafe { Box::from_raw(self.contents.err) };
4044 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4045 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4046 let contents = if o.result_ok {
4047 let _ = unsafe { Box::from_raw(o.contents.result) };
4048 o.contents.result = std::ptr::null_mut();
4049 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4051 let err = unsafe { o.contents.err };
4052 unsafe { o.contents.err = std::ptr::null_mut(); }
4053 CResult_NoneAPIErrorZPtr { err }
4057 result_ok: o.result_ok,
4061 impl Clone for CResult_NoneAPIErrorZ {
4062 fn clone(&self) -> Self {
4064 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4065 result: std::ptr::null_mut()
4068 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4069 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4075 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4076 /// but with all dynamically-allocated buffers duplicated in new buffers.
4077 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
4079 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4080 /// This corresponds to std::vector in C++
4081 pub struct CVec_CResult_NoneAPIErrorZZ {
4082 /// The elements in the array.
4083 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4084 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4085 /// The number of elements pointed to by `data`.
4088 impl CVec_CResult_NoneAPIErrorZZ {
4089 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4090 if self.datalen == 0 { return Vec::new(); }
4091 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4092 self.data = std::ptr::null_mut();
4096 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4097 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4100 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4101 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4102 let datalen = v.len();
4103 let data = Box::into_raw(v.into_boxed_slice());
4104 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4108 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4109 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4110 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4111 fn drop(&mut self) {
4112 if self.datalen == 0 { return; }
4113 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4116 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4117 fn clone(&self) -> Self {
4118 let mut res = Vec::new();
4119 if self.datalen == 0 { return Self::from(res); }
4120 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4125 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4126 /// This corresponds to std::vector in C++
4127 pub struct CVec_APIErrorZ {
4128 /// The elements in the array.
4129 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4130 pub data: *mut crate::lightning::util::errors::APIError,
4131 /// The number of elements pointed to by `data`.
4134 impl CVec_APIErrorZ {
4135 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4136 if self.datalen == 0 { return Vec::new(); }
4137 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4138 self.data = std::ptr::null_mut();
4142 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4143 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4146 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4147 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4148 let datalen = v.len();
4149 let data = Box::into_raw(v.into_boxed_slice());
4150 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4154 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4155 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4156 impl Drop for CVec_APIErrorZ {
4157 fn drop(&mut self) {
4158 if self.datalen == 0 { return; }
4159 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4162 impl Clone for CVec_APIErrorZ {
4163 fn clone(&self) -> Self {
4164 let mut res = Vec::new();
4165 if self.datalen == 0 { return Self::from(res); }
4166 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4171 /// The contents of CResult_NonePaymentSendFailureZ
4172 pub union CResult_NonePaymentSendFailureZPtr {
4173 /// Note that this value is always NULL, as there are no contents in the OK variant
4174 pub result: *mut std::ffi::c_void,
4175 /// A pointer to the contents in the error state.
4176 /// Reading from this pointer when `result_ok` is set is undefined.
4177 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4180 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4181 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4183 pub struct CResult_NonePaymentSendFailureZ {
4184 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4185 /// `err` or `result` depending on the state of `result_ok`.
4186 pub contents: CResult_NonePaymentSendFailureZPtr,
4187 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4188 pub result_ok: bool,
4191 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4192 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4193 CResult_NonePaymentSendFailureZ {
4194 contents: CResult_NonePaymentSendFailureZPtr {
4195 result: std::ptr::null_mut(),
4201 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4202 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4203 CResult_NonePaymentSendFailureZ {
4204 contents: CResult_NonePaymentSendFailureZPtr {
4205 err: Box::into_raw(Box::new(e)),
4211 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4212 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4213 impl Drop for CResult_NonePaymentSendFailureZ {
4214 fn drop(&mut self) {
4217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4218 let _ = unsafe { Box::from_raw(self.contents.err) };
4223 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4224 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4225 let contents = if o.result_ok {
4226 let _ = unsafe { Box::from_raw(o.contents.result) };
4227 o.contents.result = std::ptr::null_mut();
4228 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4230 let err = unsafe { o.contents.err };
4231 unsafe { o.contents.err = std::ptr::null_mut(); }
4232 CResult_NonePaymentSendFailureZPtr { err }
4236 result_ok: o.result_ok,
4240 impl Clone for CResult_NonePaymentSendFailureZ {
4241 fn clone(&self) -> Self {
4243 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4244 result: std::ptr::null_mut()
4247 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4248 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4254 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4255 /// but with all dynamically-allocated buffers duplicated in new buffers.
4256 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4258 /// The contents of CResult_PaymentHashPaymentSendFailureZ
4259 pub union CResult_PaymentHashPaymentSendFailureZPtr {
4260 /// A pointer to the contents in the success state.
4261 /// Reading from this pointer when `result_ok` is not set is undefined.
4262 pub result: *mut crate::c_types::ThirtyTwoBytes,
4263 /// A pointer to the contents in the error state.
4264 /// Reading from this pointer when `result_ok` is set is undefined.
4265 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4268 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
4269 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4271 pub struct CResult_PaymentHashPaymentSendFailureZ {
4272 /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
4273 /// `err` or `result` depending on the state of `result_ok`.
4274 pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
4275 /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
4276 pub result_ok: bool,
4279 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
4280 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
4281 CResult_PaymentHashPaymentSendFailureZ {
4282 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4283 result: Box::into_raw(Box::new(o)),
4289 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
4290 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
4291 CResult_PaymentHashPaymentSendFailureZ {
4292 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4293 err: Box::into_raw(Box::new(e)),
4299 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
4300 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
4301 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
4302 fn drop(&mut self) {
4304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4305 let _ = unsafe { Box::from_raw(self.contents.result) };
4308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4309 let _ = unsafe { Box::from_raw(self.contents.err) };
4314 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
4315 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4316 let contents = if o.result_ok {
4317 let result = unsafe { o.contents.result };
4318 unsafe { o.contents.result = std::ptr::null_mut() };
4319 CResult_PaymentHashPaymentSendFailureZPtr { result }
4321 let err = unsafe { o.contents.err };
4322 unsafe { o.contents.err = std::ptr::null_mut(); }
4323 CResult_PaymentHashPaymentSendFailureZPtr { err }
4327 result_ok: o.result_ok,
4331 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
4332 fn clone(&self) -> Self {
4334 Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4335 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4338 Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4339 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4345 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
4346 /// but with all dynamically-allocated buffers duplicated in new buffers.
4347 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { orig.clone() }
4349 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4350 /// This corresponds to std::vector in C++
4351 pub struct CVec_NetAddressZ {
4352 /// The elements in the array.
4353 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4354 pub data: *mut crate::lightning::ln::msgs::NetAddress,
4355 /// The number of elements pointed to by `data`.
4358 impl CVec_NetAddressZ {
4359 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4360 if self.datalen == 0 { return Vec::new(); }
4361 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4362 self.data = std::ptr::null_mut();
4366 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4367 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4370 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4371 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4372 let datalen = v.len();
4373 let data = Box::into_raw(v.into_boxed_slice());
4374 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4378 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4379 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4380 impl Drop for CVec_NetAddressZ {
4381 fn drop(&mut self) {
4382 if self.datalen == 0 { return; }
4383 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4386 impl Clone for CVec_NetAddressZ {
4387 fn clone(&self) -> Self {
4388 let mut res = Vec::new();
4389 if self.datalen == 0 { return Self::from(res); }
4390 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4395 /// A tuple of 2 elements. See the individual fields for the types contained.
4396 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4397 /// The element at position 0
4398 pub a: crate::c_types::ThirtyTwoBytes,
4399 /// The element at position 1
4400 pub b: crate::c_types::ThirtyTwoBytes,
4402 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4403 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4410 impl C2Tuple_PaymentHashPaymentSecretZ {
4411 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4415 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4416 fn clone(&self) -> Self {
4424 /// Creates a new tuple which has the same data as `orig`
4425 /// but with all dynamically-allocated buffers duplicated in new buffers.
4426 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { orig.clone() }
4427 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4429 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4430 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4434 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4435 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4437 /// The contents of CResult_PaymentSecretAPIErrorZ
4438 pub union CResult_PaymentSecretAPIErrorZPtr {
4439 /// A pointer to the contents in the success state.
4440 /// Reading from this pointer when `result_ok` is not set is undefined.
4441 pub result: *mut crate::c_types::ThirtyTwoBytes,
4442 /// A pointer to the contents in the error state.
4443 /// Reading from this pointer when `result_ok` is set is undefined.
4444 pub err: *mut crate::lightning::util::errors::APIError,
4447 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4448 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4450 pub struct CResult_PaymentSecretAPIErrorZ {
4451 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4452 /// `err` or `result` depending on the state of `result_ok`.
4453 pub contents: CResult_PaymentSecretAPIErrorZPtr,
4454 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4455 pub result_ok: bool,
4458 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4459 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4460 CResult_PaymentSecretAPIErrorZ {
4461 contents: CResult_PaymentSecretAPIErrorZPtr {
4462 result: Box::into_raw(Box::new(o)),
4468 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4469 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4470 CResult_PaymentSecretAPIErrorZ {
4471 contents: CResult_PaymentSecretAPIErrorZPtr {
4472 err: Box::into_raw(Box::new(e)),
4478 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4479 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4480 impl Drop for CResult_PaymentSecretAPIErrorZ {
4481 fn drop(&mut self) {
4483 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4484 let _ = unsafe { Box::from_raw(self.contents.result) };
4487 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4488 let _ = unsafe { Box::from_raw(self.contents.err) };
4493 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4494 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4495 let contents = if o.result_ok {
4496 let result = unsafe { o.contents.result };
4497 unsafe { o.contents.result = std::ptr::null_mut() };
4498 CResult_PaymentSecretAPIErrorZPtr { result }
4500 let err = unsafe { o.contents.err };
4501 unsafe { o.contents.err = std::ptr::null_mut(); }
4502 CResult_PaymentSecretAPIErrorZPtr { err }
4506 result_ok: o.result_ok,
4510 impl Clone for CResult_PaymentSecretAPIErrorZ {
4511 fn clone(&self) -> Self {
4513 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4514 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4517 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4518 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4524 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4525 /// but with all dynamically-allocated buffers duplicated in new buffers.
4526 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { orig.clone() }
4528 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4529 /// This corresponds to std::vector in C++
4530 pub struct CVec_ChannelMonitorZ {
4531 /// The elements in the array.
4532 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4533 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4534 /// The number of elements pointed to by `data`.
4537 impl CVec_ChannelMonitorZ {
4538 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4539 if self.datalen == 0 { return Vec::new(); }
4540 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4541 self.data = std::ptr::null_mut();
4545 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4546 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4549 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4550 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4551 let datalen = v.len();
4552 let data = Box::into_raw(v.into_boxed_slice());
4553 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4557 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4558 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4559 impl Drop for CVec_ChannelMonitorZ {
4560 fn drop(&mut self) {
4561 if self.datalen == 0 { return; }
4562 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4566 /// A tuple of 2 elements. See the individual fields for the types contained.
4567 pub struct C2Tuple_BlockHashChannelManagerZ {
4568 /// The element at position 0
4569 pub a: crate::c_types::ThirtyTwoBytes,
4570 /// The element at position 1
4571 pub b: crate::lightning::ln::channelmanager::ChannelManager,
4573 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4574 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4581 impl C2Tuple_BlockHashChannelManagerZ {
4582 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4586 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4588 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4589 C2Tuple_BlockHashChannelManagerZ { a, b, }
4593 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4594 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4596 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4597 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
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::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
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_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4607 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ 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_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4610 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4611 /// `err` or `result` depending on the state of `result_ok`.
4612 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4613 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4614 pub result_ok: bool,
4617 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4618 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4619 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4620 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4621 result: Box::into_raw(Box::new(o)),
4627 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4628 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4629 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4630 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4631 err: Box::into_raw(Box::new(e)),
4637 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4638 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4639 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
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::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4653 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, 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_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4659 let err = unsafe { o.contents.err };
4660 unsafe { o.contents.err = std::ptr::null_mut(); }
4661 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4665 result_ok: o.result_ok,
4670 /// The contents of CResult_ChannelConfigDecodeErrorZ
4671 pub union CResult_ChannelConfigDecodeErrorZPtr {
4672 /// A pointer to the contents in the success state.
4673 /// Reading from this pointer when `result_ok` is not set is undefined.
4674 pub result: *mut crate::lightning::util::config::ChannelConfig,
4675 /// A pointer to the contents in the error state.
4676 /// Reading from this pointer when `result_ok` is set is undefined.
4677 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4680 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4681 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4683 pub struct CResult_ChannelConfigDecodeErrorZ {
4684 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4685 /// `err` or `result` depending on the state of `result_ok`.
4686 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4687 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4688 pub result_ok: bool,
4691 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4692 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4693 CResult_ChannelConfigDecodeErrorZ {
4694 contents: CResult_ChannelConfigDecodeErrorZPtr {
4695 result: Box::into_raw(Box::new(o)),
4701 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4702 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4703 CResult_ChannelConfigDecodeErrorZ {
4704 contents: CResult_ChannelConfigDecodeErrorZPtr {
4705 err: Box::into_raw(Box::new(e)),
4711 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4712 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4713 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4714 fn drop(&mut self) {
4716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4717 let _ = unsafe { Box::from_raw(self.contents.result) };
4720 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4721 let _ = unsafe { Box::from_raw(self.contents.err) };
4726 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4727 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4728 let contents = if o.result_ok {
4729 let result = unsafe { o.contents.result };
4730 unsafe { o.contents.result = std::ptr::null_mut() };
4731 CResult_ChannelConfigDecodeErrorZPtr { result }
4733 let err = unsafe { o.contents.err };
4734 unsafe { o.contents.err = std::ptr::null_mut(); }
4735 CResult_ChannelConfigDecodeErrorZPtr { err }
4739 result_ok: o.result_ok,
4743 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4744 fn clone(&self) -> Self {
4746 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4747 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4750 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4751 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4757 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4758 /// but with all dynamically-allocated buffers duplicated in new buffers.
4759 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
4761 /// The contents of CResult_OutPointDecodeErrorZ
4762 pub union CResult_OutPointDecodeErrorZPtr {
4763 /// A pointer to the contents in the success state.
4764 /// Reading from this pointer when `result_ok` is not set is undefined.
4765 pub result: *mut crate::lightning::chain::transaction::OutPoint,
4766 /// A pointer to the contents in the error state.
4767 /// Reading from this pointer when `result_ok` is set is undefined.
4768 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4771 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4772 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4774 pub struct CResult_OutPointDecodeErrorZ {
4775 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4776 /// `err` or `result` depending on the state of `result_ok`.
4777 pub contents: CResult_OutPointDecodeErrorZPtr,
4778 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4779 pub result_ok: bool,
4782 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4783 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4784 CResult_OutPointDecodeErrorZ {
4785 contents: CResult_OutPointDecodeErrorZPtr {
4786 result: Box::into_raw(Box::new(o)),
4792 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4793 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4794 CResult_OutPointDecodeErrorZ {
4795 contents: CResult_OutPointDecodeErrorZPtr {
4796 err: Box::into_raw(Box::new(e)),
4802 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
4803 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
4804 impl Drop for CResult_OutPointDecodeErrorZ {
4805 fn drop(&mut self) {
4807 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4808 let _ = unsafe { Box::from_raw(self.contents.result) };
4811 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4812 let _ = unsafe { Box::from_raw(self.contents.err) };
4817 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
4818 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4819 let contents = if o.result_ok {
4820 let result = unsafe { o.contents.result };
4821 unsafe { o.contents.result = std::ptr::null_mut() };
4822 CResult_OutPointDecodeErrorZPtr { result }
4824 let err = unsafe { o.contents.err };
4825 unsafe { o.contents.err = std::ptr::null_mut(); }
4826 CResult_OutPointDecodeErrorZPtr { err }
4830 result_ok: o.result_ok,
4834 impl Clone for CResult_OutPointDecodeErrorZ {
4835 fn clone(&self) -> Self {
4837 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
4838 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
4841 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
4842 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4848 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
4849 /// but with all dynamically-allocated buffers duplicated in new buffers.
4850 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
4852 /// The contents of CResult_SiPrefixNoneZ
4853 pub union CResult_SiPrefixNoneZPtr {
4854 /// A pointer to the contents in the success state.
4855 /// Reading from this pointer when `result_ok` is not set is undefined.
4856 pub result: *mut crate::lightning_invoice::SiPrefix,
4857 /// Note that this value is always NULL, as there are no contents in the Err variant
4858 pub err: *mut std::ffi::c_void,
4861 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4862 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4864 pub struct CResult_SiPrefixNoneZ {
4865 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
4866 /// `err` or `result` depending on the state of `result_ok`.
4867 pub contents: CResult_SiPrefixNoneZPtr,
4868 /// Whether this CResult_SiPrefixNoneZ represents a success state.
4869 pub result_ok: bool,
4872 /// Creates a new CResult_SiPrefixNoneZ in the success state.
4873 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
4874 CResult_SiPrefixNoneZ {
4875 contents: CResult_SiPrefixNoneZPtr {
4876 result: Box::into_raw(Box::new(o)),
4882 /// Creates a new CResult_SiPrefixNoneZ in the error state.
4883 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
4884 CResult_SiPrefixNoneZ {
4885 contents: CResult_SiPrefixNoneZPtr {
4886 err: std::ptr::null_mut(),
4892 /// Frees any resources used by the CResult_SiPrefixNoneZ.
4893 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
4894 impl Drop for CResult_SiPrefixNoneZ {
4895 fn drop(&mut self) {
4897 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4898 let _ = unsafe { Box::from_raw(self.contents.result) };
4904 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
4905 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
4906 let contents = if o.result_ok {
4907 let result = unsafe { o.contents.result };
4908 unsafe { o.contents.result = std::ptr::null_mut() };
4909 CResult_SiPrefixNoneZPtr { result }
4911 let _ = unsafe { Box::from_raw(o.contents.err) };
4912 o.contents.err = std::ptr::null_mut();
4913 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
4917 result_ok: o.result_ok,
4921 impl Clone for CResult_SiPrefixNoneZ {
4922 fn clone(&self) -> Self {
4924 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
4925 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
4928 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
4929 err: std::ptr::null_mut()
4935 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
4936 /// but with all dynamically-allocated buffers duplicated in new buffers.
4937 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
4939 /// The contents of CResult_InvoiceNoneZ
4940 pub union CResult_InvoiceNoneZPtr {
4941 /// A pointer to the contents in the success state.
4942 /// Reading from this pointer when `result_ok` is not set is undefined.
4943 pub result: *mut crate::lightning_invoice::Invoice,
4944 /// Note that this value is always NULL, as there are no contents in the Err variant
4945 pub err: *mut std::ffi::c_void,
4948 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
4949 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
4950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4951 pub struct CResult_InvoiceNoneZ {
4952 /// The contents of this CResult_InvoiceNoneZ, accessible via either
4953 /// `err` or `result` depending on the state of `result_ok`.
4954 pub contents: CResult_InvoiceNoneZPtr,
4955 /// Whether this CResult_InvoiceNoneZ represents a success state.
4956 pub result_ok: bool,
4959 /// Creates a new CResult_InvoiceNoneZ in the success state.
4960 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
4961 CResult_InvoiceNoneZ {
4962 contents: CResult_InvoiceNoneZPtr {
4963 result: Box::into_raw(Box::new(o)),
4969 /// Creates a new CResult_InvoiceNoneZ in the error state.
4970 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
4971 CResult_InvoiceNoneZ {
4972 contents: CResult_InvoiceNoneZPtr {
4973 err: std::ptr::null_mut(),
4979 /// Frees any resources used by the CResult_InvoiceNoneZ.
4980 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
4981 impl Drop for CResult_InvoiceNoneZ {
4982 fn drop(&mut self) {
4984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4985 let _ = unsafe { Box::from_raw(self.contents.result) };
4991 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
4992 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
4993 let contents = if o.result_ok {
4994 let result = unsafe { o.contents.result };
4995 unsafe { o.contents.result = std::ptr::null_mut() };
4996 CResult_InvoiceNoneZPtr { result }
4998 let _ = unsafe { Box::from_raw(o.contents.err) };
4999 o.contents.err = std::ptr::null_mut();
5000 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
5004 result_ok: o.result_ok,
5008 impl Clone for CResult_InvoiceNoneZ {
5009 fn clone(&self) -> Self {
5011 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
5012 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5015 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
5016 err: std::ptr::null_mut()
5022 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
5023 /// but with all dynamically-allocated buffers duplicated in new buffers.
5024 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
5026 /// The contents of CResult_SignedRawInvoiceNoneZ
5027 pub union CResult_SignedRawInvoiceNoneZPtr {
5028 /// A pointer to the contents in the success state.
5029 /// Reading from this pointer when `result_ok` is not set is undefined.
5030 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
5031 /// Note that this value is always NULL, as there are no contents in the Err variant
5032 pub err: *mut std::ffi::c_void,
5035 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5036 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5038 pub struct CResult_SignedRawInvoiceNoneZ {
5039 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5040 /// `err` or `result` depending on the state of `result_ok`.
5041 pub contents: CResult_SignedRawInvoiceNoneZPtr,
5042 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5043 pub result_ok: bool,
5046 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
5047 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
5048 CResult_SignedRawInvoiceNoneZ {
5049 contents: CResult_SignedRawInvoiceNoneZPtr {
5050 result: Box::into_raw(Box::new(o)),
5056 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
5057 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
5058 CResult_SignedRawInvoiceNoneZ {
5059 contents: CResult_SignedRawInvoiceNoneZPtr {
5060 err: std::ptr::null_mut(),
5066 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
5067 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
5068 impl Drop for CResult_SignedRawInvoiceNoneZ {
5069 fn drop(&mut self) {
5071 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5072 let _ = unsafe { Box::from_raw(self.contents.result) };
5078 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
5079 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
5080 let contents = if o.result_ok {
5081 let result = unsafe { o.contents.result };
5082 unsafe { o.contents.result = std::ptr::null_mut() };
5083 CResult_SignedRawInvoiceNoneZPtr { result }
5085 let _ = unsafe { Box::from_raw(o.contents.err) };
5086 o.contents.err = std::ptr::null_mut();
5087 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
5091 result_ok: o.result_ok,
5095 impl Clone for CResult_SignedRawInvoiceNoneZ {
5096 fn clone(&self) -> Self {
5098 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
5099 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
5102 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
5103 err: std::ptr::null_mut()
5109 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
5110 /// but with all dynamically-allocated buffers duplicated in new buffers.
5111 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
5113 /// A tuple of 3 elements. See the individual fields for the types contained.
5114 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5115 /// The element at position 0
5116 pub a: crate::lightning_invoice::RawInvoice,
5117 /// The element at position 1
5118 pub b: crate::c_types::ThirtyTwoBytes,
5119 /// The element at position 2
5120 pub c: crate::lightning_invoice::InvoiceSignature,
5122 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5123 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
5131 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5132 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
5133 (self.a, self.b, self.c)
5136 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5137 fn clone(&self) -> Self {
5146 /// Creates a new tuple which has the same data as `orig`
5147 /// but with all dynamically-allocated buffers duplicated in new buffers.
5148 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { orig.clone() }
5149 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
5151 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 {
5152 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
5156 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
5157 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
5159 /// The contents of CResult_PayeePubKeyErrorZ
5160 pub union CResult_PayeePubKeyErrorZPtr {
5161 /// A pointer to the contents in the success state.
5162 /// Reading from this pointer when `result_ok` is not set is undefined.
5163 pub result: *mut crate::lightning_invoice::PayeePubKey,
5164 /// A pointer to the contents in the error state.
5165 /// Reading from this pointer when `result_ok` is set is undefined.
5166 pub err: *mut crate::c_types::Secp256k1Error,
5169 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5170 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_PayeePubKeyErrorZ {
5173 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5174 /// `err` or `result` depending on the state of `result_ok`.
5175 pub contents: CResult_PayeePubKeyErrorZPtr,
5176 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
5177 pub result_ok: bool,
5180 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
5181 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
5182 CResult_PayeePubKeyErrorZ {
5183 contents: CResult_PayeePubKeyErrorZPtr {
5184 result: Box::into_raw(Box::new(o)),
5190 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
5191 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
5192 CResult_PayeePubKeyErrorZ {
5193 contents: CResult_PayeePubKeyErrorZPtr {
5194 err: Box::into_raw(Box::new(e)),
5200 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
5201 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
5202 impl Drop for CResult_PayeePubKeyErrorZ {
5203 fn drop(&mut self) {
5205 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5206 let _ = unsafe { Box::from_raw(self.contents.result) };
5209 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5210 let _ = unsafe { Box::from_raw(self.contents.err) };
5215 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
5216 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
5217 let contents = if o.result_ok {
5218 let result = unsafe { o.contents.result };
5219 unsafe { o.contents.result = std::ptr::null_mut() };
5220 CResult_PayeePubKeyErrorZPtr { result }
5222 let err = unsafe { o.contents.err };
5223 unsafe { o.contents.err = std::ptr::null_mut(); }
5224 CResult_PayeePubKeyErrorZPtr { err }
5228 result_ok: o.result_ok,
5232 impl Clone for CResult_PayeePubKeyErrorZ {
5233 fn clone(&self) -> Self {
5235 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
5236 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
5239 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
5240 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5246 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
5247 /// but with all dynamically-allocated buffers duplicated in new buffers.
5248 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { orig.clone() }
5250 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5251 /// This corresponds to std::vector in C++
5252 pub struct CVec_PrivateRouteZ {
5253 /// The elements in the array.
5254 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5255 pub data: *mut crate::lightning_invoice::PrivateRoute,
5256 /// The number of elements pointed to by `data`.
5259 impl CVec_PrivateRouteZ {
5260 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5261 if self.datalen == 0 { return Vec::new(); }
5262 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5263 self.data = std::ptr::null_mut();
5267 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5268 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5271 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5272 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5273 let datalen = v.len();
5274 let data = Box::into_raw(v.into_boxed_slice());
5275 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5279 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5280 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5281 impl Drop for CVec_PrivateRouteZ {
5282 fn drop(&mut self) {
5283 if self.datalen == 0 { return; }
5284 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5287 impl Clone for CVec_PrivateRouteZ {
5288 fn clone(&self) -> Self {
5289 let mut res = Vec::new();
5290 if self.datalen == 0 { return Self::from(res); }
5291 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5296 /// The contents of CResult_PositiveTimestampCreationErrorZ
5297 pub union CResult_PositiveTimestampCreationErrorZPtr {
5298 /// A pointer to the contents in the success state.
5299 /// Reading from this pointer when `result_ok` is not set is undefined.
5300 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5301 /// A pointer to the contents in the error state.
5302 /// Reading from this pointer when `result_ok` is set is undefined.
5303 pub err: *mut crate::lightning_invoice::CreationError,
5306 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5307 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5309 pub struct CResult_PositiveTimestampCreationErrorZ {
5310 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5311 /// `err` or `result` depending on the state of `result_ok`.
5312 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5313 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5314 pub result_ok: bool,
5317 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5318 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5319 CResult_PositiveTimestampCreationErrorZ {
5320 contents: CResult_PositiveTimestampCreationErrorZPtr {
5321 result: Box::into_raw(Box::new(o)),
5327 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5328 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5329 CResult_PositiveTimestampCreationErrorZ {
5330 contents: CResult_PositiveTimestampCreationErrorZPtr {
5331 err: Box::into_raw(Box::new(e)),
5337 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5338 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5339 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5340 fn drop(&mut self) {
5342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5343 let _ = unsafe { Box::from_raw(self.contents.result) };
5346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5347 let _ = unsafe { Box::from_raw(self.contents.err) };
5352 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5353 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5354 let contents = if o.result_ok {
5355 let result = unsafe { o.contents.result };
5356 unsafe { o.contents.result = std::ptr::null_mut() };
5357 CResult_PositiveTimestampCreationErrorZPtr { result }
5359 let err = unsafe { o.contents.err };
5360 unsafe { o.contents.err = std::ptr::null_mut(); }
5361 CResult_PositiveTimestampCreationErrorZPtr { err }
5365 result_ok: o.result_ok,
5369 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5370 fn clone(&self) -> Self {
5372 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5373 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5376 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5377 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5383 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5384 /// but with all dynamically-allocated buffers duplicated in new buffers.
5385 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
5387 /// The contents of CResult_NoneSemanticErrorZ
5388 pub union CResult_NoneSemanticErrorZPtr {
5389 /// Note that this value is always NULL, as there are no contents in the OK variant
5390 pub result: *mut std::ffi::c_void,
5391 /// A pointer to the contents in the error state.
5392 /// Reading from this pointer when `result_ok` is set is undefined.
5393 pub err: *mut crate::lightning_invoice::SemanticError,
5396 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5397 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5399 pub struct CResult_NoneSemanticErrorZ {
5400 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5401 /// `err` or `result` depending on the state of `result_ok`.
5402 pub contents: CResult_NoneSemanticErrorZPtr,
5403 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5404 pub result_ok: bool,
5407 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5408 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5409 CResult_NoneSemanticErrorZ {
5410 contents: CResult_NoneSemanticErrorZPtr {
5411 result: std::ptr::null_mut(),
5417 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5418 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5419 CResult_NoneSemanticErrorZ {
5420 contents: CResult_NoneSemanticErrorZPtr {
5421 err: Box::into_raw(Box::new(e)),
5427 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5428 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5429 impl Drop for CResult_NoneSemanticErrorZ {
5430 fn drop(&mut self) {
5433 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5434 let _ = unsafe { Box::from_raw(self.contents.err) };
5439 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5440 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5441 let contents = if o.result_ok {
5442 let _ = unsafe { Box::from_raw(o.contents.result) };
5443 o.contents.result = std::ptr::null_mut();
5444 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5446 let err = unsafe { o.contents.err };
5447 unsafe { o.contents.err = std::ptr::null_mut(); }
5448 CResult_NoneSemanticErrorZPtr { err }
5452 result_ok: o.result_ok,
5456 impl Clone for CResult_NoneSemanticErrorZ {
5457 fn clone(&self) -> Self {
5459 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5460 result: std::ptr::null_mut()
5463 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5464 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5470 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5471 /// but with all dynamically-allocated buffers duplicated in new buffers.
5472 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
5474 /// The contents of CResult_InvoiceSemanticErrorZ
5475 pub union CResult_InvoiceSemanticErrorZPtr {
5476 /// A pointer to the contents in the success state.
5477 /// Reading from this pointer when `result_ok` is not set is undefined.
5478 pub result: *mut crate::lightning_invoice::Invoice,
5479 /// A pointer to the contents in the error state.
5480 /// Reading from this pointer when `result_ok` is set is undefined.
5481 pub err: *mut crate::lightning_invoice::SemanticError,
5484 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5485 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5487 pub struct CResult_InvoiceSemanticErrorZ {
5488 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5489 /// `err` or `result` depending on the state of `result_ok`.
5490 pub contents: CResult_InvoiceSemanticErrorZPtr,
5491 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5492 pub result_ok: bool,
5495 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5496 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5497 CResult_InvoiceSemanticErrorZ {
5498 contents: CResult_InvoiceSemanticErrorZPtr {
5499 result: Box::into_raw(Box::new(o)),
5505 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5506 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5507 CResult_InvoiceSemanticErrorZ {
5508 contents: CResult_InvoiceSemanticErrorZPtr {
5509 err: Box::into_raw(Box::new(e)),
5515 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
5516 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5517 impl Drop for CResult_InvoiceSemanticErrorZ {
5518 fn drop(&mut self) {
5520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5521 let _ = unsafe { Box::from_raw(self.contents.result) };
5524 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5525 let _ = unsafe { Box::from_raw(self.contents.err) };
5530 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5531 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
5532 let contents = if o.result_ok {
5533 let result = unsafe { o.contents.result };
5534 unsafe { o.contents.result = std::ptr::null_mut() };
5535 CResult_InvoiceSemanticErrorZPtr { result }
5537 let err = unsafe { o.contents.err };
5538 unsafe { o.contents.err = std::ptr::null_mut(); }
5539 CResult_InvoiceSemanticErrorZPtr { err }
5543 result_ok: o.result_ok,
5547 impl Clone for CResult_InvoiceSemanticErrorZ {
5548 fn clone(&self) -> Self {
5550 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5551 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5554 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
5555 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5561 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
5562 /// but with all dynamically-allocated buffers duplicated in new buffers.
5563 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
5565 /// The contents of CResult_DescriptionCreationErrorZ
5566 pub union CResult_DescriptionCreationErrorZPtr {
5567 /// A pointer to the contents in the success state.
5568 /// Reading from this pointer when `result_ok` is not set is undefined.
5569 pub result: *mut crate::lightning_invoice::Description,
5570 /// A pointer to the contents in the error state.
5571 /// Reading from this pointer when `result_ok` is set is undefined.
5572 pub err: *mut crate::lightning_invoice::CreationError,
5575 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5576 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5578 pub struct CResult_DescriptionCreationErrorZ {
5579 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5580 /// `err` or `result` depending on the state of `result_ok`.
5581 pub contents: CResult_DescriptionCreationErrorZPtr,
5582 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5583 pub result_ok: bool,
5586 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5587 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5588 CResult_DescriptionCreationErrorZ {
5589 contents: CResult_DescriptionCreationErrorZPtr {
5590 result: Box::into_raw(Box::new(o)),
5596 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5597 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5598 CResult_DescriptionCreationErrorZ {
5599 contents: CResult_DescriptionCreationErrorZPtr {
5600 err: Box::into_raw(Box::new(e)),
5606 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
5607 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5608 impl Drop for CResult_DescriptionCreationErrorZ {
5609 fn drop(&mut self) {
5611 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5612 let _ = unsafe { Box::from_raw(self.contents.result) };
5615 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5616 let _ = unsafe { Box::from_raw(self.contents.err) };
5621 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5622 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
5623 let contents = if o.result_ok {
5624 let result = unsafe { o.contents.result };
5625 unsafe { o.contents.result = std::ptr::null_mut() };
5626 CResult_DescriptionCreationErrorZPtr { result }
5628 let err = unsafe { o.contents.err };
5629 unsafe { o.contents.err = std::ptr::null_mut(); }
5630 CResult_DescriptionCreationErrorZPtr { err }
5634 result_ok: o.result_ok,
5638 impl Clone for CResult_DescriptionCreationErrorZ {
5639 fn clone(&self) -> Self {
5641 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5642 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5645 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5646 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5652 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5653 /// but with all dynamically-allocated buffers duplicated in new buffers.
5654 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
5656 /// The contents of CResult_ExpiryTimeCreationErrorZ
5657 pub union CResult_ExpiryTimeCreationErrorZPtr {
5658 /// A pointer to the contents in the success state.
5659 /// Reading from this pointer when `result_ok` is not set is undefined.
5660 pub result: *mut crate::lightning_invoice::ExpiryTime,
5661 /// A pointer to the contents in the error state.
5662 /// Reading from this pointer when `result_ok` is set is undefined.
5663 pub err: *mut crate::lightning_invoice::CreationError,
5666 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5667 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5669 pub struct CResult_ExpiryTimeCreationErrorZ {
5670 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5671 /// `err` or `result` depending on the state of `result_ok`.
5672 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5673 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5674 pub result_ok: bool,
5677 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5678 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5679 CResult_ExpiryTimeCreationErrorZ {
5680 contents: CResult_ExpiryTimeCreationErrorZPtr {
5681 result: Box::into_raw(Box::new(o)),
5687 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5688 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5689 CResult_ExpiryTimeCreationErrorZ {
5690 contents: CResult_ExpiryTimeCreationErrorZPtr {
5691 err: Box::into_raw(Box::new(e)),
5697 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
5698 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
5699 impl Drop for CResult_ExpiryTimeCreationErrorZ {
5700 fn drop(&mut self) {
5702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5703 let _ = unsafe { Box::from_raw(self.contents.result) };
5706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5707 let _ = unsafe { Box::from_raw(self.contents.err) };
5712 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
5713 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
5714 let contents = if o.result_ok {
5715 let result = unsafe { o.contents.result };
5716 unsafe { o.contents.result = std::ptr::null_mut() };
5717 CResult_ExpiryTimeCreationErrorZPtr { result }
5719 let err = unsafe { o.contents.err };
5720 unsafe { o.contents.err = std::ptr::null_mut(); }
5721 CResult_ExpiryTimeCreationErrorZPtr { err }
5725 result_ok: o.result_ok,
5729 impl Clone for CResult_ExpiryTimeCreationErrorZ {
5730 fn clone(&self) -> Self {
5732 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
5733 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
5736 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
5737 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5743 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
5744 /// but with all dynamically-allocated buffers duplicated in new buffers.
5745 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
5747 /// The contents of CResult_PrivateRouteCreationErrorZ
5748 pub union CResult_PrivateRouteCreationErrorZPtr {
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_invoice::PrivateRoute,
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_invoice::CreationError,
5757 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5758 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5760 pub struct CResult_PrivateRouteCreationErrorZ {
5761 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5762 /// `err` or `result` depending on the state of `result_ok`.
5763 pub contents: CResult_PrivateRouteCreationErrorZPtr,
5764 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5765 pub result_ok: bool,
5768 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
5769 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
5770 CResult_PrivateRouteCreationErrorZ {
5771 contents: CResult_PrivateRouteCreationErrorZPtr {
5772 result: Box::into_raw(Box::new(o)),
5778 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
5779 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
5780 CResult_PrivateRouteCreationErrorZ {
5781 contents: CResult_PrivateRouteCreationErrorZPtr {
5782 err: Box::into_raw(Box::new(e)),
5788 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
5789 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
5790 impl Drop for CResult_PrivateRouteCreationErrorZ {
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_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
5804 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> 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_PrivateRouteCreationErrorZPtr { result }
5810 let err = unsafe { o.contents.err };
5811 unsafe { o.contents.err = std::ptr::null_mut(); }
5812 CResult_PrivateRouteCreationErrorZPtr { err }
5816 result_ok: o.result_ok,
5820 impl Clone for CResult_PrivateRouteCreationErrorZ {
5821 fn clone(&self) -> Self {
5823 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
5824 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
5827 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
5828 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5834 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
5835 /// but with all dynamically-allocated buffers duplicated in new buffers.
5836 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { orig.clone() }
5838 /// The contents of CResult_StringErrorZ
5839 pub union CResult_StringErrorZPtr {
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::c_types::Str,
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::c_types::Secp256k1Error,
5848 /// A CResult_StringErrorZ represents the result of a fallible operation,
5849 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5851 pub struct CResult_StringErrorZ {
5852 /// The contents of this CResult_StringErrorZ, accessible via either
5853 /// `err` or `result` depending on the state of `result_ok`.
5854 pub contents: CResult_StringErrorZPtr,
5855 /// Whether this CResult_StringErrorZ represents a success state.
5856 pub result_ok: bool,
5859 /// Creates a new CResult_StringErrorZ in the success state.
5860 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
5861 CResult_StringErrorZ {
5862 contents: CResult_StringErrorZPtr {
5863 result: Box::into_raw(Box::new(o)),
5869 /// Creates a new CResult_StringErrorZ in the error state.
5870 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
5871 CResult_StringErrorZ {
5872 contents: CResult_StringErrorZPtr {
5873 err: Box::into_raw(Box::new(e)),
5879 /// Frees any resources used by the CResult_StringErrorZ.
5880 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
5881 impl Drop for CResult_StringErrorZ {
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::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
5895 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> 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_StringErrorZPtr { result }
5901 let err = unsafe { o.contents.err };
5902 unsafe { o.contents.err = std::ptr::null_mut(); }
5903 CResult_StringErrorZPtr { err }
5907 result_ok: o.result_ok,
5912 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5913 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5914 /// A pointer to the contents in the success state.
5915 /// Reading from this pointer when `result_ok` is not set is undefined.
5916 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
5917 /// A pointer to the contents in the error state.
5918 /// Reading from this pointer when `result_ok` is set is undefined.
5919 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5922 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5923 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5925 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
5926 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5927 /// `err` or `result` depending on the state of `result_ok`.
5928 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
5929 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5930 pub result_ok: bool,
5933 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
5934 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5935 CResult_ChannelMonitorUpdateDecodeErrorZ {
5936 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5937 result: Box::into_raw(Box::new(o)),
5943 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
5944 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5945 CResult_ChannelMonitorUpdateDecodeErrorZ {
5946 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5947 err: Box::into_raw(Box::new(e)),
5953 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
5954 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
5955 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
5956 fn drop(&mut self) {
5958 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5959 let _ = unsafe { Box::from_raw(self.contents.result) };
5962 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5963 let _ = unsafe { Box::from_raw(self.contents.err) };
5968 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
5969 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5970 let contents = if o.result_ok {
5971 let result = unsafe { o.contents.result };
5972 unsafe { o.contents.result = std::ptr::null_mut() };
5973 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
5975 let err = unsafe { o.contents.err };
5976 unsafe { o.contents.err = std::ptr::null_mut(); }
5977 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
5981 result_ok: o.result_ok,
5985 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
5986 fn clone(&self) -> Self {
5988 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5989 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
5992 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5993 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5999 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
6000 /// but with all dynamically-allocated buffers duplicated in new buffers.
6001 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
6003 /// The contents of CResult_HTLCUpdateDecodeErrorZ
6004 pub union CResult_HTLCUpdateDecodeErrorZPtr {
6005 /// A pointer to the contents in the success state.
6006 /// Reading from this pointer when `result_ok` is not set is undefined.
6007 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
6008 /// A pointer to the contents in the error state.
6009 /// Reading from this pointer when `result_ok` is set is undefined.
6010 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6013 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6014 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6016 pub struct CResult_HTLCUpdateDecodeErrorZ {
6017 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6018 /// `err` or `result` depending on the state of `result_ok`.
6019 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
6020 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6021 pub result_ok: bool,
6024 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
6025 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
6026 CResult_HTLCUpdateDecodeErrorZ {
6027 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6028 result: Box::into_raw(Box::new(o)),
6034 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
6035 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
6036 CResult_HTLCUpdateDecodeErrorZ {
6037 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6038 err: Box::into_raw(Box::new(e)),
6044 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
6045 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
6046 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
6047 fn drop(&mut self) {
6049 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6050 let _ = unsafe { Box::from_raw(self.contents.result) };
6053 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6054 let _ = unsafe { Box::from_raw(self.contents.err) };
6059 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
6060 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6061 let contents = if o.result_ok {
6062 let result = unsafe { o.contents.result };
6063 unsafe { o.contents.result = std::ptr::null_mut() };
6064 CResult_HTLCUpdateDecodeErrorZPtr { result }
6066 let err = unsafe { o.contents.err };
6067 unsafe { o.contents.err = std::ptr::null_mut(); }
6068 CResult_HTLCUpdateDecodeErrorZPtr { err }
6072 result_ok: o.result_ok,
6076 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
6077 fn clone(&self) -> Self {
6079 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6080 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
6083 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6084 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6090 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
6091 /// but with all dynamically-allocated buffers duplicated in new buffers.
6092 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
6094 /// The contents of CResult_NoneMonitorUpdateErrorZ
6095 pub union CResult_NoneMonitorUpdateErrorZPtr {
6096 /// Note that this value is always NULL, as there are no contents in the OK variant
6097 pub result: *mut std::ffi::c_void,
6098 /// A pointer to the contents in the error state.
6099 /// Reading from this pointer when `result_ok` is set is undefined.
6100 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
6103 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6104 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6106 pub struct CResult_NoneMonitorUpdateErrorZ {
6107 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6108 /// `err` or `result` depending on the state of `result_ok`.
6109 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
6110 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6111 pub result_ok: bool,
6114 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
6115 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
6116 CResult_NoneMonitorUpdateErrorZ {
6117 contents: CResult_NoneMonitorUpdateErrorZPtr {
6118 result: std::ptr::null_mut(),
6124 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
6125 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
6126 CResult_NoneMonitorUpdateErrorZ {
6127 contents: CResult_NoneMonitorUpdateErrorZPtr {
6128 err: Box::into_raw(Box::new(e)),
6134 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
6135 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
6136 impl Drop for CResult_NoneMonitorUpdateErrorZ {
6137 fn drop(&mut self) {
6140 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6141 let _ = unsafe { Box::from_raw(self.contents.err) };
6146 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
6147 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
6148 let contents = if o.result_ok {
6149 let _ = unsafe { Box::from_raw(o.contents.result) };
6150 o.contents.result = std::ptr::null_mut();
6151 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
6153 let err = unsafe { o.contents.err };
6154 unsafe { o.contents.err = std::ptr::null_mut(); }
6155 CResult_NoneMonitorUpdateErrorZPtr { err }
6159 result_ok: o.result_ok,
6163 impl Clone for CResult_NoneMonitorUpdateErrorZ {
6164 fn clone(&self) -> Self {
6166 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
6167 result: std::ptr::null_mut()
6170 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
6171 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
6177 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
6178 /// but with all dynamically-allocated buffers duplicated in new buffers.
6179 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
6181 /// A tuple of 2 elements. See the individual fields for the types contained.
6182 pub struct C2Tuple_OutPointScriptZ {
6183 /// The element at position 0
6184 pub a: crate::lightning::chain::transaction::OutPoint,
6185 /// The element at position 1
6186 pub b: crate::c_types::derived::CVec_u8Z,
6188 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
6189 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
6196 impl C2Tuple_OutPointScriptZ {
6197 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
6201 impl Clone for C2Tuple_OutPointScriptZ {
6202 fn clone(&self) -> Self {
6210 /// Creates a new tuple which has the same data as `orig`
6211 /// but with all dynamically-allocated buffers duplicated in new buffers.
6212 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
6213 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
6215 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
6216 C2Tuple_OutPointScriptZ { a, b, }
6220 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
6221 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
6223 /// A tuple of 2 elements. See the individual fields for the types contained.
6224 pub struct C2Tuple_u32ScriptZ {
6225 /// The element at position 0
6227 /// The element at position 1
6228 pub b: crate::c_types::derived::CVec_u8Z,
6230 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
6231 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
6238 impl C2Tuple_u32ScriptZ {
6239 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
6243 impl Clone for C2Tuple_u32ScriptZ {
6244 fn clone(&self) -> Self {
6252 /// Creates a new tuple which has the same data as `orig`
6253 /// but with all dynamically-allocated buffers duplicated in new buffers.
6254 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
6255 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6257 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6258 C2Tuple_u32ScriptZ { a, b, }
6262 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6263 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6265 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6266 /// This corresponds to std::vector in C++
6267 pub struct CVec_C2Tuple_u32ScriptZZ {
6268 /// The elements in the array.
6269 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6270 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6271 /// The number of elements pointed to by `data`.
6274 impl CVec_C2Tuple_u32ScriptZZ {
6275 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6276 if self.datalen == 0 { return Vec::new(); }
6277 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6278 self.data = std::ptr::null_mut();
6282 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6283 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6286 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6287 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6288 let datalen = v.len();
6289 let data = Box::into_raw(v.into_boxed_slice());
6290 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6294 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6295 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6296 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6297 fn drop(&mut self) {
6298 if self.datalen == 0 { return; }
6299 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6302 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6303 fn clone(&self) -> Self {
6304 let mut res = Vec::new();
6305 if self.datalen == 0 { return Self::from(res); }
6306 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6311 /// A tuple of 2 elements. See the individual fields for the types contained.
6312 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6313 /// The element at position 0
6314 pub a: crate::c_types::ThirtyTwoBytes,
6315 /// The element at position 1
6316 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6318 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6319 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6326 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6327 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6331 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6332 fn clone(&self) -> Self {
6340 /// Creates a new tuple which has the same data as `orig`
6341 /// but with all dynamically-allocated buffers duplicated in new buffers.
6342 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { orig.clone() }
6343 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6345 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 {
6346 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6350 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6351 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6353 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6354 /// This corresponds to std::vector in C++
6355 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6356 /// The elements in the array.
6357 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6358 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6359 /// The number of elements pointed to by `data`.
6362 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6363 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6364 if self.datalen == 0 { return Vec::new(); }
6365 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6366 self.data = std::ptr::null_mut();
6370 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6371 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6374 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6375 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6376 let datalen = v.len();
6377 let data = Box::into_raw(v.into_boxed_slice());
6378 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6382 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6383 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6384 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6385 fn drop(&mut self) {
6386 if self.datalen == 0 { return; }
6387 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6390 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6391 fn clone(&self) -> Self {
6392 let mut res = Vec::new();
6393 if self.datalen == 0 { return Self::from(res); }
6394 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6399 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6400 /// This corresponds to std::vector in C++
6401 pub struct CVec_EventZ {
6402 /// The elements in the array.
6403 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6404 pub data: *mut crate::lightning::util::events::Event,
6405 /// The number of elements pointed to by `data`.
6409 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6410 if self.datalen == 0 { return Vec::new(); }
6411 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6412 self.data = std::ptr::null_mut();
6416 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6417 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6420 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6421 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6422 let datalen = v.len();
6423 let data = Box::into_raw(v.into_boxed_slice());
6424 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6428 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6429 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6430 impl Drop for CVec_EventZ {
6431 fn drop(&mut self) {
6432 if self.datalen == 0 { return; }
6433 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6436 impl Clone for CVec_EventZ {
6437 fn clone(&self) -> Self {
6438 let mut res = Vec::new();
6439 if self.datalen == 0 { return Self::from(res); }
6440 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6445 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6446 /// This corresponds to std::vector in C++
6447 pub struct CVec_TransactionZ {
6448 /// The elements in the array.
6449 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6450 pub data: *mut crate::c_types::Transaction,
6451 /// The number of elements pointed to by `data`.
6454 impl CVec_TransactionZ {
6455 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6456 if self.datalen == 0 { return Vec::new(); }
6457 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6458 self.data = std::ptr::null_mut();
6462 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6463 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6466 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6467 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6468 let datalen = v.len();
6469 let data = Box::into_raw(v.into_boxed_slice());
6470 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6474 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6475 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6476 impl Drop for CVec_TransactionZ {
6477 fn drop(&mut self) {
6478 if self.datalen == 0 { return; }
6479 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6482 impl Clone for CVec_TransactionZ {
6483 fn clone(&self) -> Self {
6484 let mut res = Vec::new();
6485 if self.datalen == 0 { return Self::from(res); }
6486 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6491 /// A tuple of 2 elements. See the individual fields for the types contained.
6492 pub struct C2Tuple_u32TxOutZ {
6493 /// The element at position 0
6495 /// The element at position 1
6496 pub b: crate::c_types::TxOut,
6498 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6499 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6506 impl C2Tuple_u32TxOutZ {
6507 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6511 impl Clone for C2Tuple_u32TxOutZ {
6512 fn clone(&self) -> Self {
6520 /// Creates a new tuple which has the same data as `orig`
6521 /// but with all dynamically-allocated buffers duplicated in new buffers.
6522 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
6523 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6525 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6526 C2Tuple_u32TxOutZ { a, b, }
6530 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6531 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6533 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6534 /// This corresponds to std::vector in C++
6535 pub struct CVec_C2Tuple_u32TxOutZZ {
6536 /// The elements in the array.
6537 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6538 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6539 /// The number of elements pointed to by `data`.
6542 impl CVec_C2Tuple_u32TxOutZZ {
6543 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6544 if self.datalen == 0 { return Vec::new(); }
6545 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6546 self.data = std::ptr::null_mut();
6550 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6551 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6554 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6555 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6556 let datalen = v.len();
6557 let data = Box::into_raw(v.into_boxed_slice());
6558 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6562 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6563 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6564 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6565 fn drop(&mut self) {
6566 if self.datalen == 0 { return; }
6567 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6570 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6571 fn clone(&self) -> Self {
6572 let mut res = Vec::new();
6573 if self.datalen == 0 { return Self::from(res); }
6574 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6579 /// A tuple of 2 elements. See the individual fields for the types contained.
6580 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6581 /// The element at position 0
6582 pub a: crate::c_types::ThirtyTwoBytes,
6583 /// The element at position 1
6584 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6586 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6587 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6594 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6595 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6599 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6600 fn clone(&self) -> Self {
6608 /// Creates a new tuple which has the same data as `orig`
6609 /// but with all dynamically-allocated buffers duplicated in new buffers.
6610 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { orig.clone() }
6611 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6613 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 {
6614 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6618 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6619 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6621 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6622 /// This corresponds to std::vector in C++
6623 pub struct CVec_TransactionOutputsZ {
6624 /// The elements in the array.
6625 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6626 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6627 /// The number of elements pointed to by `data`.
6630 impl CVec_TransactionOutputsZ {
6631 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6632 if self.datalen == 0 { return Vec::new(); }
6633 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6634 self.data = std::ptr::null_mut();
6638 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6639 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6642 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6643 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6644 let datalen = v.len();
6645 let data = Box::into_raw(v.into_boxed_slice());
6646 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6650 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6651 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6652 impl Drop for CVec_TransactionOutputsZ {
6653 fn drop(&mut self) {
6654 if self.datalen == 0 { return; }
6655 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6658 impl Clone for CVec_TransactionOutputsZ {
6659 fn clone(&self) -> Self {
6660 let mut res = Vec::new();
6661 if self.datalen == 0 { return Self::from(res); }
6662 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6667 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6668 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6669 /// A pointer to the contents in the success state.
6670 /// Reading from this pointer when `result_ok` is not set is undefined.
6671 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
6672 /// A pointer to the contents in the error state.
6673 /// Reading from this pointer when `result_ok` is set is undefined.
6674 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6677 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6678 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6680 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6681 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6682 /// `err` or `result` depending on the state of `result_ok`.
6683 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
6684 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6685 pub result_ok: bool,
6688 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
6689 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6690 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6691 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6692 result: Box::into_raw(Box::new(o)),
6698 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
6699 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6700 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6701 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6702 err: Box::into_raw(Box::new(e)),
6708 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
6709 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
6710 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6711 fn drop(&mut self) {
6713 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6714 let _ = unsafe { Box::from_raw(self.contents.result) };
6717 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6718 let _ = unsafe { Box::from_raw(self.contents.err) };
6723 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6724 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6725 let contents = if o.result_ok {
6726 let result = unsafe { o.contents.result };
6727 unsafe { o.contents.result = std::ptr::null_mut() };
6728 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
6730 let err = unsafe { o.contents.err };
6731 unsafe { o.contents.err = std::ptr::null_mut(); }
6732 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
6736 result_ok: o.result_ok,
6741 /// The contents of CResult_boolLightningErrorZ
6742 pub union CResult_boolLightningErrorZPtr {
6743 /// A pointer to the contents in the success state.
6744 /// Reading from this pointer when `result_ok` is not set is undefined.
6745 pub result: *mut bool,
6746 /// A pointer to the contents in the error state.
6747 /// Reading from this pointer when `result_ok` is set is undefined.
6748 pub err: *mut crate::lightning::ln::msgs::LightningError,
6751 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6752 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6754 pub struct CResult_boolLightningErrorZ {
6755 /// The contents of this CResult_boolLightningErrorZ, accessible via either
6756 /// `err` or `result` depending on the state of `result_ok`.
6757 pub contents: CResult_boolLightningErrorZPtr,
6758 /// Whether this CResult_boolLightningErrorZ represents a success state.
6759 pub result_ok: bool,
6762 /// Creates a new CResult_boolLightningErrorZ in the success state.
6763 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6764 CResult_boolLightningErrorZ {
6765 contents: CResult_boolLightningErrorZPtr {
6766 result: Box::into_raw(Box::new(o)),
6772 /// Creates a new CResult_boolLightningErrorZ in the error state.
6773 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6774 CResult_boolLightningErrorZ {
6775 contents: CResult_boolLightningErrorZPtr {
6776 err: Box::into_raw(Box::new(e)),
6782 /// Frees any resources used by the CResult_boolLightningErrorZ.
6783 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6784 impl Drop for CResult_boolLightningErrorZ {
6785 fn drop(&mut self) {
6787 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6788 let _ = unsafe { Box::from_raw(self.contents.result) };
6791 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6792 let _ = unsafe { Box::from_raw(self.contents.err) };
6797 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6798 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6799 let contents = if o.result_ok {
6800 let result = unsafe { o.contents.result };
6801 unsafe { o.contents.result = std::ptr::null_mut() };
6802 CResult_boolLightningErrorZPtr { result }
6804 let err = unsafe { o.contents.err };
6805 unsafe { o.contents.err = std::ptr::null_mut(); }
6806 CResult_boolLightningErrorZPtr { err }
6810 result_ok: o.result_ok,
6814 impl Clone for CResult_boolLightningErrorZ {
6815 fn clone(&self) -> Self {
6817 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6818 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6821 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6822 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6828 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6829 /// but with all dynamically-allocated buffers duplicated in new buffers.
6830 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
6832 /// A tuple of 3 elements. See the individual fields for the types contained.
6833 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6834 /// The element at position 0
6835 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6836 /// The element at position 1
6837 pub b: crate::lightning::ln::msgs::ChannelUpdate,
6838 /// The element at position 2
6839 pub c: crate::lightning::ln::msgs::ChannelUpdate,
6841 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6842 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6850 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6851 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6852 (self.a, self.b, self.c)
6855 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6856 fn clone(&self) -> Self {
6865 /// Creates a new tuple which has the same data as `orig`
6866 /// but with all dynamically-allocated buffers duplicated in new buffers.
6867 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
6868 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6870 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 {
6871 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6875 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6876 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6878 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6879 /// This corresponds to std::vector in C++
6880 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6881 /// The elements in the array.
6882 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6883 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
6884 /// The number of elements pointed to by `data`.
6887 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6888 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
6889 if self.datalen == 0 { return Vec::new(); }
6890 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6891 self.data = std::ptr::null_mut();
6895 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
6896 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6899 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6900 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
6901 let datalen = v.len();
6902 let data = Box::into_raw(v.into_boxed_slice());
6903 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6907 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6908 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6909 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6910 fn drop(&mut self) {
6911 if self.datalen == 0 { return; }
6912 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6915 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6916 fn clone(&self) -> Self {
6917 let mut res = Vec::new();
6918 if self.datalen == 0 { return Self::from(res); }
6919 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6924 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6925 /// This corresponds to std::vector in C++
6926 pub struct CVec_NodeAnnouncementZ {
6927 /// The elements in the array.
6928 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6929 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
6930 /// The number of elements pointed to by `data`.
6933 impl CVec_NodeAnnouncementZ {
6934 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
6935 if self.datalen == 0 { return Vec::new(); }
6936 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6937 self.data = std::ptr::null_mut();
6941 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
6942 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6945 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
6946 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
6947 let datalen = v.len();
6948 let data = Box::into_raw(v.into_boxed_slice());
6949 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6953 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6954 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
6955 impl Drop for CVec_NodeAnnouncementZ {
6956 fn drop(&mut self) {
6957 if self.datalen == 0 { return; }
6958 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6961 impl Clone for CVec_NodeAnnouncementZ {
6962 fn clone(&self) -> Self {
6963 let mut res = Vec::new();
6964 if self.datalen == 0 { return Self::from(res); }
6965 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6970 /// The contents of CResult_NoneLightningErrorZ
6971 pub union CResult_NoneLightningErrorZPtr {
6972 /// Note that this value is always NULL, as there are no contents in the OK variant
6973 pub result: *mut std::ffi::c_void,
6974 /// A pointer to the contents in the error state.
6975 /// Reading from this pointer when `result_ok` is set is undefined.
6976 pub err: *mut crate::lightning::ln::msgs::LightningError,
6979 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6980 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6982 pub struct CResult_NoneLightningErrorZ {
6983 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6984 /// `err` or `result` depending on the state of `result_ok`.
6985 pub contents: CResult_NoneLightningErrorZPtr,
6986 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6987 pub result_ok: bool,
6990 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6991 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6992 CResult_NoneLightningErrorZ {
6993 contents: CResult_NoneLightningErrorZPtr {
6994 result: std::ptr::null_mut(),
7000 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7001 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7002 CResult_NoneLightningErrorZ {
7003 contents: CResult_NoneLightningErrorZPtr {
7004 err: Box::into_raw(Box::new(e)),
7010 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7011 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7012 impl Drop for CResult_NoneLightningErrorZ {
7013 fn drop(&mut self) {
7016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7017 let _ = unsafe { Box::from_raw(self.contents.err) };
7022 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7023 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7024 let contents = if o.result_ok {
7025 let _ = unsafe { Box::from_raw(o.contents.result) };
7026 o.contents.result = std::ptr::null_mut();
7027 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
7029 let err = unsafe { o.contents.err };
7030 unsafe { o.contents.err = std::ptr::null_mut(); }
7031 CResult_NoneLightningErrorZPtr { err }
7035 result_ok: o.result_ok,
7039 impl Clone for CResult_NoneLightningErrorZ {
7040 fn clone(&self) -> Self {
7042 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7043 result: std::ptr::null_mut()
7046 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7047 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7053 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7054 /// but with all dynamically-allocated buffers duplicated in new buffers.
7055 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
7057 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7058 /// This corresponds to std::vector in C++
7059 pub struct CVec_PublicKeyZ {
7060 /// The elements in the array.
7061 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7062 pub data: *mut crate::c_types::PublicKey,
7063 /// The number of elements pointed to by `data`.
7066 impl CVec_PublicKeyZ {
7067 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
7068 if self.datalen == 0 { return Vec::new(); }
7069 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7070 self.data = std::ptr::null_mut();
7074 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
7075 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7078 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
7079 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
7080 let datalen = v.len();
7081 let data = Box::into_raw(v.into_boxed_slice());
7082 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7086 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7087 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
7088 impl Drop for CVec_PublicKeyZ {
7089 fn drop(&mut self) {
7090 if self.datalen == 0 { return; }
7091 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7094 impl Clone for CVec_PublicKeyZ {
7095 fn clone(&self) -> Self {
7096 let mut res = Vec::new();
7097 if self.datalen == 0 { return Self::from(res); }
7098 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7103 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
7104 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
7105 /// A pointer to the contents in the success state.
7106 /// Reading from this pointer when `result_ok` is not set is undefined.
7107 pub result: *mut crate::c_types::derived::CVec_u8Z,
7108 /// A pointer to the contents in the error state.
7109 /// Reading from this pointer when `result_ok` is set is undefined.
7110 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7113 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7114 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7115 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7116 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
7117 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7118 /// `err` or `result` depending on the state of `result_ok`.
7119 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
7120 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7121 pub result_ok: bool,
7124 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
7125 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
7126 CResult_CVec_u8ZPeerHandleErrorZ {
7127 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7128 result: Box::into_raw(Box::new(o)),
7134 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
7135 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
7136 CResult_CVec_u8ZPeerHandleErrorZ {
7137 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7138 err: Box::into_raw(Box::new(e)),
7144 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
7145 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
7146 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
7147 fn drop(&mut self) {
7149 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7150 let _ = unsafe { Box::from_raw(self.contents.result) };
7153 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7154 let _ = unsafe { Box::from_raw(self.contents.err) };
7159 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
7160 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7161 let contents = if o.result_ok {
7162 let result = unsafe { o.contents.result };
7163 unsafe { o.contents.result = std::ptr::null_mut() };
7164 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
7166 let err = unsafe { o.contents.err };
7167 unsafe { o.contents.err = std::ptr::null_mut(); }
7168 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
7172 result_ok: o.result_ok,
7176 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
7177 fn clone(&self) -> Self {
7179 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7180 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
7183 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7184 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7190 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
7191 /// but with all dynamically-allocated buffers duplicated in new buffers.
7192 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
7194 /// The contents of CResult_NonePeerHandleErrorZ
7195 pub union CResult_NonePeerHandleErrorZPtr {
7196 /// Note that this value is always NULL, as there are no contents in the OK variant
7197 pub result: *mut std::ffi::c_void,
7198 /// A pointer to the contents in the error state.
7199 /// Reading from this pointer when `result_ok` is set is undefined.
7200 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7203 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7204 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7206 pub struct CResult_NonePeerHandleErrorZ {
7207 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7208 /// `err` or `result` depending on the state of `result_ok`.
7209 pub contents: CResult_NonePeerHandleErrorZPtr,
7210 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
7211 pub result_ok: bool,
7214 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
7215 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
7216 CResult_NonePeerHandleErrorZ {
7217 contents: CResult_NonePeerHandleErrorZPtr {
7218 result: std::ptr::null_mut(),
7224 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
7225 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
7226 CResult_NonePeerHandleErrorZ {
7227 contents: CResult_NonePeerHandleErrorZPtr {
7228 err: Box::into_raw(Box::new(e)),
7234 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
7235 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
7236 impl Drop for CResult_NonePeerHandleErrorZ {
7237 fn drop(&mut self) {
7240 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7241 let _ = unsafe { Box::from_raw(self.contents.err) };
7246 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
7247 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7248 let contents = if o.result_ok {
7249 let _ = unsafe { Box::from_raw(o.contents.result) };
7250 o.contents.result = std::ptr::null_mut();
7251 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
7253 let err = unsafe { o.contents.err };
7254 unsafe { o.contents.err = std::ptr::null_mut(); }
7255 CResult_NonePeerHandleErrorZPtr { err }
7259 result_ok: o.result_ok,
7263 impl Clone for CResult_NonePeerHandleErrorZ {
7264 fn clone(&self) -> Self {
7266 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
7267 result: std::ptr::null_mut()
7270 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
7271 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7277 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
7278 /// but with all dynamically-allocated buffers duplicated in new buffers.
7279 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
7281 /// The contents of CResult_boolPeerHandleErrorZ
7282 pub union CResult_boolPeerHandleErrorZPtr {
7283 /// A pointer to the contents in the success state.
7284 /// Reading from this pointer when `result_ok` is not set is undefined.
7285 pub result: *mut bool,
7286 /// A pointer to the contents in the error state.
7287 /// Reading from this pointer when `result_ok` is set is undefined.
7288 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7291 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7292 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7294 pub struct CResult_boolPeerHandleErrorZ {
7295 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7296 /// `err` or `result` depending on the state of `result_ok`.
7297 pub contents: CResult_boolPeerHandleErrorZPtr,
7298 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7299 pub result_ok: bool,
7302 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7303 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7304 CResult_boolPeerHandleErrorZ {
7305 contents: CResult_boolPeerHandleErrorZPtr {
7306 result: Box::into_raw(Box::new(o)),
7312 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7313 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7314 CResult_boolPeerHandleErrorZ {
7315 contents: CResult_boolPeerHandleErrorZPtr {
7316 err: Box::into_raw(Box::new(e)),
7322 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7323 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7324 impl Drop for CResult_boolPeerHandleErrorZ {
7325 fn drop(&mut self) {
7327 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7328 let _ = unsafe { Box::from_raw(self.contents.result) };
7331 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7332 let _ = unsafe { Box::from_raw(self.contents.err) };
7337 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7338 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7339 let contents = if o.result_ok {
7340 let result = unsafe { o.contents.result };
7341 unsafe { o.contents.result = std::ptr::null_mut() };
7342 CResult_boolPeerHandleErrorZPtr { result }
7344 let err = unsafe { o.contents.err };
7345 unsafe { o.contents.err = std::ptr::null_mut(); }
7346 CResult_boolPeerHandleErrorZPtr { err }
7350 result_ok: o.result_ok,
7354 impl Clone for CResult_boolPeerHandleErrorZ {
7355 fn clone(&self) -> Self {
7357 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7358 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7361 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
7362 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7368 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7369 /// but with all dynamically-allocated buffers duplicated in new buffers.
7370 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
7372 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7373 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
7374 /// A pointer to the contents in the success state.
7375 /// Reading from this pointer when `result_ok` is not set is undefined.
7376 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
7377 /// A pointer to the contents in the error state.
7378 /// Reading from this pointer when `result_ok` is set is undefined.
7379 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7382 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7383 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7385 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7386 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7387 /// `err` or `result` depending on the state of `result_ok`.
7388 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7389 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7390 pub result_ok: bool,
7393 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7394 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7395 CResult_DirectionalChannelInfoDecodeErrorZ {
7396 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7397 result: Box::into_raw(Box::new(o)),
7403 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7404 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7405 CResult_DirectionalChannelInfoDecodeErrorZ {
7406 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7407 err: Box::into_raw(Box::new(e)),
7413 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
7414 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7415 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
7416 fn drop(&mut self) {
7418 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7419 let _ = unsafe { Box::from_raw(self.contents.result) };
7422 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7423 let _ = unsafe { Box::from_raw(self.contents.err) };
7428 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7429 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7430 let contents = if o.result_ok {
7431 let result = unsafe { o.contents.result };
7432 unsafe { o.contents.result = std::ptr::null_mut() };
7433 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
7435 let err = unsafe { o.contents.err };
7436 unsafe { o.contents.err = std::ptr::null_mut(); }
7437 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7441 result_ok: o.result_ok,
7445 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7446 fn clone(&self) -> Self {
7448 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7449 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7452 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7453 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7459 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7460 /// but with all dynamically-allocated buffers duplicated in new buffers.
7461 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
7463 /// The contents of CResult_ChannelInfoDecodeErrorZ
7464 pub union CResult_ChannelInfoDecodeErrorZPtr {
7465 /// A pointer to the contents in the success state.
7466 /// Reading from this pointer when `result_ok` is not set is undefined.
7467 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
7468 /// A pointer to the contents in the error state.
7469 /// Reading from this pointer when `result_ok` is set is undefined.
7470 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7473 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7474 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7476 pub struct CResult_ChannelInfoDecodeErrorZ {
7477 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7478 /// `err` or `result` depending on the state of `result_ok`.
7479 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7480 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7481 pub result_ok: bool,
7484 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7485 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7486 CResult_ChannelInfoDecodeErrorZ {
7487 contents: CResult_ChannelInfoDecodeErrorZPtr {
7488 result: Box::into_raw(Box::new(o)),
7494 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7495 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7496 CResult_ChannelInfoDecodeErrorZ {
7497 contents: CResult_ChannelInfoDecodeErrorZPtr {
7498 err: Box::into_raw(Box::new(e)),
7504 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7505 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7506 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7507 fn drop(&mut self) {
7509 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7510 let _ = unsafe { Box::from_raw(self.contents.result) };
7513 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7514 let _ = unsafe { Box::from_raw(self.contents.err) };
7519 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7520 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7521 let contents = if o.result_ok {
7522 let result = unsafe { o.contents.result };
7523 unsafe { o.contents.result = std::ptr::null_mut() };
7524 CResult_ChannelInfoDecodeErrorZPtr { result }
7526 let err = unsafe { o.contents.err };
7527 unsafe { o.contents.err = std::ptr::null_mut(); }
7528 CResult_ChannelInfoDecodeErrorZPtr { err }
7532 result_ok: o.result_ok,
7536 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7537 fn clone(&self) -> Self {
7539 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7540 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7543 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7544 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7550 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7551 /// but with all dynamically-allocated buffers duplicated in new buffers.
7552 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
7554 /// The contents of CResult_RoutingFeesDecodeErrorZ
7555 pub union CResult_RoutingFeesDecodeErrorZPtr {
7556 /// A pointer to the contents in the success state.
7557 /// Reading from this pointer when `result_ok` is not set is undefined.
7558 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
7559 /// A pointer to the contents in the error state.
7560 /// Reading from this pointer when `result_ok` is set is undefined.
7561 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7564 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7565 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7567 pub struct CResult_RoutingFeesDecodeErrorZ {
7568 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7569 /// `err` or `result` depending on the state of `result_ok`.
7570 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7571 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7572 pub result_ok: bool,
7575 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7576 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7577 CResult_RoutingFeesDecodeErrorZ {
7578 contents: CResult_RoutingFeesDecodeErrorZPtr {
7579 result: Box::into_raw(Box::new(o)),
7585 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7586 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7587 CResult_RoutingFeesDecodeErrorZ {
7588 contents: CResult_RoutingFeesDecodeErrorZPtr {
7589 err: Box::into_raw(Box::new(e)),
7595 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7596 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7597 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7598 fn drop(&mut self) {
7600 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7601 let _ = unsafe { Box::from_raw(self.contents.result) };
7604 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7605 let _ = unsafe { Box::from_raw(self.contents.err) };
7610 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7611 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7612 let contents = if o.result_ok {
7613 let result = unsafe { o.contents.result };
7614 unsafe { o.contents.result = std::ptr::null_mut() };
7615 CResult_RoutingFeesDecodeErrorZPtr { result }
7617 let err = unsafe { o.contents.err };
7618 unsafe { o.contents.err = std::ptr::null_mut(); }
7619 CResult_RoutingFeesDecodeErrorZPtr { err }
7623 result_ok: o.result_ok,
7627 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7628 fn clone(&self) -> Self {
7630 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7631 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
7634 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7635 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7641 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7642 /// but with all dynamically-allocated buffers duplicated in new buffers.
7643 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
7645 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7646 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7647 /// A pointer to the contents in the success state.
7648 /// Reading from this pointer when `result_ok` is not set is undefined.
7649 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
7650 /// A pointer to the contents in the error state.
7651 /// Reading from this pointer when `result_ok` is set is undefined.
7652 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7655 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7656 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7658 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7659 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7660 /// `err` or `result` depending on the state of `result_ok`.
7661 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7662 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7663 pub result_ok: bool,
7666 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7667 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7668 CResult_NodeAnnouncementInfoDecodeErrorZ {
7669 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7670 result: Box::into_raw(Box::new(o)),
7676 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7677 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7678 CResult_NodeAnnouncementInfoDecodeErrorZ {
7679 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7680 err: Box::into_raw(Box::new(e)),
7686 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7687 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7688 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7689 fn drop(&mut self) {
7691 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7692 let _ = unsafe { Box::from_raw(self.contents.result) };
7695 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7696 let _ = unsafe { Box::from_raw(self.contents.err) };
7701 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7702 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7703 let contents = if o.result_ok {
7704 let result = unsafe { o.contents.result };
7705 unsafe { o.contents.result = std::ptr::null_mut() };
7706 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7708 let err = unsafe { o.contents.err };
7709 unsafe { o.contents.err = std::ptr::null_mut(); }
7710 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7714 result_ok: o.result_ok,
7718 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7719 fn clone(&self) -> Self {
7721 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7722 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7725 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7726 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7732 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7733 /// but with all dynamically-allocated buffers duplicated in new buffers.
7734 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
7736 /// A dynamically-allocated array of u64s of arbitrary size.
7737 /// This corresponds to std::vector in C++
7738 pub struct CVec_u64Z {
7739 /// The elements in the array.
7740 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7742 /// The number of elements pointed to by `data`.
7746 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
7747 if self.datalen == 0 { return Vec::new(); }
7748 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7749 self.data = std::ptr::null_mut();
7753 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
7754 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7757 impl From<Vec<u64>> for CVec_u64Z {
7758 fn from(v: Vec<u64>) -> Self {
7759 let datalen = v.len();
7760 let data = Box::into_raw(v.into_boxed_slice());
7761 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7765 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7766 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
7767 impl Drop for CVec_u64Z {
7768 fn drop(&mut self) {
7769 if self.datalen == 0 { return; }
7770 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7773 impl Clone for CVec_u64Z {
7774 fn clone(&self) -> Self {
7775 let mut res = Vec::new();
7776 if self.datalen == 0 { return Self::from(res); }
7777 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7782 /// The contents of CResult_NodeInfoDecodeErrorZ
7783 pub union CResult_NodeInfoDecodeErrorZPtr {
7784 /// A pointer to the contents in the success state.
7785 /// Reading from this pointer when `result_ok` is not set is undefined.
7786 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
7787 /// A pointer to the contents in the error state.
7788 /// Reading from this pointer when `result_ok` is set is undefined.
7789 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7792 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7793 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7795 pub struct CResult_NodeInfoDecodeErrorZ {
7796 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7797 /// `err` or `result` depending on the state of `result_ok`.
7798 pub contents: CResult_NodeInfoDecodeErrorZPtr,
7799 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7800 pub result_ok: bool,
7803 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7804 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7805 CResult_NodeInfoDecodeErrorZ {
7806 contents: CResult_NodeInfoDecodeErrorZPtr {
7807 result: Box::into_raw(Box::new(o)),
7813 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7814 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7815 CResult_NodeInfoDecodeErrorZ {
7816 contents: CResult_NodeInfoDecodeErrorZPtr {
7817 err: Box::into_raw(Box::new(e)),
7823 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7824 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7825 impl Drop for CResult_NodeInfoDecodeErrorZ {
7826 fn drop(&mut self) {
7828 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7829 let _ = unsafe { Box::from_raw(self.contents.result) };
7832 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7833 let _ = unsafe { Box::from_raw(self.contents.err) };
7838 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7839 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7840 let contents = if o.result_ok {
7841 let result = unsafe { o.contents.result };
7842 unsafe { o.contents.result = std::ptr::null_mut() };
7843 CResult_NodeInfoDecodeErrorZPtr { result }
7845 let err = unsafe { o.contents.err };
7846 unsafe { o.contents.err = std::ptr::null_mut(); }
7847 CResult_NodeInfoDecodeErrorZPtr { err }
7851 result_ok: o.result_ok,
7855 impl Clone for CResult_NodeInfoDecodeErrorZ {
7856 fn clone(&self) -> Self {
7858 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7859 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
7862 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7863 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7869 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7870 /// but with all dynamically-allocated buffers duplicated in new buffers.
7871 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
7873 /// The contents of CResult_NetworkGraphDecodeErrorZ
7874 pub union CResult_NetworkGraphDecodeErrorZPtr {
7875 /// A pointer to the contents in the success state.
7876 /// Reading from this pointer when `result_ok` is not set is undefined.
7877 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
7878 /// A pointer to the contents in the error state.
7879 /// Reading from this pointer when `result_ok` is set is undefined.
7880 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7883 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7884 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7886 pub struct CResult_NetworkGraphDecodeErrorZ {
7887 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7888 /// `err` or `result` depending on the state of `result_ok`.
7889 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7890 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7891 pub result_ok: bool,
7894 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7895 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7896 CResult_NetworkGraphDecodeErrorZ {
7897 contents: CResult_NetworkGraphDecodeErrorZPtr {
7898 result: Box::into_raw(Box::new(o)),
7904 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7905 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7906 CResult_NetworkGraphDecodeErrorZ {
7907 contents: CResult_NetworkGraphDecodeErrorZPtr {
7908 err: Box::into_raw(Box::new(e)),
7914 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7915 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7916 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7917 fn drop(&mut self) {
7919 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7920 let _ = unsafe { Box::from_raw(self.contents.result) };
7923 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7924 let _ = unsafe { Box::from_raw(self.contents.err) };
7929 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7930 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7931 let contents = if o.result_ok {
7932 let result = unsafe { o.contents.result };
7933 unsafe { o.contents.result = std::ptr::null_mut() };
7934 CResult_NetworkGraphDecodeErrorZPtr { result }
7936 let err = unsafe { o.contents.err };
7937 unsafe { o.contents.err = std::ptr::null_mut(); }
7938 CResult_NetworkGraphDecodeErrorZPtr { err }
7942 result_ok: o.result_ok,
7946 impl Clone for CResult_NetworkGraphDecodeErrorZ {
7947 fn clone(&self) -> Self {
7949 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
7950 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
7953 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
7954 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7960 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
7961 /// but with all dynamically-allocated buffers duplicated in new buffers.
7962 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
7964 /// The contents of CResult_NetAddressu8Z
7965 pub union CResult_NetAddressu8ZPtr {
7966 /// A pointer to the contents in the success state.
7967 /// Reading from this pointer when `result_ok` is not set is undefined.
7968 pub result: *mut crate::lightning::ln::msgs::NetAddress,
7969 /// A pointer to the contents in the error state.
7970 /// Reading from this pointer when `result_ok` is set is undefined.
7974 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
7975 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7977 pub struct CResult_NetAddressu8Z {
7978 /// The contents of this CResult_NetAddressu8Z, accessible via either
7979 /// `err` or `result` depending on the state of `result_ok`.
7980 pub contents: CResult_NetAddressu8ZPtr,
7981 /// Whether this CResult_NetAddressu8Z represents a success state.
7982 pub result_ok: bool,
7985 /// Creates a new CResult_NetAddressu8Z in the success state.
7986 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
7987 CResult_NetAddressu8Z {
7988 contents: CResult_NetAddressu8ZPtr {
7989 result: Box::into_raw(Box::new(o)),
7995 /// Creates a new CResult_NetAddressu8Z in the error state.
7996 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
7997 CResult_NetAddressu8Z {
7998 contents: CResult_NetAddressu8ZPtr {
7999 err: Box::into_raw(Box::new(e)),
8005 /// Frees any resources used by the CResult_NetAddressu8Z.
8006 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
8007 impl Drop for CResult_NetAddressu8Z {
8008 fn drop(&mut self) {
8010 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8011 let _ = unsafe { Box::from_raw(self.contents.result) };
8014 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8015 let _ = unsafe { Box::from_raw(self.contents.err) };
8020 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
8021 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
8022 let contents = if o.result_ok {
8023 let result = unsafe { o.contents.result };
8024 unsafe { o.contents.result = std::ptr::null_mut() };
8025 CResult_NetAddressu8ZPtr { result }
8027 let err = unsafe { o.contents.err };
8028 unsafe { o.contents.err = std::ptr::null_mut(); }
8029 CResult_NetAddressu8ZPtr { err }
8033 result_ok: o.result_ok,
8037 impl Clone for CResult_NetAddressu8Z {
8038 fn clone(&self) -> Self {
8040 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
8041 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8044 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
8045 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
8051 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8052 /// but with all dynamically-allocated buffers duplicated in new buffers.
8053 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
8055 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
8056 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8057 /// A pointer to the contents in the success state.
8058 /// Reading from this pointer when `result_ok` is not set is undefined.
8059 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
8060 /// A pointer to the contents in the error state.
8061 /// Reading from this pointer when `result_ok` is set is undefined.
8062 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8065 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
8066 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
8067 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8068 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
8069 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
8070 /// `err` or `result` depending on the state of `result_ok`.
8071 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
8072 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
8073 pub result_ok: bool,
8076 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8077 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8078 CResult_CResult_NetAddressu8ZDecodeErrorZ {
8079 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8080 result: Box::into_raw(Box::new(o)),
8086 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8087 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8088 CResult_CResult_NetAddressu8ZDecodeErrorZ {
8089 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8090 err: Box::into_raw(Box::new(e)),
8096 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8097 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
8098 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8099 fn drop(&mut self) {
8101 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8102 let _ = unsafe { Box::from_raw(self.contents.result) };
8105 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8106 let _ = unsafe { Box::from_raw(self.contents.err) };
8111 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8112 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
8113 let contents = if o.result_ok {
8114 let result = unsafe { o.contents.result };
8115 unsafe { o.contents.result = std::ptr::null_mut() };
8116 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
8118 let err = unsafe { o.contents.err };
8119 unsafe { o.contents.err = std::ptr::null_mut(); }
8120 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
8124 result_ok: o.result_ok,
8128 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8129 fn clone(&self) -> Self {
8131 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8132 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
8135 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8136 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8142 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8143 /// but with all dynamically-allocated buffers duplicated in new buffers.
8144 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
8146 /// The contents of CResult_NetAddressDecodeErrorZ
8147 pub union CResult_NetAddressDecodeErrorZPtr {
8148 /// A pointer to the contents in the success state.
8149 /// Reading from this pointer when `result_ok` is not set is undefined.
8150 pub result: *mut crate::lightning::ln::msgs::NetAddress,
8151 /// A pointer to the contents in the error state.
8152 /// Reading from this pointer when `result_ok` is set is undefined.
8153 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8156 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8157 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8158 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8159 pub struct CResult_NetAddressDecodeErrorZ {
8160 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8161 /// `err` or `result` depending on the state of `result_ok`.
8162 pub contents: CResult_NetAddressDecodeErrorZPtr,
8163 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8164 pub result_ok: bool,
8167 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
8168 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
8169 CResult_NetAddressDecodeErrorZ {
8170 contents: CResult_NetAddressDecodeErrorZPtr {
8171 result: Box::into_raw(Box::new(o)),
8177 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
8178 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
8179 CResult_NetAddressDecodeErrorZ {
8180 contents: CResult_NetAddressDecodeErrorZPtr {
8181 err: Box::into_raw(Box::new(e)),
8187 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
8188 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
8189 impl Drop for CResult_NetAddressDecodeErrorZ {
8190 fn drop(&mut self) {
8192 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8193 let _ = unsafe { Box::from_raw(self.contents.result) };
8196 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8197 let _ = unsafe { Box::from_raw(self.contents.err) };
8202 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
8203 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
8204 let contents = if o.result_ok {
8205 let result = unsafe { o.contents.result };
8206 unsafe { o.contents.result = std::ptr::null_mut() };
8207 CResult_NetAddressDecodeErrorZPtr { result }
8209 let err = unsafe { o.contents.err };
8210 unsafe { o.contents.err = std::ptr::null_mut(); }
8211 CResult_NetAddressDecodeErrorZPtr { err }
8215 result_ok: o.result_ok,
8219 impl Clone for CResult_NetAddressDecodeErrorZ {
8220 fn clone(&self) -> Self {
8222 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
8223 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8226 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
8227 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8233 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
8234 /// but with all dynamically-allocated buffers duplicated in new buffers.
8235 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
8237 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8238 /// This corresponds to std::vector in C++
8239 pub struct CVec_UpdateAddHTLCZ {
8240 /// The elements in the array.
8241 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8242 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
8243 /// The number of elements pointed to by `data`.
8246 impl CVec_UpdateAddHTLCZ {
8247 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
8248 if self.datalen == 0 { return Vec::new(); }
8249 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8250 self.data = std::ptr::null_mut();
8254 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
8255 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8258 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
8259 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
8260 let datalen = v.len();
8261 let data = Box::into_raw(v.into_boxed_slice());
8262 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8266 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8267 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
8268 impl Drop for CVec_UpdateAddHTLCZ {
8269 fn drop(&mut self) {
8270 if self.datalen == 0 { return; }
8271 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8274 impl Clone for CVec_UpdateAddHTLCZ {
8275 fn clone(&self) -> Self {
8276 let mut res = Vec::new();
8277 if self.datalen == 0 { return Self::from(res); }
8278 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8283 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8284 /// This corresponds to std::vector in C++
8285 pub struct CVec_UpdateFulfillHTLCZ {
8286 /// The elements in the array.
8287 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8288 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
8289 /// The number of elements pointed to by `data`.
8292 impl CVec_UpdateFulfillHTLCZ {
8293 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8294 if self.datalen == 0 { return Vec::new(); }
8295 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8296 self.data = std::ptr::null_mut();
8300 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8301 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8304 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8305 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8306 let datalen = v.len();
8307 let data = Box::into_raw(v.into_boxed_slice());
8308 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8312 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8313 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8314 impl Drop for CVec_UpdateFulfillHTLCZ {
8315 fn drop(&mut self) {
8316 if self.datalen == 0 { return; }
8317 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8320 impl Clone for CVec_UpdateFulfillHTLCZ {
8321 fn clone(&self) -> Self {
8322 let mut res = Vec::new();
8323 if self.datalen == 0 { return Self::from(res); }
8324 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8329 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8330 /// This corresponds to std::vector in C++
8331 pub struct CVec_UpdateFailHTLCZ {
8332 /// The elements in the array.
8333 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8334 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8335 /// The number of elements pointed to by `data`.
8338 impl CVec_UpdateFailHTLCZ {
8339 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8340 if self.datalen == 0 { return Vec::new(); }
8341 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8342 self.data = std::ptr::null_mut();
8346 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8347 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8350 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8351 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8352 let datalen = v.len();
8353 let data = Box::into_raw(v.into_boxed_slice());
8354 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8358 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8359 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8360 impl Drop for CVec_UpdateFailHTLCZ {
8361 fn drop(&mut self) {
8362 if self.datalen == 0 { return; }
8363 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8366 impl Clone for CVec_UpdateFailHTLCZ {
8367 fn clone(&self) -> Self {
8368 let mut res = Vec::new();
8369 if self.datalen == 0 { return Self::from(res); }
8370 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8375 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8376 /// This corresponds to std::vector in C++
8377 pub struct CVec_UpdateFailMalformedHTLCZ {
8378 /// The elements in the array.
8379 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8380 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8381 /// The number of elements pointed to by `data`.
8384 impl CVec_UpdateFailMalformedHTLCZ {
8385 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8386 if self.datalen == 0 { return Vec::new(); }
8387 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8388 self.data = std::ptr::null_mut();
8392 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8393 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8396 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8397 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8398 let datalen = v.len();
8399 let data = Box::into_raw(v.into_boxed_slice());
8400 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8404 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8405 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8406 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8407 fn drop(&mut self) {
8408 if self.datalen == 0 { return; }
8409 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8412 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8413 fn clone(&self) -> Self {
8414 let mut res = Vec::new();
8415 if self.datalen == 0 { return Self::from(res); }
8416 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8421 /// The contents of CResult_AcceptChannelDecodeErrorZ
8422 pub union CResult_AcceptChannelDecodeErrorZPtr {
8423 /// A pointer to the contents in the success state.
8424 /// Reading from this pointer when `result_ok` is not set is undefined.
8425 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8426 /// A pointer to the contents in the error state.
8427 /// Reading from this pointer when `result_ok` is set is undefined.
8428 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8431 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8432 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8434 pub struct CResult_AcceptChannelDecodeErrorZ {
8435 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8436 /// `err` or `result` depending on the state of `result_ok`.
8437 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8438 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8439 pub result_ok: bool,
8442 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8443 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8444 CResult_AcceptChannelDecodeErrorZ {
8445 contents: CResult_AcceptChannelDecodeErrorZPtr {
8446 result: Box::into_raw(Box::new(o)),
8452 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8453 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8454 CResult_AcceptChannelDecodeErrorZ {
8455 contents: CResult_AcceptChannelDecodeErrorZPtr {
8456 err: Box::into_raw(Box::new(e)),
8462 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8463 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8464 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8465 fn drop(&mut self) {
8467 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8468 let _ = unsafe { Box::from_raw(self.contents.result) };
8471 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8472 let _ = unsafe { Box::from_raw(self.contents.err) };
8477 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8478 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8479 let contents = if o.result_ok {
8480 let result = unsafe { o.contents.result };
8481 unsafe { o.contents.result = std::ptr::null_mut() };
8482 CResult_AcceptChannelDecodeErrorZPtr { result }
8484 let err = unsafe { o.contents.err };
8485 unsafe { o.contents.err = std::ptr::null_mut(); }
8486 CResult_AcceptChannelDecodeErrorZPtr { err }
8490 result_ok: o.result_ok,
8494 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8495 fn clone(&self) -> Self {
8497 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8498 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8501 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8502 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8508 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8509 /// but with all dynamically-allocated buffers duplicated in new buffers.
8510 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
8512 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8513 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8514 /// A pointer to the contents in the success state.
8515 /// Reading from this pointer when `result_ok` is not set is undefined.
8516 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8517 /// A pointer to the contents in the error state.
8518 /// Reading from this pointer when `result_ok` is set is undefined.
8519 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8522 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8523 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8525 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8526 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8527 /// `err` or `result` depending on the state of `result_ok`.
8528 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8529 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8530 pub result_ok: bool,
8533 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8534 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8535 CResult_AnnouncementSignaturesDecodeErrorZ {
8536 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8537 result: Box::into_raw(Box::new(o)),
8543 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8544 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8545 CResult_AnnouncementSignaturesDecodeErrorZ {
8546 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8547 err: Box::into_raw(Box::new(e)),
8553 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8554 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
8555 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
8556 fn drop(&mut self) {
8558 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8559 let _ = unsafe { Box::from_raw(self.contents.result) };
8562 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8563 let _ = unsafe { Box::from_raw(self.contents.err) };
8568 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
8569 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
8570 let contents = if o.result_ok {
8571 let result = unsafe { o.contents.result };
8572 unsafe { o.contents.result = std::ptr::null_mut() };
8573 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
8575 let err = unsafe { o.contents.err };
8576 unsafe { o.contents.err = std::ptr::null_mut(); }
8577 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
8581 result_ok: o.result_ok,
8585 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
8586 fn clone(&self) -> Self {
8588 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8589 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
8592 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8593 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8599 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8600 /// but with all dynamically-allocated buffers duplicated in new buffers.
8601 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
8603 /// The contents of CResult_ChannelReestablishDecodeErrorZ
8604 pub union CResult_ChannelReestablishDecodeErrorZPtr {
8605 /// A pointer to the contents in the success state.
8606 /// Reading from this pointer when `result_ok` is not set is undefined.
8607 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
8608 /// A pointer to the contents in the error state.
8609 /// Reading from this pointer when `result_ok` is set is undefined.
8610 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8613 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8614 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8616 pub struct CResult_ChannelReestablishDecodeErrorZ {
8617 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8618 /// `err` or `result` depending on the state of `result_ok`.
8619 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
8620 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8621 pub result_ok: bool,
8624 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8625 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
8626 CResult_ChannelReestablishDecodeErrorZ {
8627 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8628 result: Box::into_raw(Box::new(o)),
8634 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8635 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
8636 CResult_ChannelReestablishDecodeErrorZ {
8637 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8638 err: Box::into_raw(Box::new(e)),
8644 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8645 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
8646 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
8647 fn drop(&mut self) {
8649 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8650 let _ = unsafe { Box::from_raw(self.contents.result) };
8653 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8654 let _ = unsafe { Box::from_raw(self.contents.err) };
8659 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
8660 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
8661 let contents = if o.result_ok {
8662 let result = unsafe { o.contents.result };
8663 unsafe { o.contents.result = std::ptr::null_mut() };
8664 CResult_ChannelReestablishDecodeErrorZPtr { result }
8666 let err = unsafe { o.contents.err };
8667 unsafe { o.contents.err = std::ptr::null_mut(); }
8668 CResult_ChannelReestablishDecodeErrorZPtr { err }
8672 result_ok: o.result_ok,
8676 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
8677 fn clone(&self) -> Self {
8679 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8680 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
8683 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8684 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8690 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8691 /// but with all dynamically-allocated buffers duplicated in new buffers.
8692 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
8694 /// The contents of CResult_ClosingSignedDecodeErrorZ
8695 pub union CResult_ClosingSignedDecodeErrorZPtr {
8696 /// A pointer to the contents in the success state.
8697 /// Reading from this pointer when `result_ok` is not set is undefined.
8698 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
8699 /// A pointer to the contents in the error state.
8700 /// Reading from this pointer when `result_ok` is set is undefined.
8701 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8704 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8705 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8707 pub struct CResult_ClosingSignedDecodeErrorZ {
8708 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8709 /// `err` or `result` depending on the state of `result_ok`.
8710 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
8711 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8712 pub result_ok: bool,
8715 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8716 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
8717 CResult_ClosingSignedDecodeErrorZ {
8718 contents: CResult_ClosingSignedDecodeErrorZPtr {
8719 result: Box::into_raw(Box::new(o)),
8725 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8726 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
8727 CResult_ClosingSignedDecodeErrorZ {
8728 contents: CResult_ClosingSignedDecodeErrorZPtr {
8729 err: Box::into_raw(Box::new(e)),
8735 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8736 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
8737 impl Drop for CResult_ClosingSignedDecodeErrorZ {
8738 fn drop(&mut self) {
8740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8741 let _ = unsafe { Box::from_raw(self.contents.result) };
8744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8745 let _ = unsafe { Box::from_raw(self.contents.err) };
8750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
8751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8752 let contents = if o.result_ok {
8753 let result = unsafe { o.contents.result };
8754 unsafe { o.contents.result = std::ptr::null_mut() };
8755 CResult_ClosingSignedDecodeErrorZPtr { result }
8757 let err = unsafe { o.contents.err };
8758 unsafe { o.contents.err = std::ptr::null_mut(); }
8759 CResult_ClosingSignedDecodeErrorZPtr { err }
8763 result_ok: o.result_ok,
8767 impl Clone for CResult_ClosingSignedDecodeErrorZ {
8768 fn clone(&self) -> Self {
8770 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
8771 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
8774 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
8775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8781 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8782 /// but with all dynamically-allocated buffers duplicated in new buffers.
8783 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
8785 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
8786 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8787 /// A pointer to the contents in the success state.
8788 /// Reading from this pointer when `result_ok` is not set is undefined.
8789 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
8790 /// A pointer to the contents in the error state.
8791 /// Reading from this pointer when `result_ok` is set is undefined.
8792 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8795 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
8796 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8798 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
8799 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
8800 /// `err` or `result` depending on the state of `result_ok`.
8801 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
8802 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
8803 pub result_ok: bool,
8806 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
8807 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
8808 CResult_ClosingSignedFeeRangeDecodeErrorZ {
8809 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8810 result: Box::into_raw(Box::new(o)),
8816 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
8817 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
8818 CResult_ClosingSignedFeeRangeDecodeErrorZ {
8819 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8820 err: Box::into_raw(Box::new(e)),
8826 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
8827 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
8828 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
8829 fn drop(&mut self) {
8831 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8832 let _ = unsafe { Box::from_raw(self.contents.result) };
8835 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8836 let _ = unsafe { Box::from_raw(self.contents.err) };
8841 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
8842 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8843 let contents = if o.result_ok {
8844 let result = unsafe { o.contents.result };
8845 unsafe { o.contents.result = std::ptr::null_mut() };
8846 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
8848 let err = unsafe { o.contents.err };
8849 unsafe { o.contents.err = std::ptr::null_mut(); }
8850 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
8854 result_ok: o.result_ok,
8858 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
8859 fn clone(&self) -> Self {
8861 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8862 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
8865 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8866 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8872 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
8873 /// but with all dynamically-allocated buffers duplicated in new buffers.
8874 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { orig.clone() }
8876 /// The contents of CResult_CommitmentSignedDecodeErrorZ
8877 pub union CResult_CommitmentSignedDecodeErrorZPtr {
8878 /// A pointer to the contents in the success state.
8879 /// Reading from this pointer when `result_ok` is not set is undefined.
8880 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
8881 /// A pointer to the contents in the error state.
8882 /// Reading from this pointer when `result_ok` is set is undefined.
8883 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8886 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8887 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8889 pub struct CResult_CommitmentSignedDecodeErrorZ {
8890 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8891 /// `err` or `result` depending on the state of `result_ok`.
8892 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
8893 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8894 pub result_ok: bool,
8897 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8898 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
8899 CResult_CommitmentSignedDecodeErrorZ {
8900 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8901 result: Box::into_raw(Box::new(o)),
8907 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8908 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
8909 CResult_CommitmentSignedDecodeErrorZ {
8910 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8911 err: Box::into_raw(Box::new(e)),
8917 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8918 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
8919 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
8920 fn drop(&mut self) {
8922 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8923 let _ = unsafe { Box::from_raw(self.contents.result) };
8926 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8927 let _ = unsafe { Box::from_raw(self.contents.err) };
8932 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
8933 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8934 let contents = if o.result_ok {
8935 let result = unsafe { o.contents.result };
8936 unsafe { o.contents.result = std::ptr::null_mut() };
8937 CResult_CommitmentSignedDecodeErrorZPtr { result }
8939 let err = unsafe { o.contents.err };
8940 unsafe { o.contents.err = std::ptr::null_mut(); }
8941 CResult_CommitmentSignedDecodeErrorZPtr { err }
8945 result_ok: o.result_ok,
8949 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
8950 fn clone(&self) -> Self {
8952 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8953 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
8956 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8957 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8963 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8964 /// but with all dynamically-allocated buffers duplicated in new buffers.
8965 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
8967 /// The contents of CResult_FundingCreatedDecodeErrorZ
8968 pub union CResult_FundingCreatedDecodeErrorZPtr {
8969 /// A pointer to the contents in the success state.
8970 /// Reading from this pointer when `result_ok` is not set is undefined.
8971 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
8972 /// A pointer to the contents in the error state.
8973 /// Reading from this pointer when `result_ok` is set is undefined.
8974 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8977 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8978 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8980 pub struct CResult_FundingCreatedDecodeErrorZ {
8981 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8982 /// `err` or `result` depending on the state of `result_ok`.
8983 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
8984 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8985 pub result_ok: bool,
8988 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8989 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
8990 CResult_FundingCreatedDecodeErrorZ {
8991 contents: CResult_FundingCreatedDecodeErrorZPtr {
8992 result: Box::into_raw(Box::new(o)),
8998 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8999 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
9000 CResult_FundingCreatedDecodeErrorZ {
9001 contents: CResult_FundingCreatedDecodeErrorZPtr {
9002 err: Box::into_raw(Box::new(e)),
9008 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
9009 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
9010 impl Drop for CResult_FundingCreatedDecodeErrorZ {
9011 fn drop(&mut self) {
9013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9014 let _ = unsafe { Box::from_raw(self.contents.result) };
9017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9018 let _ = unsafe { Box::from_raw(self.contents.err) };
9023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
9024 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
9025 let contents = if o.result_ok {
9026 let result = unsafe { o.contents.result };
9027 unsafe { o.contents.result = std::ptr::null_mut() };
9028 CResult_FundingCreatedDecodeErrorZPtr { result }
9030 let err = unsafe { o.contents.err };
9031 unsafe { o.contents.err = std::ptr::null_mut(); }
9032 CResult_FundingCreatedDecodeErrorZPtr { err }
9036 result_ok: o.result_ok,
9040 impl Clone for CResult_FundingCreatedDecodeErrorZ {
9041 fn clone(&self) -> Self {
9043 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
9044 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
9047 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
9048 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9054 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
9055 /// but with all dynamically-allocated buffers duplicated in new buffers.
9056 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
9058 /// The contents of CResult_FundingSignedDecodeErrorZ
9059 pub union CResult_FundingSignedDecodeErrorZPtr {
9060 /// A pointer to the contents in the success state.
9061 /// Reading from this pointer when `result_ok` is not set is undefined.
9062 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
9063 /// A pointer to the contents in the error state.
9064 /// Reading from this pointer when `result_ok` is set is undefined.
9065 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9068 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9069 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9071 pub struct CResult_FundingSignedDecodeErrorZ {
9072 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9073 /// `err` or `result` depending on the state of `result_ok`.
9074 pub contents: CResult_FundingSignedDecodeErrorZPtr,
9075 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9076 pub result_ok: bool,
9079 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
9080 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
9081 CResult_FundingSignedDecodeErrorZ {
9082 contents: CResult_FundingSignedDecodeErrorZPtr {
9083 result: Box::into_raw(Box::new(o)),
9089 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
9090 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
9091 CResult_FundingSignedDecodeErrorZ {
9092 contents: CResult_FundingSignedDecodeErrorZPtr {
9093 err: Box::into_raw(Box::new(e)),
9099 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
9100 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
9101 impl Drop for CResult_FundingSignedDecodeErrorZ {
9102 fn drop(&mut self) {
9104 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9105 let _ = unsafe { Box::from_raw(self.contents.result) };
9108 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9109 let _ = unsafe { Box::from_raw(self.contents.err) };
9114 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
9115 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9116 let contents = if o.result_ok {
9117 let result = unsafe { o.contents.result };
9118 unsafe { o.contents.result = std::ptr::null_mut() };
9119 CResult_FundingSignedDecodeErrorZPtr { result }
9121 let err = unsafe { o.contents.err };
9122 unsafe { o.contents.err = std::ptr::null_mut(); }
9123 CResult_FundingSignedDecodeErrorZPtr { err }
9127 result_ok: o.result_ok,
9131 impl Clone for CResult_FundingSignedDecodeErrorZ {
9132 fn clone(&self) -> Self {
9134 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
9135 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
9138 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
9139 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9145 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
9146 /// but with all dynamically-allocated buffers duplicated in new buffers.
9147 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
9149 /// The contents of CResult_FundingLockedDecodeErrorZ
9150 pub union CResult_FundingLockedDecodeErrorZPtr {
9151 /// A pointer to the contents in the success state.
9152 /// Reading from this pointer when `result_ok` is not set is undefined.
9153 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
9154 /// A pointer to the contents in the error state.
9155 /// Reading from this pointer when `result_ok` is set is undefined.
9156 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9159 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9160 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9162 pub struct CResult_FundingLockedDecodeErrorZ {
9163 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9164 /// `err` or `result` depending on the state of `result_ok`.
9165 pub contents: CResult_FundingLockedDecodeErrorZPtr,
9166 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9167 pub result_ok: bool,
9170 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
9171 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
9172 CResult_FundingLockedDecodeErrorZ {
9173 contents: CResult_FundingLockedDecodeErrorZPtr {
9174 result: Box::into_raw(Box::new(o)),
9180 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
9181 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
9182 CResult_FundingLockedDecodeErrorZ {
9183 contents: CResult_FundingLockedDecodeErrorZPtr {
9184 err: Box::into_raw(Box::new(e)),
9190 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
9191 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
9192 impl Drop for CResult_FundingLockedDecodeErrorZ {
9193 fn drop(&mut self) {
9195 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9196 let _ = unsafe { Box::from_raw(self.contents.result) };
9199 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9200 let _ = unsafe { Box::from_raw(self.contents.err) };
9205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
9206 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
9207 let contents = if o.result_ok {
9208 let result = unsafe { o.contents.result };
9209 unsafe { o.contents.result = std::ptr::null_mut() };
9210 CResult_FundingLockedDecodeErrorZPtr { result }
9212 let err = unsafe { o.contents.err };
9213 unsafe { o.contents.err = std::ptr::null_mut(); }
9214 CResult_FundingLockedDecodeErrorZPtr { err }
9218 result_ok: o.result_ok,
9222 impl Clone for CResult_FundingLockedDecodeErrorZ {
9223 fn clone(&self) -> Self {
9225 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
9226 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
9229 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
9230 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9236 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
9237 /// but with all dynamically-allocated buffers duplicated in new buffers.
9238 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
9240 /// The contents of CResult_InitDecodeErrorZ
9241 pub union CResult_InitDecodeErrorZPtr {
9242 /// A pointer to the contents in the success state.
9243 /// Reading from this pointer when `result_ok` is not set is undefined.
9244 pub result: *mut crate::lightning::ln::msgs::Init,
9245 /// A pointer to the contents in the error state.
9246 /// Reading from this pointer when `result_ok` is set is undefined.
9247 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9250 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9251 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9253 pub struct CResult_InitDecodeErrorZ {
9254 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
9255 /// `err` or `result` depending on the state of `result_ok`.
9256 pub contents: CResult_InitDecodeErrorZPtr,
9257 /// Whether this CResult_InitDecodeErrorZ represents a success state.
9258 pub result_ok: bool,
9261 /// Creates a new CResult_InitDecodeErrorZ in the success state.
9262 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
9263 CResult_InitDecodeErrorZ {
9264 contents: CResult_InitDecodeErrorZPtr {
9265 result: Box::into_raw(Box::new(o)),
9271 /// Creates a new CResult_InitDecodeErrorZ in the error state.
9272 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
9273 CResult_InitDecodeErrorZ {
9274 contents: CResult_InitDecodeErrorZPtr {
9275 err: Box::into_raw(Box::new(e)),
9281 /// Frees any resources used by the CResult_InitDecodeErrorZ.
9282 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
9283 impl Drop for CResult_InitDecodeErrorZ {
9284 fn drop(&mut self) {
9286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9287 let _ = unsafe { Box::from_raw(self.contents.result) };
9290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9291 let _ = unsafe { Box::from_raw(self.contents.err) };
9296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
9297 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
9298 let contents = if o.result_ok {
9299 let result = unsafe { o.contents.result };
9300 unsafe { o.contents.result = std::ptr::null_mut() };
9301 CResult_InitDecodeErrorZPtr { result }
9303 let err = unsafe { o.contents.err };
9304 unsafe { o.contents.err = std::ptr::null_mut(); }
9305 CResult_InitDecodeErrorZPtr { err }
9309 result_ok: o.result_ok,
9313 impl Clone for CResult_InitDecodeErrorZ {
9314 fn clone(&self) -> Self {
9316 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
9317 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
9320 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
9321 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9327 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
9328 /// but with all dynamically-allocated buffers duplicated in new buffers.
9329 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
9331 /// The contents of CResult_OpenChannelDecodeErrorZ
9332 pub union CResult_OpenChannelDecodeErrorZPtr {
9333 /// A pointer to the contents in the success state.
9334 /// Reading from this pointer when `result_ok` is not set is undefined.
9335 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
9336 /// A pointer to the contents in the error state.
9337 /// Reading from this pointer when `result_ok` is set is undefined.
9338 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9341 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9342 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9344 pub struct CResult_OpenChannelDecodeErrorZ {
9345 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9346 /// `err` or `result` depending on the state of `result_ok`.
9347 pub contents: CResult_OpenChannelDecodeErrorZPtr,
9348 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9349 pub result_ok: bool,
9352 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9353 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
9354 CResult_OpenChannelDecodeErrorZ {
9355 contents: CResult_OpenChannelDecodeErrorZPtr {
9356 result: Box::into_raw(Box::new(o)),
9362 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9363 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
9364 CResult_OpenChannelDecodeErrorZ {
9365 contents: CResult_OpenChannelDecodeErrorZPtr {
9366 err: Box::into_raw(Box::new(e)),
9372 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9373 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
9374 impl Drop for CResult_OpenChannelDecodeErrorZ {
9375 fn drop(&mut self) {
9377 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9378 let _ = unsafe { Box::from_raw(self.contents.result) };
9381 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9382 let _ = unsafe { Box::from_raw(self.contents.err) };
9387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9388 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9389 let contents = if o.result_ok {
9390 let result = unsafe { o.contents.result };
9391 unsafe { o.contents.result = std::ptr::null_mut() };
9392 CResult_OpenChannelDecodeErrorZPtr { result }
9394 let err = unsafe { o.contents.err };
9395 unsafe { o.contents.err = std::ptr::null_mut(); }
9396 CResult_OpenChannelDecodeErrorZPtr { err }
9400 result_ok: o.result_ok,
9404 impl Clone for CResult_OpenChannelDecodeErrorZ {
9405 fn clone(&self) -> Self {
9407 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9408 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9411 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9412 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9418 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9419 /// but with all dynamically-allocated buffers duplicated in new buffers.
9420 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
9422 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9423 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9424 /// A pointer to the contents in the success state.
9425 /// Reading from this pointer when `result_ok` is not set is undefined.
9426 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9427 /// A pointer to the contents in the error state.
9428 /// Reading from this pointer when `result_ok` is set is undefined.
9429 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9432 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9433 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9435 pub struct CResult_RevokeAndACKDecodeErrorZ {
9436 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9437 /// `err` or `result` depending on the state of `result_ok`.
9438 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9439 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9440 pub result_ok: bool,
9443 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9444 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9445 CResult_RevokeAndACKDecodeErrorZ {
9446 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9447 result: Box::into_raw(Box::new(o)),
9453 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9454 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9455 CResult_RevokeAndACKDecodeErrorZ {
9456 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9457 err: Box::into_raw(Box::new(e)),
9463 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9464 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9465 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9466 fn drop(&mut self) {
9468 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9469 let _ = unsafe { Box::from_raw(self.contents.result) };
9472 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9473 let _ = unsafe { Box::from_raw(self.contents.err) };
9478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9479 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9480 let contents = if o.result_ok {
9481 let result = unsafe { o.contents.result };
9482 unsafe { o.contents.result = std::ptr::null_mut() };
9483 CResult_RevokeAndACKDecodeErrorZPtr { result }
9485 let err = unsafe { o.contents.err };
9486 unsafe { o.contents.err = std::ptr::null_mut(); }
9487 CResult_RevokeAndACKDecodeErrorZPtr { err }
9491 result_ok: o.result_ok,
9495 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9496 fn clone(&self) -> Self {
9498 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9499 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9502 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9503 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9509 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9510 /// but with all dynamically-allocated buffers duplicated in new buffers.
9511 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
9513 /// The contents of CResult_ShutdownDecodeErrorZ
9514 pub union CResult_ShutdownDecodeErrorZPtr {
9515 /// A pointer to the contents in the success state.
9516 /// Reading from this pointer when `result_ok` is not set is undefined.
9517 pub result: *mut crate::lightning::ln::msgs::Shutdown,
9518 /// A pointer to the contents in the error state.
9519 /// Reading from this pointer when `result_ok` is set is undefined.
9520 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9523 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9524 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9526 pub struct CResult_ShutdownDecodeErrorZ {
9527 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9528 /// `err` or `result` depending on the state of `result_ok`.
9529 pub contents: CResult_ShutdownDecodeErrorZPtr,
9530 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9531 pub result_ok: bool,
9534 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9535 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9536 CResult_ShutdownDecodeErrorZ {
9537 contents: CResult_ShutdownDecodeErrorZPtr {
9538 result: Box::into_raw(Box::new(o)),
9544 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9545 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
9546 CResult_ShutdownDecodeErrorZ {
9547 contents: CResult_ShutdownDecodeErrorZPtr {
9548 err: Box::into_raw(Box::new(e)),
9554 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9555 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
9556 impl Drop for CResult_ShutdownDecodeErrorZ {
9557 fn drop(&mut self) {
9559 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9560 let _ = unsafe { Box::from_raw(self.contents.result) };
9563 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9564 let _ = unsafe { Box::from_raw(self.contents.err) };
9569 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
9570 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
9571 let contents = if o.result_ok {
9572 let result = unsafe { o.contents.result };
9573 unsafe { o.contents.result = std::ptr::null_mut() };
9574 CResult_ShutdownDecodeErrorZPtr { result }
9576 let err = unsafe { o.contents.err };
9577 unsafe { o.contents.err = std::ptr::null_mut(); }
9578 CResult_ShutdownDecodeErrorZPtr { err }
9582 result_ok: o.result_ok,
9586 impl Clone for CResult_ShutdownDecodeErrorZ {
9587 fn clone(&self) -> Self {
9589 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
9590 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
9593 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
9594 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9600 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9601 /// but with all dynamically-allocated buffers duplicated in new buffers.
9602 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
9604 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
9605 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
9606 /// A pointer to the contents in the success state.
9607 /// Reading from this pointer when `result_ok` is not set is undefined.
9608 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9609 /// A pointer to the contents in the error state.
9610 /// Reading from this pointer when `result_ok` is set is undefined.
9611 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9614 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9615 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9617 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
9618 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9619 /// `err` or `result` depending on the state of `result_ok`.
9620 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
9621 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9622 pub result_ok: bool,
9625 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9626 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
9627 CResult_UpdateFailHTLCDecodeErrorZ {
9628 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9629 result: Box::into_raw(Box::new(o)),
9635 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9636 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
9637 CResult_UpdateFailHTLCDecodeErrorZ {
9638 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9639 err: Box::into_raw(Box::new(e)),
9645 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9646 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
9647 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
9648 fn drop(&mut self) {
9650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9651 let _ = unsafe { Box::from_raw(self.contents.result) };
9654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9655 let _ = unsafe { Box::from_raw(self.contents.err) };
9660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
9661 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9662 let contents = if o.result_ok {
9663 let result = unsafe { o.contents.result };
9664 unsafe { o.contents.result = std::ptr::null_mut() };
9665 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
9667 let err = unsafe { o.contents.err };
9668 unsafe { o.contents.err = std::ptr::null_mut(); }
9669 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
9673 result_ok: o.result_ok,
9677 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
9678 fn clone(&self) -> Self {
9680 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9681 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
9684 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9685 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9691 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9692 /// but with all dynamically-allocated buffers duplicated in new buffers.
9693 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
9695 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9696 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9697 /// A pointer to the contents in the success state.
9698 /// Reading from this pointer when `result_ok` is not set is undefined.
9699 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9700 /// A pointer to the contents in the error state.
9701 /// Reading from this pointer when `result_ok` is set is undefined.
9702 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9705 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9706 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9708 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9709 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9710 /// `err` or `result` depending on the state of `result_ok`.
9711 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
9712 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9713 pub result_ok: bool,
9716 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9717 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9718 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9719 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9720 result: Box::into_raw(Box::new(o)),
9726 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9727 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9728 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9729 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9730 err: Box::into_raw(Box::new(e)),
9736 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9737 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
9738 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9739 fn drop(&mut self) {
9741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9742 let _ = unsafe { Box::from_raw(self.contents.result) };
9745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9746 let _ = unsafe { Box::from_raw(self.contents.err) };
9751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9753 let contents = if o.result_ok {
9754 let result = unsafe { o.contents.result };
9755 unsafe { o.contents.result = std::ptr::null_mut() };
9756 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
9758 let err = unsafe { o.contents.err };
9759 unsafe { o.contents.err = std::ptr::null_mut(); }
9760 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
9764 result_ok: o.result_ok,
9768 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9769 fn clone(&self) -> Self {
9771 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9772 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
9775 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9776 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9782 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9783 /// but with all dynamically-allocated buffers duplicated in new buffers.
9784 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
9786 /// The contents of CResult_UpdateFeeDecodeErrorZ
9787 pub union CResult_UpdateFeeDecodeErrorZPtr {
9788 /// A pointer to the contents in the success state.
9789 /// Reading from this pointer when `result_ok` is not set is undefined.
9790 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
9791 /// A pointer to the contents in the error state.
9792 /// Reading from this pointer when `result_ok` is set is undefined.
9793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9796 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9797 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9799 pub struct CResult_UpdateFeeDecodeErrorZ {
9800 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9801 /// `err` or `result` depending on the state of `result_ok`.
9802 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
9803 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9804 pub result_ok: bool,
9807 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9808 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
9809 CResult_UpdateFeeDecodeErrorZ {
9810 contents: CResult_UpdateFeeDecodeErrorZPtr {
9811 result: Box::into_raw(Box::new(o)),
9817 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9818 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
9819 CResult_UpdateFeeDecodeErrorZ {
9820 contents: CResult_UpdateFeeDecodeErrorZPtr {
9821 err: Box::into_raw(Box::new(e)),
9827 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9828 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
9829 impl Drop for CResult_UpdateFeeDecodeErrorZ {
9830 fn drop(&mut self) {
9832 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9833 let _ = unsafe { Box::from_raw(self.contents.result) };
9836 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9837 let _ = unsafe { Box::from_raw(self.contents.err) };
9842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
9843 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
9844 let contents = if o.result_ok {
9845 let result = unsafe { o.contents.result };
9846 unsafe { o.contents.result = std::ptr::null_mut() };
9847 CResult_UpdateFeeDecodeErrorZPtr { result }
9849 let err = unsafe { o.contents.err };
9850 unsafe { o.contents.err = std::ptr::null_mut(); }
9851 CResult_UpdateFeeDecodeErrorZPtr { err }
9855 result_ok: o.result_ok,
9859 impl Clone for CResult_UpdateFeeDecodeErrorZ {
9860 fn clone(&self) -> Self {
9862 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
9863 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
9866 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
9867 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9873 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9874 /// but with all dynamically-allocated buffers duplicated in new buffers.
9875 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
9877 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9878 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9879 /// A pointer to the contents in the success state.
9880 /// Reading from this pointer when `result_ok` is not set is undefined.
9881 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9882 /// A pointer to the contents in the error state.
9883 /// Reading from this pointer when `result_ok` is set is undefined.
9884 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9887 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9888 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9890 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
9891 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9892 /// `err` or `result` depending on the state of `result_ok`.
9893 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
9894 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9895 pub result_ok: bool,
9898 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9899 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9900 CResult_UpdateFulfillHTLCDecodeErrorZ {
9901 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9902 result: Box::into_raw(Box::new(o)),
9908 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9909 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9910 CResult_UpdateFulfillHTLCDecodeErrorZ {
9911 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9912 err: Box::into_raw(Box::new(e)),
9918 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9919 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
9920 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
9921 fn drop(&mut self) {
9923 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9924 let _ = unsafe { Box::from_raw(self.contents.result) };
9927 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9928 let _ = unsafe { Box::from_raw(self.contents.err) };
9933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
9934 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9935 let contents = if o.result_ok {
9936 let result = unsafe { o.contents.result };
9937 unsafe { o.contents.result = std::ptr::null_mut() };
9938 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
9940 let err = unsafe { o.contents.err };
9941 unsafe { o.contents.err = std::ptr::null_mut(); }
9942 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
9946 result_ok: o.result_ok,
9950 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
9951 fn clone(&self) -> Self {
9953 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9954 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
9957 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9958 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9964 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9965 /// but with all dynamically-allocated buffers duplicated in new buffers.
9966 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
9968 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
9969 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
9970 /// A pointer to the contents in the success state.
9971 /// Reading from this pointer when `result_ok` is not set is undefined.
9972 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9973 /// A pointer to the contents in the error state.
9974 /// Reading from this pointer when `result_ok` is set is undefined.
9975 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9978 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9979 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9981 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
9982 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9983 /// `err` or `result` depending on the state of `result_ok`.
9984 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
9985 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9986 pub result_ok: bool,
9989 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9990 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
9991 CResult_UpdateAddHTLCDecodeErrorZ {
9992 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9993 result: Box::into_raw(Box::new(o)),
9999 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10000 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
10001 CResult_UpdateAddHTLCDecodeErrorZ {
10002 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10003 err: Box::into_raw(Box::new(e)),
10009 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10010 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
10011 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
10012 fn drop(&mut self) {
10013 if self.result_ok {
10014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10015 let _ = unsafe { Box::from_raw(self.contents.result) };
10018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10019 let _ = unsafe { Box::from_raw(self.contents.err) };
10024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
10025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10026 let contents = if o.result_ok {
10027 let result = unsafe { o.contents.result };
10028 unsafe { o.contents.result = std::ptr::null_mut() };
10029 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
10031 let err = unsafe { o.contents.err };
10032 unsafe { o.contents.err = std::ptr::null_mut(); }
10033 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
10037 result_ok: o.result_ok,
10041 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
10042 fn clone(&self) -> Self {
10043 if self.result_ok {
10044 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10045 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
10048 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10049 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10055 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10056 /// but with all dynamically-allocated buffers duplicated in new buffers.
10057 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
10059 /// The contents of CResult_PingDecodeErrorZ
10060 pub union CResult_PingDecodeErrorZPtr {
10061 /// A pointer to the contents in the success state.
10062 /// Reading from this pointer when `result_ok` is not set is undefined.
10063 pub result: *mut crate::lightning::ln::msgs::Ping,
10064 /// A pointer to the contents in the error state.
10065 /// Reading from this pointer when `result_ok` is set is undefined.
10066 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10069 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10070 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10072 pub struct CResult_PingDecodeErrorZ {
10073 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
10074 /// `err` or `result` depending on the state of `result_ok`.
10075 pub contents: CResult_PingDecodeErrorZPtr,
10076 /// Whether this CResult_PingDecodeErrorZ represents a success state.
10077 pub result_ok: bool,
10080 /// Creates a new CResult_PingDecodeErrorZ in the success state.
10081 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
10082 CResult_PingDecodeErrorZ {
10083 contents: CResult_PingDecodeErrorZPtr {
10084 result: Box::into_raw(Box::new(o)),
10090 /// Creates a new CResult_PingDecodeErrorZ in the error state.
10091 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
10092 CResult_PingDecodeErrorZ {
10093 contents: CResult_PingDecodeErrorZPtr {
10094 err: Box::into_raw(Box::new(e)),
10100 /// Frees any resources used by the CResult_PingDecodeErrorZ.
10101 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
10102 impl Drop for CResult_PingDecodeErrorZ {
10103 fn drop(&mut self) {
10104 if self.result_ok {
10105 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10106 let _ = unsafe { Box::from_raw(self.contents.result) };
10109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10110 let _ = unsafe { Box::from_raw(self.contents.err) };
10115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
10116 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
10117 let contents = if o.result_ok {
10118 let result = unsafe { o.contents.result };
10119 unsafe { o.contents.result = std::ptr::null_mut() };
10120 CResult_PingDecodeErrorZPtr { result }
10122 let err = unsafe { o.contents.err };
10123 unsafe { o.contents.err = std::ptr::null_mut(); }
10124 CResult_PingDecodeErrorZPtr { err }
10128 result_ok: o.result_ok,
10132 impl Clone for CResult_PingDecodeErrorZ {
10133 fn clone(&self) -> Self {
10134 if self.result_ok {
10135 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
10136 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
10139 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
10140 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10146 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10147 /// but with all dynamically-allocated buffers duplicated in new buffers.
10148 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
10150 /// The contents of CResult_PongDecodeErrorZ
10151 pub union CResult_PongDecodeErrorZPtr {
10152 /// A pointer to the contents in the success state.
10153 /// Reading from this pointer when `result_ok` is not set is undefined.
10154 pub result: *mut crate::lightning::ln::msgs::Pong,
10155 /// A pointer to the contents in the error state.
10156 /// Reading from this pointer when `result_ok` is set is undefined.
10157 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10160 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10161 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10163 pub struct CResult_PongDecodeErrorZ {
10164 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
10165 /// `err` or `result` depending on the state of `result_ok`.
10166 pub contents: CResult_PongDecodeErrorZPtr,
10167 /// Whether this CResult_PongDecodeErrorZ represents a success state.
10168 pub result_ok: bool,
10171 /// Creates a new CResult_PongDecodeErrorZ in the success state.
10172 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
10173 CResult_PongDecodeErrorZ {
10174 contents: CResult_PongDecodeErrorZPtr {
10175 result: Box::into_raw(Box::new(o)),
10181 /// Creates a new CResult_PongDecodeErrorZ in the error state.
10182 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
10183 CResult_PongDecodeErrorZ {
10184 contents: CResult_PongDecodeErrorZPtr {
10185 err: Box::into_raw(Box::new(e)),
10191 /// Frees any resources used by the CResult_PongDecodeErrorZ.
10192 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
10193 impl Drop for CResult_PongDecodeErrorZ {
10194 fn drop(&mut self) {
10195 if self.result_ok {
10196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10197 let _ = unsafe { Box::from_raw(self.contents.result) };
10200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10201 let _ = unsafe { Box::from_raw(self.contents.err) };
10206 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
10207 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
10208 let contents = if o.result_ok {
10209 let result = unsafe { o.contents.result };
10210 unsafe { o.contents.result = std::ptr::null_mut() };
10211 CResult_PongDecodeErrorZPtr { result }
10213 let err = unsafe { o.contents.err };
10214 unsafe { o.contents.err = std::ptr::null_mut(); }
10215 CResult_PongDecodeErrorZPtr { err }
10219 result_ok: o.result_ok,
10223 impl Clone for CResult_PongDecodeErrorZ {
10224 fn clone(&self) -> Self {
10225 if self.result_ok {
10226 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
10227 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
10230 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
10231 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10237 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10238 /// but with all dynamically-allocated buffers duplicated in new buffers.
10239 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
10241 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10242 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10243 /// A pointer to the contents in the success state.
10244 /// Reading from this pointer when `result_ok` is not set is undefined.
10245 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
10246 /// A pointer to the contents in the error state.
10247 /// Reading from this pointer when `result_ok` is set is undefined.
10248 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10251 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10252 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10254 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10255 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10256 /// `err` or `result` depending on the state of `result_ok`.
10257 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
10258 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10259 pub result_ok: bool,
10262 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10263 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10264 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10265 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10266 result: Box::into_raw(Box::new(o)),
10272 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10273 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10274 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10275 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10276 err: Box::into_raw(Box::new(e)),
10282 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10283 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
10284 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10285 fn drop(&mut self) {
10286 if self.result_ok {
10287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10288 let _ = unsafe { Box::from_raw(self.contents.result) };
10291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10292 let _ = unsafe { Box::from_raw(self.contents.err) };
10297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10298 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10299 let contents = if o.result_ok {
10300 let result = unsafe { o.contents.result };
10301 unsafe { o.contents.result = std::ptr::null_mut() };
10302 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
10304 let err = unsafe { o.contents.err };
10305 unsafe { o.contents.err = std::ptr::null_mut(); }
10306 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
10310 result_ok: o.result_ok,
10314 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10315 fn clone(&self) -> Self {
10316 if self.result_ok {
10317 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10318 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10321 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10322 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10328 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10329 /// but with all dynamically-allocated buffers duplicated in new buffers.
10330 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
10332 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
10333 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
10334 /// A pointer to the contents in the success state.
10335 /// Reading from this pointer when `result_ok` is not set is undefined.
10336 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
10337 /// A pointer to the contents in the error state.
10338 /// Reading from this pointer when `result_ok` is set is undefined.
10339 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10342 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10343 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10345 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
10346 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10347 /// `err` or `result` depending on the state of `result_ok`.
10348 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
10349 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10350 pub result_ok: bool,
10353 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10354 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
10355 CResult_ChannelAnnouncementDecodeErrorZ {
10356 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10357 result: Box::into_raw(Box::new(o)),
10363 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10364 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
10365 CResult_ChannelAnnouncementDecodeErrorZ {
10366 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10367 err: Box::into_raw(Box::new(e)),
10373 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10374 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
10375 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
10376 fn drop(&mut self) {
10377 if self.result_ok {
10378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10379 let _ = unsafe { Box::from_raw(self.contents.result) };
10382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10383 let _ = unsafe { Box::from_raw(self.contents.err) };
10388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10389 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10390 let contents = if o.result_ok {
10391 let result = unsafe { o.contents.result };
10392 unsafe { o.contents.result = std::ptr::null_mut() };
10393 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10395 let err = unsafe { o.contents.err };
10396 unsafe { o.contents.err = std::ptr::null_mut(); }
10397 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10401 result_ok: o.result_ok,
10405 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10406 fn clone(&self) -> Self {
10407 if self.result_ok {
10408 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10409 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10412 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10413 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10419 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10420 /// but with all dynamically-allocated buffers duplicated in new buffers.
10421 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
10423 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10424 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10425 /// A pointer to the contents in the success state.
10426 /// Reading from this pointer when `result_ok` is not set is undefined.
10427 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10428 /// A pointer to the contents in the error state.
10429 /// Reading from this pointer when `result_ok` is set is undefined.
10430 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10433 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10434 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10436 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10437 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10438 /// `err` or `result` depending on the state of `result_ok`.
10439 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10440 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10441 pub result_ok: bool,
10444 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10445 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10446 CResult_UnsignedChannelUpdateDecodeErrorZ {
10447 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10448 result: Box::into_raw(Box::new(o)),
10454 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10455 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10456 CResult_UnsignedChannelUpdateDecodeErrorZ {
10457 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10458 err: Box::into_raw(Box::new(e)),
10464 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10465 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10466 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10467 fn drop(&mut self) {
10468 if self.result_ok {
10469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10470 let _ = unsafe { Box::from_raw(self.contents.result) };
10473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10474 let _ = unsafe { Box::from_raw(self.contents.err) };
10479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10481 let contents = if o.result_ok {
10482 let result = unsafe { o.contents.result };
10483 unsafe { o.contents.result = std::ptr::null_mut() };
10484 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10486 let err = unsafe { o.contents.err };
10487 unsafe { o.contents.err = std::ptr::null_mut(); }
10488 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10492 result_ok: o.result_ok,
10496 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10497 fn clone(&self) -> Self {
10498 if self.result_ok {
10499 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10500 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10503 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10504 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10510 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10511 /// but with all dynamically-allocated buffers duplicated in new buffers.
10512 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
10514 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10515 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10516 /// A pointer to the contents in the success state.
10517 /// Reading from this pointer when `result_ok` is not set is undefined.
10518 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10519 /// A pointer to the contents in the error state.
10520 /// Reading from this pointer when `result_ok` is set is undefined.
10521 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10524 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10525 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10527 pub struct CResult_ChannelUpdateDecodeErrorZ {
10528 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10529 /// `err` or `result` depending on the state of `result_ok`.
10530 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10531 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10532 pub result_ok: bool,
10535 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10536 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10537 CResult_ChannelUpdateDecodeErrorZ {
10538 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10539 result: Box::into_raw(Box::new(o)),
10545 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10546 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
10547 CResult_ChannelUpdateDecodeErrorZ {
10548 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10549 err: Box::into_raw(Box::new(e)),
10555 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10556 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
10557 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
10558 fn drop(&mut self) {
10559 if self.result_ok {
10560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10561 let _ = unsafe { Box::from_raw(self.contents.result) };
10564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10565 let _ = unsafe { Box::from_raw(self.contents.err) };
10570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
10571 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10572 let contents = if o.result_ok {
10573 let result = unsafe { o.contents.result };
10574 unsafe { o.contents.result = std::ptr::null_mut() };
10575 CResult_ChannelUpdateDecodeErrorZPtr { result }
10577 let err = unsafe { o.contents.err };
10578 unsafe { o.contents.err = std::ptr::null_mut(); }
10579 CResult_ChannelUpdateDecodeErrorZPtr { err }
10583 result_ok: o.result_ok,
10587 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
10588 fn clone(&self) -> Self {
10589 if self.result_ok {
10590 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10591 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
10594 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10595 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10601 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10602 /// but with all dynamically-allocated buffers duplicated in new buffers.
10603 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
10605 /// The contents of CResult_ErrorMessageDecodeErrorZ
10606 pub union CResult_ErrorMessageDecodeErrorZPtr {
10607 /// A pointer to the contents in the success state.
10608 /// Reading from this pointer when `result_ok` is not set is undefined.
10609 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
10610 /// A pointer to the contents in the error state.
10611 /// Reading from this pointer when `result_ok` is set is undefined.
10612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10615 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10616 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10618 pub struct CResult_ErrorMessageDecodeErrorZ {
10619 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10620 /// `err` or `result` depending on the state of `result_ok`.
10621 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
10622 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10623 pub result_ok: bool,
10626 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10627 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
10628 CResult_ErrorMessageDecodeErrorZ {
10629 contents: CResult_ErrorMessageDecodeErrorZPtr {
10630 result: Box::into_raw(Box::new(o)),
10636 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10637 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
10638 CResult_ErrorMessageDecodeErrorZ {
10639 contents: CResult_ErrorMessageDecodeErrorZPtr {
10640 err: Box::into_raw(Box::new(e)),
10646 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10647 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
10648 impl Drop for CResult_ErrorMessageDecodeErrorZ {
10649 fn drop(&mut self) {
10650 if self.result_ok {
10651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10652 let _ = unsafe { Box::from_raw(self.contents.result) };
10655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10656 let _ = unsafe { Box::from_raw(self.contents.err) };
10661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
10662 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
10663 let contents = if o.result_ok {
10664 let result = unsafe { o.contents.result };
10665 unsafe { o.contents.result = std::ptr::null_mut() };
10666 CResult_ErrorMessageDecodeErrorZPtr { result }
10668 let err = unsafe { o.contents.err };
10669 unsafe { o.contents.err = std::ptr::null_mut(); }
10670 CResult_ErrorMessageDecodeErrorZPtr { err }
10674 result_ok: o.result_ok,
10678 impl Clone for CResult_ErrorMessageDecodeErrorZ {
10679 fn clone(&self) -> Self {
10680 if self.result_ok {
10681 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
10682 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
10685 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
10686 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10692 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10693 /// but with all dynamically-allocated buffers duplicated in new buffers.
10694 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
10696 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10697 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10698 /// A pointer to the contents in the success state.
10699 /// Reading from this pointer when `result_ok` is not set is undefined.
10700 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
10701 /// A pointer to the contents in the error state.
10702 /// Reading from this pointer when `result_ok` is set is undefined.
10703 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10706 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10707 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10709 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10710 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10711 /// `err` or `result` depending on the state of `result_ok`.
10712 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
10713 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10714 pub result_ok: bool,
10717 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10718 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10719 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10720 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10721 result: Box::into_raw(Box::new(o)),
10727 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10728 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10729 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10730 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10731 err: Box::into_raw(Box::new(e)),
10737 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10738 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
10739 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10740 fn drop(&mut self) {
10741 if self.result_ok {
10742 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10743 let _ = unsafe { Box::from_raw(self.contents.result) };
10746 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10747 let _ = unsafe { Box::from_raw(self.contents.err) };
10752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10753 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10754 let contents = if o.result_ok {
10755 let result = unsafe { o.contents.result };
10756 unsafe { o.contents.result = std::ptr::null_mut() };
10757 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
10759 let err = unsafe { o.contents.err };
10760 unsafe { o.contents.err = std::ptr::null_mut(); }
10761 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
10765 result_ok: o.result_ok,
10769 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10770 fn clone(&self) -> Self {
10771 if self.result_ok {
10772 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10773 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10776 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10777 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10783 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10784 /// but with all dynamically-allocated buffers duplicated in new buffers.
10785 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
10787 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
10788 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
10789 /// A pointer to the contents in the success state.
10790 /// Reading from this pointer when `result_ok` is not set is undefined.
10791 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10792 /// A pointer to the contents in the error state.
10793 /// Reading from this pointer when `result_ok` is set is undefined.
10794 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10797 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10798 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10800 pub struct CResult_NodeAnnouncementDecodeErrorZ {
10801 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10802 /// `err` or `result` depending on the state of `result_ok`.
10803 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
10804 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10805 pub result_ok: bool,
10808 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10809 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
10810 CResult_NodeAnnouncementDecodeErrorZ {
10811 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10812 result: Box::into_raw(Box::new(o)),
10818 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10819 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
10820 CResult_NodeAnnouncementDecodeErrorZ {
10821 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10822 err: Box::into_raw(Box::new(e)),
10828 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10829 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
10830 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
10831 fn drop(&mut self) {
10832 if self.result_ok {
10833 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10834 let _ = unsafe { Box::from_raw(self.contents.result) };
10837 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10838 let _ = unsafe { Box::from_raw(self.contents.err) };
10843 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
10844 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10845 let contents = if o.result_ok {
10846 let result = unsafe { o.contents.result };
10847 unsafe { o.contents.result = std::ptr::null_mut() };
10848 CResult_NodeAnnouncementDecodeErrorZPtr { result }
10850 let err = unsafe { o.contents.err };
10851 unsafe { o.contents.err = std::ptr::null_mut(); }
10852 CResult_NodeAnnouncementDecodeErrorZPtr { err }
10856 result_ok: o.result_ok,
10860 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
10861 fn clone(&self) -> Self {
10862 if self.result_ok {
10863 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10864 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10867 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10868 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10874 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10875 /// but with all dynamically-allocated buffers duplicated in new buffers.
10876 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
10878 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10879 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
10880 /// A pointer to the contents in the success state.
10881 /// Reading from this pointer when `result_ok` is not set is undefined.
10882 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
10883 /// A pointer to the contents in the error state.
10884 /// Reading from this pointer when `result_ok` is set is undefined.
10885 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10888 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10889 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10891 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
10892 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10893 /// `err` or `result` depending on the state of `result_ok`.
10894 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
10895 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10896 pub result_ok: bool,
10899 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10900 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10901 CResult_QueryShortChannelIdsDecodeErrorZ {
10902 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10903 result: Box::into_raw(Box::new(o)),
10909 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10910 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10911 CResult_QueryShortChannelIdsDecodeErrorZ {
10912 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10913 err: Box::into_raw(Box::new(e)),
10919 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10920 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
10921 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
10922 fn drop(&mut self) {
10923 if self.result_ok {
10924 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10925 let _ = unsafe { Box::from_raw(self.contents.result) };
10928 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10929 let _ = unsafe { Box::from_raw(self.contents.err) };
10934 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
10935 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
10936 let contents = if o.result_ok {
10937 let result = unsafe { o.contents.result };
10938 unsafe { o.contents.result = std::ptr::null_mut() };
10939 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
10941 let err = unsafe { o.contents.err };
10942 unsafe { o.contents.err = std::ptr::null_mut(); }
10943 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
10947 result_ok: o.result_ok,
10951 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
10952 fn clone(&self) -> Self {
10953 if self.result_ok {
10954 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10955 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
10958 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10959 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10965 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10966 /// but with all dynamically-allocated buffers duplicated in new buffers.
10967 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
10969 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10970 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10971 /// A pointer to the contents in the success state.
10972 /// Reading from this pointer when `result_ok` is not set is undefined.
10973 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
10974 /// A pointer to the contents in the error state.
10975 /// Reading from this pointer when `result_ok` is set is undefined.
10976 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10979 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10980 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10982 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10983 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10984 /// `err` or `result` depending on the state of `result_ok`.
10985 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
10986 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10987 pub result_ok: bool,
10990 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10991 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10992 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10993 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10994 result: Box::into_raw(Box::new(o)),
11000 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11001 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11002 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11003 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11004 err: Box::into_raw(Box::new(e)),
11010 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11011 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
11012 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11013 fn drop(&mut self) {
11014 if self.result_ok {
11015 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11016 let _ = unsafe { Box::from_raw(self.contents.result) };
11019 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11020 let _ = unsafe { Box::from_raw(self.contents.err) };
11025 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11026 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
11027 let contents = if o.result_ok {
11028 let result = unsafe { o.contents.result };
11029 unsafe { o.contents.result = std::ptr::null_mut() };
11030 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
11032 let err = unsafe { o.contents.err };
11033 unsafe { o.contents.err = std::ptr::null_mut(); }
11034 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
11038 result_ok: o.result_ok,
11042 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11043 fn clone(&self) -> Self {
11044 if self.result_ok {
11045 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11046 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
11049 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11050 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11056 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11057 /// but with all dynamically-allocated buffers duplicated in new buffers.
11058 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
11060 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
11061 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
11062 /// A pointer to the contents in the success state.
11063 /// Reading from this pointer when `result_ok` is not set is undefined.
11064 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
11065 /// A pointer to the contents in the error state.
11066 /// Reading from this pointer when `result_ok` is set is undefined.
11067 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11070 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11071 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11073 pub struct CResult_QueryChannelRangeDecodeErrorZ {
11074 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11075 /// `err` or `result` depending on the state of `result_ok`.
11076 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
11077 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11078 pub result_ok: bool,
11081 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11082 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
11083 CResult_QueryChannelRangeDecodeErrorZ {
11084 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11085 result: Box::into_raw(Box::new(o)),
11091 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11092 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
11093 CResult_QueryChannelRangeDecodeErrorZ {
11094 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11095 err: Box::into_raw(Box::new(e)),
11101 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11102 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
11103 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
11104 fn drop(&mut self) {
11105 if self.result_ok {
11106 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11107 let _ = unsafe { Box::from_raw(self.contents.result) };
11110 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11111 let _ = unsafe { Box::from_raw(self.contents.err) };
11116 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
11117 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11118 let contents = if o.result_ok {
11119 let result = unsafe { o.contents.result };
11120 unsafe { o.contents.result = std::ptr::null_mut() };
11121 CResult_QueryChannelRangeDecodeErrorZPtr { result }
11123 let err = unsafe { o.contents.err };
11124 unsafe { o.contents.err = std::ptr::null_mut(); }
11125 CResult_QueryChannelRangeDecodeErrorZPtr { err }
11129 result_ok: o.result_ok,
11133 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
11134 fn clone(&self) -> Self {
11135 if self.result_ok {
11136 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11137 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
11140 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11141 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11147 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11148 /// but with all dynamically-allocated buffers duplicated in new buffers.
11149 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
11151 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
11152 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
11153 /// A pointer to the contents in the success state.
11154 /// Reading from this pointer when `result_ok` is not set is undefined.
11155 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
11156 /// A pointer to the contents in the error state.
11157 /// Reading from this pointer when `result_ok` is set is undefined.
11158 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11161 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
11162 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11164 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
11165 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
11166 /// `err` or `result` depending on the state of `result_ok`.
11167 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
11168 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
11169 pub result_ok: bool,
11172 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11173 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
11174 CResult_ReplyChannelRangeDecodeErrorZ {
11175 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11176 result: Box::into_raw(Box::new(o)),
11182 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11183 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
11184 CResult_ReplyChannelRangeDecodeErrorZ {
11185 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11186 err: Box::into_raw(Box::new(e)),
11192 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11193 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
11194 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
11195 fn drop(&mut self) {
11196 if self.result_ok {
11197 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11198 let _ = unsafe { Box::from_raw(self.contents.result) };
11201 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11202 let _ = unsafe { Box::from_raw(self.contents.err) };
11207 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
11208 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11209 let contents = if o.result_ok {
11210 let result = unsafe { o.contents.result };
11211 unsafe { o.contents.result = std::ptr::null_mut() };
11212 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
11214 let err = unsafe { o.contents.err };
11215 unsafe { o.contents.err = std::ptr::null_mut(); }
11216 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
11220 result_ok: o.result_ok,
11224 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
11225 fn clone(&self) -> Self {
11226 if self.result_ok {
11227 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11228 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
11231 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11232 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11238 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11239 /// but with all dynamically-allocated buffers duplicated in new buffers.
11240 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
11242 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
11243 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
11244 /// A pointer to the contents in the success state.
11245 /// Reading from this pointer when `result_ok` is not set is undefined.
11246 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
11247 /// A pointer to the contents in the error state.
11248 /// Reading from this pointer when `result_ok` is set is undefined.
11249 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11252 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
11253 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
11254 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11255 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
11256 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
11257 /// `err` or `result` depending on the state of `result_ok`.
11258 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
11259 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
11260 pub result_ok: bool,
11263 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11264 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
11265 CResult_GossipTimestampFilterDecodeErrorZ {
11266 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11267 result: Box::into_raw(Box::new(o)),
11273 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11274 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
11275 CResult_GossipTimestampFilterDecodeErrorZ {
11276 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11277 err: Box::into_raw(Box::new(e)),
11283 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11284 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
11285 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
11286 fn drop(&mut self) {
11287 if self.result_ok {
11288 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11289 let _ = unsafe { Box::from_raw(self.contents.result) };
11292 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11293 let _ = unsafe { Box::from_raw(self.contents.err) };
11298 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
11299 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
11300 let contents = if o.result_ok {
11301 let result = unsafe { o.contents.result };
11302 unsafe { o.contents.result = std::ptr::null_mut() };
11303 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
11305 let err = unsafe { o.contents.err };
11306 unsafe { o.contents.err = std::ptr::null_mut(); }
11307 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
11311 result_ok: o.result_ok,
11315 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
11316 fn clone(&self) -> Self {
11317 if self.result_ok {
11318 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11319 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
11322 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11323 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11329 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11330 /// but with all dynamically-allocated buffers duplicated in new buffers.
11331 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
11333 /// The contents of CResult_InvoiceSignOrCreationErrorZ
11334 pub union CResult_InvoiceSignOrCreationErrorZPtr {
11335 /// A pointer to the contents in the success state.
11336 /// Reading from this pointer when `result_ok` is not set is undefined.
11337 pub result: *mut crate::lightning_invoice::Invoice,
11338 /// A pointer to the contents in the error state.
11339 /// Reading from this pointer when `result_ok` is set is undefined.
11340 pub err: *mut crate::lightning_invoice::SignOrCreationError,
11343 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11344 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11346 pub struct CResult_InvoiceSignOrCreationErrorZ {
11347 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11348 /// `err` or `result` depending on the state of `result_ok`.
11349 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
11350 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11351 pub result_ok: bool,
11354 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11355 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
11356 CResult_InvoiceSignOrCreationErrorZ {
11357 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11358 result: Box::into_raw(Box::new(o)),
11364 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11365 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
11366 CResult_InvoiceSignOrCreationErrorZ {
11367 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11368 err: Box::into_raw(Box::new(e)),
11374 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11375 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
11376 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
11377 fn drop(&mut self) {
11378 if self.result_ok {
11379 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11380 let _ = unsafe { Box::from_raw(self.contents.result) };
11383 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11384 let _ = unsafe { Box::from_raw(self.contents.err) };
11389 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11390 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11391 let contents = if o.result_ok {
11392 let result = unsafe { o.contents.result };
11393 unsafe { o.contents.result = std::ptr::null_mut() };
11394 CResult_InvoiceSignOrCreationErrorZPtr { result }
11396 let err = unsafe { o.contents.err };
11397 unsafe { o.contents.err = std::ptr::null_mut(); }
11398 CResult_InvoiceSignOrCreationErrorZPtr { err }
11402 result_ok: o.result_ok,
11406 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11407 fn clone(&self) -> Self {
11408 if self.result_ok {
11409 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11410 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11413 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11414 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11420 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11421 /// but with all dynamically-allocated buffers duplicated in new buffers.
11422 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }