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 { Clone::clone(&orig) }
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 { Clone::clone(&orig) }
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 { Clone::clone(&orig) }
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 { Clone::clone(&orig) }
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 is_none(&self) -> bool {
455 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
456 if let Self::Some(v) = self { v } else { unreachable!() }
460 /// Constructs a new COption_u32Z containing a u32
461 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
462 COption_u32Z::Some(o)
465 /// Constructs a new COption_u32Z containing nothing
466 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
470 /// Frees any resources associated with the u32, if we are in the Some state
471 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
473 /// Creates a new COption_u32Z which has the same data as `orig`
474 /// but with all dynamically-allocated buffers duplicated in new buffers.
475 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
477 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
478 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
479 /// A pointer to the contents in the success state.
480 /// Reading from this pointer when `result_ok` is not set is undefined.
481 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
482 /// A pointer to the contents in the error state.
483 /// Reading from this pointer when `result_ok` is set is undefined.
484 pub err: *mut crate::lightning::ln::msgs::DecodeError,
487 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
488 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
490 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
491 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
492 /// `err` or `result` depending on the state of `result_ok`.
493 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
494 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
498 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
499 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
500 CResult_HTLCOutputInCommitmentDecodeErrorZ {
501 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
502 result: Box::into_raw(Box::new(o)),
508 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
509 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
510 CResult_HTLCOutputInCommitmentDecodeErrorZ {
511 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
512 err: Box::into_raw(Box::new(e)),
518 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
519 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
520 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
523 if unsafe { !(self.contents.result as *mut ()).is_null() } {
524 let _ = unsafe { Box::from_raw(self.contents.result) };
527 if unsafe { !(self.contents.err as *mut ()).is_null() } {
528 let _ = unsafe { Box::from_raw(self.contents.err) };
533 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
534 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
535 let contents = if o.result_ok {
536 let result = unsafe { o.contents.result };
537 unsafe { o.contents.result = std::ptr::null_mut() };
538 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
540 let err = unsafe { o.contents.err };
541 unsafe { o.contents.err = std::ptr::null_mut(); }
542 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
546 result_ok: o.result_ok,
550 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
551 fn clone(&self) -> Self {
553 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
554 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
557 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
558 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
564 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
565 /// but with all dynamically-allocated buffers duplicated in new buffers.
566 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
568 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
569 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
570 /// A pointer to the contents in the success state.
571 /// Reading from this pointer when `result_ok` is not set is undefined.
572 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
573 /// A pointer to the contents in the error state.
574 /// Reading from this pointer when `result_ok` is set is undefined.
575 pub err: *mut crate::lightning::ln::msgs::DecodeError,
578 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
579 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
581 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
582 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
583 /// `err` or `result` depending on the state of `result_ok`.
584 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
585 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
589 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
590 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
591 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
592 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
593 result: Box::into_raw(Box::new(o)),
599 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
600 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
601 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
602 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
603 err: Box::into_raw(Box::new(e)),
609 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
610 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
611 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
614 if unsafe { !(self.contents.result as *mut ()).is_null() } {
615 let _ = unsafe { Box::from_raw(self.contents.result) };
618 if unsafe { !(self.contents.err as *mut ()).is_null() } {
619 let _ = unsafe { Box::from_raw(self.contents.err) };
624 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
625 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
626 let contents = if o.result_ok {
627 let result = unsafe { o.contents.result };
628 unsafe { o.contents.result = std::ptr::null_mut() };
629 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
631 let err = unsafe { o.contents.err };
632 unsafe { o.contents.err = std::ptr::null_mut(); }
633 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
637 result_ok: o.result_ok,
641 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
642 fn clone(&self) -> Self {
644 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
645 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
648 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
649 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
655 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
656 /// but with all dynamically-allocated buffers duplicated in new buffers.
657 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
659 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
660 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
661 /// A pointer to the contents in the success state.
662 /// Reading from this pointer when `result_ok` is not set is undefined.
663 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
664 /// A pointer to the contents in the error state.
665 /// Reading from this pointer when `result_ok` is set is undefined.
666 pub err: *mut crate::lightning::ln::msgs::DecodeError,
669 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
670 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
672 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
673 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
674 /// `err` or `result` depending on the state of `result_ok`.
675 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
676 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
680 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
681 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
682 CResult_ChannelTransactionParametersDecodeErrorZ {
683 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
684 result: Box::into_raw(Box::new(o)),
690 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
691 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
692 CResult_ChannelTransactionParametersDecodeErrorZ {
693 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
694 err: Box::into_raw(Box::new(e)),
700 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
701 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
702 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
705 if unsafe { !(self.contents.result as *mut ()).is_null() } {
706 let _ = unsafe { Box::from_raw(self.contents.result) };
709 if unsafe { !(self.contents.err as *mut ()).is_null() } {
710 let _ = unsafe { Box::from_raw(self.contents.err) };
715 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
716 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
717 let contents = if o.result_ok {
718 let result = unsafe { o.contents.result };
719 unsafe { o.contents.result = std::ptr::null_mut() };
720 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
722 let err = unsafe { o.contents.err };
723 unsafe { o.contents.err = std::ptr::null_mut(); }
724 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
728 result_ok: o.result_ok,
732 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
733 fn clone(&self) -> Self {
735 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
736 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
739 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
740 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
746 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
747 /// but with all dynamically-allocated buffers duplicated in new buffers.
748 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
750 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
751 /// This corresponds to std::vector in C++
752 pub struct CVec_SignatureZ {
753 /// The elements in the array.
754 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
755 pub data: *mut crate::c_types::Signature,
756 /// The number of elements pointed to by `data`.
759 impl CVec_SignatureZ {
760 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
761 if self.datalen == 0 { return Vec::new(); }
762 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
763 self.data = std::ptr::null_mut();
767 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
768 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
771 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
772 fn from(v: Vec<crate::c_types::Signature>) -> Self {
773 let datalen = v.len();
774 let data = Box::into_raw(v.into_boxed_slice());
775 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
779 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
780 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
781 impl Drop for CVec_SignatureZ {
783 if self.datalen == 0 { return; }
784 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
787 impl Clone for CVec_SignatureZ {
788 fn clone(&self) -> Self {
789 let mut res = Vec::new();
790 if self.datalen == 0 { return Self::from(res); }
791 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
796 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
797 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
798 /// A pointer to the contents in the success state.
799 /// Reading from this pointer when `result_ok` is not set is undefined.
800 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
801 /// A pointer to the contents in the error state.
802 /// Reading from this pointer when `result_ok` is set is undefined.
803 pub err: *mut crate::lightning::ln::msgs::DecodeError,
806 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
807 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
809 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
810 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
811 /// `err` or `result` depending on the state of `result_ok`.
812 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
813 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
817 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
818 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
819 CResult_HolderCommitmentTransactionDecodeErrorZ {
820 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
821 result: Box::into_raw(Box::new(o)),
827 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
828 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
829 CResult_HolderCommitmentTransactionDecodeErrorZ {
830 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
831 err: Box::into_raw(Box::new(e)),
837 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
838 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
839 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
843 let _ = unsafe { Box::from_raw(self.contents.result) };
846 if unsafe { !(self.contents.err as *mut ()).is_null() } {
847 let _ = unsafe { Box::from_raw(self.contents.err) };
852 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
853 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
854 let contents = if o.result_ok {
855 let result = unsafe { o.contents.result };
856 unsafe { o.contents.result = std::ptr::null_mut() };
857 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
859 let err = unsafe { o.contents.err };
860 unsafe { o.contents.err = std::ptr::null_mut(); }
861 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
865 result_ok: o.result_ok,
869 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
870 fn clone(&self) -> Self {
872 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
873 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
876 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
877 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
883 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
884 /// but with all dynamically-allocated buffers duplicated in new buffers.
885 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
887 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
888 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
889 /// A pointer to the contents in the success state.
890 /// Reading from this pointer when `result_ok` is not set is undefined.
891 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
892 /// A pointer to the contents in the error state.
893 /// Reading from this pointer when `result_ok` is set is undefined.
894 pub err: *mut crate::lightning::ln::msgs::DecodeError,
897 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
898 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
900 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
901 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
902 /// `err` or `result` depending on the state of `result_ok`.
903 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
904 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
908 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
909 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
910 CResult_BuiltCommitmentTransactionDecodeErrorZ {
911 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
912 result: Box::into_raw(Box::new(o)),
918 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
919 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
920 CResult_BuiltCommitmentTransactionDecodeErrorZ {
921 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
922 err: Box::into_raw(Box::new(e)),
928 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
929 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
930 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
934 let _ = unsafe { Box::from_raw(self.contents.result) };
937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
938 let _ = unsafe { Box::from_raw(self.contents.err) };
943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
944 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
945 let contents = if o.result_ok {
946 let result = unsafe { o.contents.result };
947 unsafe { o.contents.result = std::ptr::null_mut() };
948 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
950 let err = unsafe { o.contents.err };
951 unsafe { o.contents.err = std::ptr::null_mut(); }
952 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
956 result_ok: o.result_ok,
960 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
961 fn clone(&self) -> Self {
963 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
964 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
967 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
968 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
974 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
975 /// but with all dynamically-allocated buffers duplicated in new buffers.
976 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
978 /// The contents of CResult_TrustedClosingTransactionNoneZ
979 pub union CResult_TrustedClosingTransactionNoneZPtr {
980 /// A pointer to the contents in the success state.
981 /// Reading from this pointer when `result_ok` is not set is undefined.
982 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
983 /// Note that this value is always NULL, as there are no contents in the Err variant
984 pub err: *mut std::ffi::c_void,
987 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
988 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
990 pub struct CResult_TrustedClosingTransactionNoneZ {
991 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
992 /// `err` or `result` depending on the state of `result_ok`.
993 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
994 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
998 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
999 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1000 CResult_TrustedClosingTransactionNoneZ {
1001 contents: CResult_TrustedClosingTransactionNoneZPtr {
1002 result: Box::into_raw(Box::new(o)),
1008 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1009 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1010 CResult_TrustedClosingTransactionNoneZ {
1011 contents: CResult_TrustedClosingTransactionNoneZPtr {
1012 err: std::ptr::null_mut(),
1018 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1019 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1020 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1021 fn drop(&mut self) {
1023 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1024 let _ = unsafe { Box::from_raw(self.contents.result) };
1030 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1031 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1032 let contents = if o.result_ok {
1033 let result = unsafe { o.contents.result };
1034 unsafe { o.contents.result = std::ptr::null_mut() };
1035 CResult_TrustedClosingTransactionNoneZPtr { result }
1037 let _ = unsafe { Box::from_raw(o.contents.err) };
1038 o.contents.err = std::ptr::null_mut();
1039 CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1043 result_ok: o.result_ok,
1048 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1049 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1050 /// A pointer to the contents in the success state.
1051 /// Reading from this pointer when `result_ok` is not set is undefined.
1052 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1053 /// A pointer to the contents in the error state.
1054 /// Reading from this pointer when `result_ok` is set is undefined.
1055 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1058 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1059 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1061 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1062 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1063 /// `err` or `result` depending on the state of `result_ok`.
1064 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1065 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1066 pub result_ok: bool,
1069 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1070 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1071 CResult_CommitmentTransactionDecodeErrorZ {
1072 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1073 result: Box::into_raw(Box::new(o)),
1079 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1080 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1081 CResult_CommitmentTransactionDecodeErrorZ {
1082 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1083 err: Box::into_raw(Box::new(e)),
1089 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1090 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1091 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1092 fn drop(&mut self) {
1094 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1095 let _ = unsafe { Box::from_raw(self.contents.result) };
1098 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1099 let _ = unsafe { Box::from_raw(self.contents.err) };
1104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1105 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1106 let contents = if o.result_ok {
1107 let result = unsafe { o.contents.result };
1108 unsafe { o.contents.result = std::ptr::null_mut() };
1109 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1111 let err = unsafe { o.contents.err };
1112 unsafe { o.contents.err = std::ptr::null_mut(); }
1113 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1117 result_ok: o.result_ok,
1121 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1122 fn clone(&self) -> Self {
1124 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1125 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1128 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1129 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1135 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1136 /// but with all dynamically-allocated buffers duplicated in new buffers.
1137 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1139 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1140 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1141 /// A pointer to the contents in the success state.
1142 /// Reading from this pointer when `result_ok` is not set is undefined.
1143 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1144 /// Note that this value is always NULL, as there are no contents in the Err variant
1145 pub err: *mut std::ffi::c_void,
1148 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1149 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1151 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1152 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1153 /// `err` or `result` depending on the state of `result_ok`.
1154 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1155 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1156 pub result_ok: bool,
1159 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1160 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1161 CResult_TrustedCommitmentTransactionNoneZ {
1162 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1163 result: Box::into_raw(Box::new(o)),
1169 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1170 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1171 CResult_TrustedCommitmentTransactionNoneZ {
1172 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1173 err: std::ptr::null_mut(),
1179 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1180 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1181 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1182 fn drop(&mut self) {
1184 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1185 let _ = unsafe { Box::from_raw(self.contents.result) };
1191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1192 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1193 let contents = if o.result_ok {
1194 let result = unsafe { o.contents.result };
1195 unsafe { o.contents.result = std::ptr::null_mut() };
1196 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1198 let _ = unsafe { Box::from_raw(o.contents.err) };
1199 o.contents.err = std::ptr::null_mut();
1200 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1204 result_ok: o.result_ok,
1209 /// The contents of CResult_CVec_SignatureZNoneZ
1210 pub union CResult_CVec_SignatureZNoneZPtr {
1211 /// A pointer to the contents in the success state.
1212 /// Reading from this pointer when `result_ok` is not set is undefined.
1213 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1214 /// Note that this value is always NULL, as there are no contents in the Err variant
1215 pub err: *mut std::ffi::c_void,
1218 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1219 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1220 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1221 pub struct CResult_CVec_SignatureZNoneZ {
1222 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1223 /// `err` or `result` depending on the state of `result_ok`.
1224 pub contents: CResult_CVec_SignatureZNoneZPtr,
1225 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1226 pub result_ok: bool,
1229 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1230 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1231 CResult_CVec_SignatureZNoneZ {
1232 contents: CResult_CVec_SignatureZNoneZPtr {
1233 result: Box::into_raw(Box::new(o)),
1239 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1240 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1241 CResult_CVec_SignatureZNoneZ {
1242 contents: CResult_CVec_SignatureZNoneZPtr {
1243 err: std::ptr::null_mut(),
1249 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1250 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1251 impl Drop for CResult_CVec_SignatureZNoneZ {
1252 fn drop(&mut self) {
1254 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1255 let _ = unsafe { Box::from_raw(self.contents.result) };
1261 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1262 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1263 let contents = if o.result_ok {
1264 let result = unsafe { o.contents.result };
1265 unsafe { o.contents.result = std::ptr::null_mut() };
1266 CResult_CVec_SignatureZNoneZPtr { result }
1268 let _ = unsafe { Box::from_raw(o.contents.err) };
1269 o.contents.err = std::ptr::null_mut();
1270 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1274 result_ok: o.result_ok,
1278 impl Clone for CResult_CVec_SignatureZNoneZ {
1279 fn clone(&self) -> Self {
1281 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1282 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1285 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1286 err: std::ptr::null_mut()
1292 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1293 /// but with all dynamically-allocated buffers duplicated in new buffers.
1294 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1296 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1297 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1298 /// A pointer to the contents in the success state.
1299 /// Reading from this pointer when `result_ok` is not set is undefined.
1300 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1301 /// A pointer to the contents in the error state.
1302 /// Reading from this pointer when `result_ok` is set is undefined.
1303 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1306 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1307 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1309 pub struct CResult_ShutdownScriptDecodeErrorZ {
1310 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1311 /// `err` or `result` depending on the state of `result_ok`.
1312 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1313 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1314 pub result_ok: bool,
1317 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1318 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1319 CResult_ShutdownScriptDecodeErrorZ {
1320 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1321 result: Box::into_raw(Box::new(o)),
1327 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1328 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1329 CResult_ShutdownScriptDecodeErrorZ {
1330 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1331 err: Box::into_raw(Box::new(e)),
1337 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1338 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1339 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1340 fn drop(&mut self) {
1342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1343 let _ = unsafe { Box::from_raw(self.contents.result) };
1346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1347 let _ = unsafe { Box::from_raw(self.contents.err) };
1352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1353 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1354 let contents = if o.result_ok {
1355 let result = unsafe { o.contents.result };
1356 unsafe { o.contents.result = std::ptr::null_mut() };
1357 CResult_ShutdownScriptDecodeErrorZPtr { result }
1359 let err = unsafe { o.contents.err };
1360 unsafe { o.contents.err = std::ptr::null_mut(); }
1361 CResult_ShutdownScriptDecodeErrorZPtr { err }
1365 result_ok: o.result_ok,
1369 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1370 fn clone(&self) -> Self {
1372 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1373 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1376 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1377 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1383 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1384 /// but with all dynamically-allocated buffers duplicated in new buffers.
1385 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1387 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1388 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1389 /// A pointer to the contents in the success state.
1390 /// Reading from this pointer when `result_ok` is not set is undefined.
1391 pub result: *mut crate::lightning::ln::script::ShutdownScript,
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::lightning::ln::script::InvalidShutdownScript,
1397 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1398 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1400 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1401 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1402 /// `err` or `result` depending on the state of `result_ok`.
1403 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1404 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1405 pub result_ok: bool,
1408 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1409 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1410 CResult_ShutdownScriptInvalidShutdownScriptZ {
1411 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1412 result: Box::into_raw(Box::new(o)),
1418 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1419 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1420 CResult_ShutdownScriptInvalidShutdownScriptZ {
1421 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1422 err: Box::into_raw(Box::new(e)),
1428 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1429 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1430 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1431 fn drop(&mut self) {
1433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1434 let _ = unsafe { Box::from_raw(self.contents.result) };
1437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1438 let _ = unsafe { Box::from_raw(self.contents.err) };
1443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1444 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1445 let contents = if o.result_ok {
1446 let result = unsafe { o.contents.result };
1447 unsafe { o.contents.result = std::ptr::null_mut() };
1448 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1450 let err = unsafe { o.contents.err };
1451 unsafe { o.contents.err = std::ptr::null_mut(); }
1452 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1456 result_ok: o.result_ok,
1461 /// The contents of CResult_NoneErrorZ
1462 pub union CResult_NoneErrorZPtr {
1463 /// Note that this value is always NULL, as there are no contents in the OK variant
1464 pub result: *mut std::ffi::c_void,
1465 /// A pointer to the contents in the error state.
1466 /// Reading from this pointer when `result_ok` is set is undefined.
1467 pub err: *mut crate::c_types::IOError,
1470 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1471 /// containing a () on success and a crate::c_types::IOError on failure.
1472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1473 pub struct CResult_NoneErrorZ {
1474 /// The contents of this CResult_NoneErrorZ, accessible via either
1475 /// `err` or `result` depending on the state of `result_ok`.
1476 pub contents: CResult_NoneErrorZPtr,
1477 /// Whether this CResult_NoneErrorZ represents a success state.
1478 pub result_ok: bool,
1481 /// Creates a new CResult_NoneErrorZ in the success state.
1482 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1483 CResult_NoneErrorZ {
1484 contents: CResult_NoneErrorZPtr {
1485 result: std::ptr::null_mut(),
1491 /// Creates a new CResult_NoneErrorZ in the error state.
1492 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1493 CResult_NoneErrorZ {
1494 contents: CResult_NoneErrorZPtr {
1495 err: Box::into_raw(Box::new(e)),
1501 /// Frees any resources used by the CResult_NoneErrorZ.
1502 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1503 impl Drop for CResult_NoneErrorZ {
1504 fn drop(&mut self) {
1507 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1508 let _ = unsafe { Box::from_raw(self.contents.err) };
1513 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1514 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1515 let contents = if o.result_ok {
1516 let _ = unsafe { Box::from_raw(o.contents.result) };
1517 o.contents.result = std::ptr::null_mut();
1518 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1520 let err = unsafe { o.contents.err };
1521 unsafe { o.contents.err = std::ptr::null_mut(); }
1522 CResult_NoneErrorZPtr { err }
1526 result_ok: o.result_ok,
1530 impl Clone for CResult_NoneErrorZ {
1531 fn clone(&self) -> Self {
1533 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1534 result: std::ptr::null_mut()
1537 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1538 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1544 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1545 /// but with all dynamically-allocated buffers duplicated in new buffers.
1546 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1548 /// The contents of CResult_RouteHopDecodeErrorZ
1549 pub union CResult_RouteHopDecodeErrorZPtr {
1550 /// A pointer to the contents in the success state.
1551 /// Reading from this pointer when `result_ok` is not set is undefined.
1552 pub result: *mut crate::lightning::routing::router::RouteHop,
1553 /// A pointer to the contents in the error state.
1554 /// Reading from this pointer when `result_ok` is set is undefined.
1555 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1558 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1559 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1561 pub struct CResult_RouteHopDecodeErrorZ {
1562 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1563 /// `err` or `result` depending on the state of `result_ok`.
1564 pub contents: CResult_RouteHopDecodeErrorZPtr,
1565 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1566 pub result_ok: bool,
1569 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1570 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1571 CResult_RouteHopDecodeErrorZ {
1572 contents: CResult_RouteHopDecodeErrorZPtr {
1573 result: Box::into_raw(Box::new(o)),
1579 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1580 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1581 CResult_RouteHopDecodeErrorZ {
1582 contents: CResult_RouteHopDecodeErrorZPtr {
1583 err: Box::into_raw(Box::new(e)),
1589 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1590 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1591 impl Drop for CResult_RouteHopDecodeErrorZ {
1592 fn drop(&mut self) {
1594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1595 let _ = unsafe { Box::from_raw(self.contents.result) };
1598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1599 let _ = unsafe { Box::from_raw(self.contents.err) };
1604 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1606 let contents = if o.result_ok {
1607 let result = unsafe { o.contents.result };
1608 unsafe { o.contents.result = std::ptr::null_mut() };
1609 CResult_RouteHopDecodeErrorZPtr { result }
1611 let err = unsafe { o.contents.err };
1612 unsafe { o.contents.err = std::ptr::null_mut(); }
1613 CResult_RouteHopDecodeErrorZPtr { err }
1617 result_ok: o.result_ok,
1621 impl Clone for CResult_RouteHopDecodeErrorZ {
1622 fn clone(&self) -> Self {
1624 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1625 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1628 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1635 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1636 /// but with all dynamically-allocated buffers duplicated in new buffers.
1637 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1639 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1640 /// This corresponds to std::vector in C++
1641 pub struct CVec_RouteHopZ {
1642 /// The elements in the array.
1643 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1644 pub data: *mut crate::lightning::routing::router::RouteHop,
1645 /// The number of elements pointed to by `data`.
1648 impl CVec_RouteHopZ {
1649 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1650 if self.datalen == 0 { return Vec::new(); }
1651 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1652 self.data = std::ptr::null_mut();
1656 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1657 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1660 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1661 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1662 let datalen = v.len();
1663 let data = Box::into_raw(v.into_boxed_slice());
1664 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1668 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1669 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1670 impl Drop for CVec_RouteHopZ {
1671 fn drop(&mut self) {
1672 if self.datalen == 0 { return; }
1673 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1676 impl Clone for CVec_RouteHopZ {
1677 fn clone(&self) -> Self {
1678 let mut res = Vec::new();
1679 if self.datalen == 0 { return Self::from(res); }
1680 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1685 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1686 /// This corresponds to std::vector in C++
1687 pub struct CVec_CVec_RouteHopZZ {
1688 /// The elements in the array.
1689 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1690 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1691 /// The number of elements pointed to by `data`.
1694 impl CVec_CVec_RouteHopZZ {
1695 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1696 if self.datalen == 0 { return Vec::new(); }
1697 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1698 self.data = std::ptr::null_mut();
1702 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1703 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1706 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1707 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1708 let datalen = v.len();
1709 let data = Box::into_raw(v.into_boxed_slice());
1710 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1714 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1715 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1716 impl Drop for CVec_CVec_RouteHopZZ {
1717 fn drop(&mut self) {
1718 if self.datalen == 0 { return; }
1719 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1722 impl Clone for CVec_CVec_RouteHopZZ {
1723 fn clone(&self) -> Self {
1724 let mut res = Vec::new();
1725 if self.datalen == 0 { return Self::from(res); }
1726 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1731 /// The contents of CResult_RouteDecodeErrorZ
1732 pub union CResult_RouteDecodeErrorZPtr {
1733 /// A pointer to the contents in the success state.
1734 /// Reading from this pointer when `result_ok` is not set is undefined.
1735 pub result: *mut crate::lightning::routing::router::Route,
1736 /// A pointer to the contents in the error state.
1737 /// Reading from this pointer when `result_ok` is set is undefined.
1738 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1741 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1742 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1744 pub struct CResult_RouteDecodeErrorZ {
1745 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1746 /// `err` or `result` depending on the state of `result_ok`.
1747 pub contents: CResult_RouteDecodeErrorZPtr,
1748 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1749 pub result_ok: bool,
1752 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1753 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1754 CResult_RouteDecodeErrorZ {
1755 contents: CResult_RouteDecodeErrorZPtr {
1756 result: Box::into_raw(Box::new(o)),
1762 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1763 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1764 CResult_RouteDecodeErrorZ {
1765 contents: CResult_RouteDecodeErrorZPtr {
1766 err: Box::into_raw(Box::new(e)),
1772 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1773 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1774 impl Drop for CResult_RouteDecodeErrorZ {
1775 fn drop(&mut self) {
1777 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1778 let _ = unsafe { Box::from_raw(self.contents.result) };
1781 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1782 let _ = unsafe { Box::from_raw(self.contents.err) };
1787 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1788 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1789 let contents = if o.result_ok {
1790 let result = unsafe { o.contents.result };
1791 unsafe { o.contents.result = std::ptr::null_mut() };
1792 CResult_RouteDecodeErrorZPtr { result }
1794 let err = unsafe { o.contents.err };
1795 unsafe { o.contents.err = std::ptr::null_mut(); }
1796 CResult_RouteDecodeErrorZPtr { err }
1800 result_ok: o.result_ok,
1804 impl Clone for CResult_RouteDecodeErrorZ {
1805 fn clone(&self) -> Self {
1807 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1808 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1811 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1812 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1818 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1819 /// but with all dynamically-allocated buffers duplicated in new buffers.
1820 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1823 /// An enum which can either contain a u64 or not
1824 pub enum COption_u64Z {
1825 /// When we're in this state, this COption_u64Z contains a u64
1827 /// When we're in this state, this COption_u64Z contains nothing
1831 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1832 if let Self::Some(_) = self { true } else { false }
1834 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1837 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1838 if let Self::Some(v) = self { v } else { unreachable!() }
1842 /// Constructs a new COption_u64Z containing a u64
1843 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1844 COption_u64Z::Some(o)
1847 /// Constructs a new COption_u64Z containing nothing
1848 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1852 /// Frees any resources associated with the u64, if we are in the Some state
1853 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1855 /// Creates a new COption_u64Z which has the same data as `orig`
1856 /// but with all dynamically-allocated buffers duplicated in new buffers.
1857 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
1859 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1860 /// This corresponds to std::vector in C++
1861 pub struct CVec_ChannelDetailsZ {
1862 /// The elements in the array.
1863 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1864 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
1865 /// The number of elements pointed to by `data`.
1868 impl CVec_ChannelDetailsZ {
1869 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
1870 if self.datalen == 0 { return Vec::new(); }
1871 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1872 self.data = std::ptr::null_mut();
1876 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
1877 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1880 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1881 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
1882 let datalen = v.len();
1883 let data = Box::into_raw(v.into_boxed_slice());
1884 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1888 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1889 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1890 impl Drop for CVec_ChannelDetailsZ {
1891 fn drop(&mut self) {
1892 if self.datalen == 0 { return; }
1893 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1896 impl Clone for CVec_ChannelDetailsZ {
1897 fn clone(&self) -> Self {
1898 let mut res = Vec::new();
1899 if self.datalen == 0 { return Self::from(res); }
1900 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1905 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1906 /// This corresponds to std::vector in C++
1907 pub struct CVec_RouteHintZ {
1908 /// The elements in the array.
1909 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1910 pub data: *mut crate::lightning::routing::router::RouteHint,
1911 /// The number of elements pointed to by `data`.
1914 impl CVec_RouteHintZ {
1915 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1916 if self.datalen == 0 { return Vec::new(); }
1917 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1918 self.data = std::ptr::null_mut();
1922 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1923 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1926 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1927 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1928 let datalen = v.len();
1929 let data = Box::into_raw(v.into_boxed_slice());
1930 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1934 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1935 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1936 impl Drop for CVec_RouteHintZ {
1937 fn drop(&mut self) {
1938 if self.datalen == 0 { return; }
1939 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1942 impl Clone for CVec_RouteHintZ {
1943 fn clone(&self) -> Self {
1944 let mut res = Vec::new();
1945 if self.datalen == 0 { return Self::from(res); }
1946 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1951 /// The contents of CResult_RouteLightningErrorZ
1952 pub union CResult_RouteLightningErrorZPtr {
1953 /// A pointer to the contents in the success state.
1954 /// Reading from this pointer when `result_ok` is not set is undefined.
1955 pub result: *mut crate::lightning::routing::router::Route,
1956 /// A pointer to the contents in the error state.
1957 /// Reading from this pointer when `result_ok` is set is undefined.
1958 pub err: *mut crate::lightning::ln::msgs::LightningError,
1961 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1962 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1964 pub struct CResult_RouteLightningErrorZ {
1965 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
1966 /// `err` or `result` depending on the state of `result_ok`.
1967 pub contents: CResult_RouteLightningErrorZPtr,
1968 /// Whether this CResult_RouteLightningErrorZ represents a success state.
1969 pub result_ok: bool,
1972 /// Creates a new CResult_RouteLightningErrorZ in the success state.
1973 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
1974 CResult_RouteLightningErrorZ {
1975 contents: CResult_RouteLightningErrorZPtr {
1976 result: Box::into_raw(Box::new(o)),
1982 /// Creates a new CResult_RouteLightningErrorZ in the error state.
1983 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
1984 CResult_RouteLightningErrorZ {
1985 contents: CResult_RouteLightningErrorZPtr {
1986 err: Box::into_raw(Box::new(e)),
1992 /// Frees any resources used by the CResult_RouteLightningErrorZ.
1993 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
1994 impl Drop for CResult_RouteLightningErrorZ {
1995 fn drop(&mut self) {
1997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1998 let _ = unsafe { Box::from_raw(self.contents.result) };
2001 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2002 let _ = unsafe { Box::from_raw(self.contents.err) };
2007 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2008 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2009 let contents = if o.result_ok {
2010 let result = unsafe { o.contents.result };
2011 unsafe { o.contents.result = std::ptr::null_mut() };
2012 CResult_RouteLightningErrorZPtr { result }
2014 let err = unsafe { o.contents.err };
2015 unsafe { o.contents.err = std::ptr::null_mut(); }
2016 CResult_RouteLightningErrorZPtr { err }
2020 result_ok: o.result_ok,
2024 impl Clone for CResult_RouteLightningErrorZ {
2025 fn clone(&self) -> Self {
2027 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2028 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2031 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2032 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2038 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2039 /// but with all dynamically-allocated buffers duplicated in new buffers.
2040 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2042 /// The contents of CResult_TxOutAccessErrorZ
2043 pub union CResult_TxOutAccessErrorZPtr {
2044 /// A pointer to the contents in the success state.
2045 /// Reading from this pointer when `result_ok` is not set is undefined.
2046 pub result: *mut crate::c_types::TxOut,
2047 /// A pointer to the contents in the error state.
2048 /// Reading from this pointer when `result_ok` is set is undefined.
2049 pub err: *mut crate::lightning::chain::AccessError,
2052 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2053 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2055 pub struct CResult_TxOutAccessErrorZ {
2056 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2057 /// `err` or `result` depending on the state of `result_ok`.
2058 pub contents: CResult_TxOutAccessErrorZPtr,
2059 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2060 pub result_ok: bool,
2063 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2064 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2065 CResult_TxOutAccessErrorZ {
2066 contents: CResult_TxOutAccessErrorZPtr {
2067 result: Box::into_raw(Box::new(o)),
2073 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2074 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2075 CResult_TxOutAccessErrorZ {
2076 contents: CResult_TxOutAccessErrorZPtr {
2077 err: Box::into_raw(Box::new(e)),
2083 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2084 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2085 impl Drop for CResult_TxOutAccessErrorZ {
2086 fn drop(&mut self) {
2088 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2089 let _ = unsafe { Box::from_raw(self.contents.result) };
2092 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2093 let _ = unsafe { Box::from_raw(self.contents.err) };
2098 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2099 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2100 let contents = if o.result_ok {
2101 let result = unsafe { o.contents.result };
2102 unsafe { o.contents.result = std::ptr::null_mut() };
2103 CResult_TxOutAccessErrorZPtr { result }
2105 let err = unsafe { o.contents.err };
2106 unsafe { o.contents.err = std::ptr::null_mut(); }
2107 CResult_TxOutAccessErrorZPtr { err }
2111 result_ok: o.result_ok,
2115 impl Clone for CResult_TxOutAccessErrorZ {
2116 fn clone(&self) -> Self {
2118 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2119 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2122 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2123 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2129 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2130 /// but with all dynamically-allocated buffers duplicated in new buffers.
2131 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2133 /// A tuple of 2 elements. See the individual fields for the types contained.
2134 pub struct C2Tuple_usizeTransactionZ {
2135 /// The element at position 0
2137 /// The element at position 1
2138 pub b: crate::c_types::Transaction,
2140 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2141 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2148 impl C2Tuple_usizeTransactionZ {
2149 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2153 impl Clone for C2Tuple_usizeTransactionZ {
2154 fn clone(&self) -> Self {
2156 a: Clone::clone(&self.a),
2157 b: Clone::clone(&self.b),
2162 /// Creates a new tuple which has the same data as `orig`
2163 /// but with all dynamically-allocated buffers duplicated in new buffers.
2164 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2165 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2167 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2168 C2Tuple_usizeTransactionZ { a, b, }
2172 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2173 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2175 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2176 /// This corresponds to std::vector in C++
2177 pub struct CVec_C2Tuple_usizeTransactionZZ {
2178 /// The elements in the array.
2179 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2180 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2181 /// The number of elements pointed to by `data`.
2184 impl CVec_C2Tuple_usizeTransactionZZ {
2185 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2186 if self.datalen == 0 { return Vec::new(); }
2187 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2188 self.data = std::ptr::null_mut();
2192 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2193 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2196 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2197 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2198 let datalen = v.len();
2199 let data = Box::into_raw(v.into_boxed_slice());
2200 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2205 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2206 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2207 fn drop(&mut self) {
2208 if self.datalen == 0 { return; }
2209 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2212 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2213 fn clone(&self) -> Self {
2214 let mut res = Vec::new();
2215 if self.datalen == 0 { return Self::from(res); }
2216 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2221 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2222 /// This corresponds to std::vector in C++
2223 pub struct CVec_TxidZ {
2224 /// The elements in the array.
2225 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2226 pub data: *mut crate::c_types::ThirtyTwoBytes,
2227 /// The number of elements pointed to by `data`.
2231 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2232 if self.datalen == 0 { return Vec::new(); }
2233 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2234 self.data = std::ptr::null_mut();
2238 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2239 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2242 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2243 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2244 let datalen = v.len();
2245 let data = Box::into_raw(v.into_boxed_slice());
2246 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2250 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2251 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2252 impl Drop for CVec_TxidZ {
2253 fn drop(&mut self) {
2254 if self.datalen == 0 { return; }
2255 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2258 impl Clone for CVec_TxidZ {
2259 fn clone(&self) -> Self {
2260 let mut res = Vec::new();
2261 if self.datalen == 0 { return Self::from(res); }
2262 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2267 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2268 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2269 /// Note that this value is always NULL, as there are no contents in the OK variant
2270 pub result: *mut std::ffi::c_void,
2271 /// A pointer to the contents in the error state.
2272 /// Reading from this pointer when `result_ok` is set is undefined.
2273 pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2276 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2277 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2279 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2280 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2281 /// `err` or `result` depending on the state of `result_ok`.
2282 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2283 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2284 pub result_ok: bool,
2287 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2288 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2289 CResult_NoneChannelMonitorUpdateErrZ {
2290 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2291 result: std::ptr::null_mut(),
2297 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2298 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2299 CResult_NoneChannelMonitorUpdateErrZ {
2300 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2301 err: Box::into_raw(Box::new(e)),
2307 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2308 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2309 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2310 fn drop(&mut self) {
2313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2314 let _ = unsafe { Box::from_raw(self.contents.err) };
2319 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2320 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2321 let contents = if o.result_ok {
2322 let _ = unsafe { Box::from_raw(o.contents.result) };
2323 o.contents.result = std::ptr::null_mut();
2324 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2326 let err = unsafe { o.contents.err };
2327 unsafe { o.contents.err = std::ptr::null_mut(); }
2328 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2332 result_ok: o.result_ok,
2336 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2337 fn clone(&self) -> Self {
2339 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2340 result: std::ptr::null_mut()
2343 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2344 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2350 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2351 /// but with all dynamically-allocated buffers duplicated in new buffers.
2352 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2354 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2355 /// This corresponds to std::vector in C++
2356 pub struct CVec_MonitorEventZ {
2357 /// The elements in the array.
2358 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2359 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2360 /// The number of elements pointed to by `data`.
2363 impl CVec_MonitorEventZ {
2364 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2365 if self.datalen == 0 { return Vec::new(); }
2366 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2367 self.data = std::ptr::null_mut();
2371 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2372 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2375 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2376 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2377 let datalen = v.len();
2378 let data = Box::into_raw(v.into_boxed_slice());
2379 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2383 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2384 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2385 impl Drop for CVec_MonitorEventZ {
2386 fn drop(&mut self) {
2387 if self.datalen == 0 { return; }
2388 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2391 impl Clone for CVec_MonitorEventZ {
2392 fn clone(&self) -> Self {
2393 let mut res = Vec::new();
2394 if self.datalen == 0 { return Self::from(res); }
2395 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2401 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2402 pub enum COption_C2Tuple_usizeTransactionZZ {
2403 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2404 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2405 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2408 impl COption_C2Tuple_usizeTransactionZZ {
2409 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2410 if let Self::Some(_) = self { true } else { false }
2412 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2415 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2416 if let Self::Some(v) = self { v } else { unreachable!() }
2420 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2421 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2422 COption_C2Tuple_usizeTransactionZZ::Some(o)
2425 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2426 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2427 COption_C2Tuple_usizeTransactionZZ::None
2430 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2431 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2433 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2434 /// but with all dynamically-allocated buffers duplicated in new buffers.
2435 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
2438 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2439 pub enum COption_NetworkUpdateZ {
2440 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2441 Some(crate::lightning::routing::network_graph::NetworkUpdate),
2442 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
2445 impl COption_NetworkUpdateZ {
2446 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2447 if let Self::Some(_) = self { true } else { false }
2449 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2452 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
2453 if let Self::Some(v) = self { v } else { unreachable!() }
2457 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
2458 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
2459 COption_NetworkUpdateZ::Some(o)
2462 /// Constructs a new COption_NetworkUpdateZ containing nothing
2463 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
2464 COption_NetworkUpdateZ::None
2467 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
2468 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
2470 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
2471 /// but with all dynamically-allocated buffers duplicated in new buffers.
2472 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
2474 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2475 /// This corresponds to std::vector in C++
2476 pub struct CVec_SpendableOutputDescriptorZ {
2477 /// The elements in the array.
2478 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2479 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2480 /// The number of elements pointed to by `data`.
2483 impl CVec_SpendableOutputDescriptorZ {
2484 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2485 if self.datalen == 0 { return Vec::new(); }
2486 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2487 self.data = std::ptr::null_mut();
2491 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2492 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2495 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2496 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2497 let datalen = v.len();
2498 let data = Box::into_raw(v.into_boxed_slice());
2499 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2503 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2504 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2505 impl Drop for CVec_SpendableOutputDescriptorZ {
2506 fn drop(&mut self) {
2507 if self.datalen == 0 { return; }
2508 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2511 impl Clone for CVec_SpendableOutputDescriptorZ {
2512 fn clone(&self) -> Self {
2513 let mut res = Vec::new();
2514 if self.datalen == 0 { return Self::from(res); }
2515 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2520 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2521 /// This corresponds to std::vector in C++
2522 pub struct CVec_MessageSendEventZ {
2523 /// The elements in the array.
2524 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2525 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2526 /// The number of elements pointed to by `data`.
2529 impl CVec_MessageSendEventZ {
2530 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2531 if self.datalen == 0 { return Vec::new(); }
2532 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2533 self.data = std::ptr::null_mut();
2537 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2538 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2541 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2542 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2543 let datalen = v.len();
2544 let data = Box::into_raw(v.into_boxed_slice());
2545 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2549 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2550 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2551 impl Drop for CVec_MessageSendEventZ {
2552 fn drop(&mut self) {
2553 if self.datalen == 0 { return; }
2554 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2557 impl Clone for CVec_MessageSendEventZ {
2558 fn clone(&self) -> Self {
2559 let mut res = Vec::new();
2560 if self.datalen == 0 { return Self::from(res); }
2561 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2566 /// The contents of CResult_InitFeaturesDecodeErrorZ
2567 pub union CResult_InitFeaturesDecodeErrorZPtr {
2568 /// A pointer to the contents in the success state.
2569 /// Reading from this pointer when `result_ok` is not set is undefined.
2570 pub result: *mut crate::lightning::ln::features::InitFeatures,
2571 /// A pointer to the contents in the error state.
2572 /// Reading from this pointer when `result_ok` is set is undefined.
2573 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2576 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2577 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2579 pub struct CResult_InitFeaturesDecodeErrorZ {
2580 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2581 /// `err` or `result` depending on the state of `result_ok`.
2582 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2583 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2584 pub result_ok: bool,
2587 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2588 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2589 CResult_InitFeaturesDecodeErrorZ {
2590 contents: CResult_InitFeaturesDecodeErrorZPtr {
2591 result: Box::into_raw(Box::new(o)),
2597 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
2598 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
2599 CResult_InitFeaturesDecodeErrorZ {
2600 contents: CResult_InitFeaturesDecodeErrorZPtr {
2601 err: Box::into_raw(Box::new(e)),
2607 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
2608 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
2609 impl Drop for CResult_InitFeaturesDecodeErrorZ {
2610 fn drop(&mut self) {
2612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2613 let _ = unsafe { Box::from_raw(self.contents.result) };
2616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2617 let _ = unsafe { Box::from_raw(self.contents.err) };
2622 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
2623 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2624 let contents = if o.result_ok {
2625 let result = unsafe { o.contents.result };
2626 unsafe { o.contents.result = std::ptr::null_mut() };
2627 CResult_InitFeaturesDecodeErrorZPtr { result }
2629 let err = unsafe { o.contents.err };
2630 unsafe { o.contents.err = std::ptr::null_mut(); }
2631 CResult_InitFeaturesDecodeErrorZPtr { err }
2635 result_ok: o.result_ok,
2640 /// The contents of CResult_NodeFeaturesDecodeErrorZ
2641 pub union CResult_NodeFeaturesDecodeErrorZPtr {
2642 /// A pointer to the contents in the success state.
2643 /// Reading from this pointer when `result_ok` is not set is undefined.
2644 pub result: *mut crate::lightning::ln::features::NodeFeatures,
2645 /// A pointer to the contents in the error state.
2646 /// Reading from this pointer when `result_ok` is set is undefined.
2647 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2650 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2651 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2653 pub struct CResult_NodeFeaturesDecodeErrorZ {
2654 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2655 /// `err` or `result` depending on the state of `result_ok`.
2656 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
2657 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2658 pub result_ok: bool,
2661 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2662 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2663 CResult_NodeFeaturesDecodeErrorZ {
2664 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2665 result: Box::into_raw(Box::new(o)),
2671 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2672 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2673 CResult_NodeFeaturesDecodeErrorZ {
2674 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2675 err: Box::into_raw(Box::new(e)),
2681 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2682 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2683 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2684 fn drop(&mut self) {
2686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2687 let _ = unsafe { Box::from_raw(self.contents.result) };
2690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2691 let _ = unsafe { Box::from_raw(self.contents.err) };
2696 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2697 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2698 let contents = if o.result_ok {
2699 let result = unsafe { o.contents.result };
2700 unsafe { o.contents.result = std::ptr::null_mut() };
2701 CResult_NodeFeaturesDecodeErrorZPtr { result }
2703 let err = unsafe { o.contents.err };
2704 unsafe { o.contents.err = std::ptr::null_mut(); }
2705 CResult_NodeFeaturesDecodeErrorZPtr { err }
2709 result_ok: o.result_ok,
2714 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2715 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2716 /// A pointer to the contents in the success state.
2717 /// Reading from this pointer when `result_ok` is not set is undefined.
2718 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
2719 /// A pointer to the contents in the error state.
2720 /// Reading from this pointer when `result_ok` is set is undefined.
2721 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2724 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2725 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2727 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2728 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2729 /// `err` or `result` depending on the state of `result_ok`.
2730 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2731 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2732 pub result_ok: bool,
2735 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2736 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2737 CResult_ChannelFeaturesDecodeErrorZ {
2738 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2739 result: Box::into_raw(Box::new(o)),
2745 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2746 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2747 CResult_ChannelFeaturesDecodeErrorZ {
2748 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2749 err: Box::into_raw(Box::new(e)),
2755 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2756 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2757 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
2758 fn drop(&mut self) {
2760 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2761 let _ = unsafe { Box::from_raw(self.contents.result) };
2764 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2765 let _ = unsafe { Box::from_raw(self.contents.err) };
2770 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2771 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2772 let contents = if o.result_ok {
2773 let result = unsafe { o.contents.result };
2774 unsafe { o.contents.result = std::ptr::null_mut() };
2775 CResult_ChannelFeaturesDecodeErrorZPtr { result }
2777 let err = unsafe { o.contents.err };
2778 unsafe { o.contents.err = std::ptr::null_mut(); }
2779 CResult_ChannelFeaturesDecodeErrorZPtr { err }
2783 result_ok: o.result_ok,
2788 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2789 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
2790 /// A pointer to the contents in the success state.
2791 /// Reading from this pointer when `result_ok` is not set is undefined.
2792 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
2793 /// A pointer to the contents in the error state.
2794 /// Reading from this pointer when `result_ok` is set is undefined.
2795 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2798 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2799 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2801 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
2802 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2803 /// `err` or `result` depending on the state of `result_ok`.
2804 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2805 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2806 pub result_ok: bool,
2809 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2810 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2811 CResult_InvoiceFeaturesDecodeErrorZ {
2812 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2813 result: Box::into_raw(Box::new(o)),
2819 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2820 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2821 CResult_InvoiceFeaturesDecodeErrorZ {
2822 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2823 err: Box::into_raw(Box::new(e)),
2829 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2830 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2831 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
2832 fn drop(&mut self) {
2834 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2835 let _ = unsafe { Box::from_raw(self.contents.result) };
2838 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2839 let _ = unsafe { Box::from_raw(self.contents.err) };
2844 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2845 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2846 let contents = if o.result_ok {
2847 let result = unsafe { o.contents.result };
2848 unsafe { o.contents.result = std::ptr::null_mut() };
2849 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
2851 let err = unsafe { o.contents.err };
2852 unsafe { o.contents.err = std::ptr::null_mut(); }
2853 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2857 result_ok: o.result_ok,
2862 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2863 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2864 /// A pointer to the contents in the success state.
2865 /// Reading from this pointer when `result_ok` is not set is undefined.
2866 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
2867 /// A pointer to the contents in the error state.
2868 /// Reading from this pointer when `result_ok` is set is undefined.
2869 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2872 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2873 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2875 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2876 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2877 /// `err` or `result` depending on the state of `result_ok`.
2878 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
2879 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2880 pub result_ok: bool,
2883 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
2884 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2885 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2886 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2887 result: Box::into_raw(Box::new(o)),
2893 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
2894 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2895 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2896 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2897 err: Box::into_raw(Box::new(e)),
2903 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
2904 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
2905 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2906 fn drop(&mut self) {
2908 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2909 let _ = unsafe { Box::from_raw(self.contents.result) };
2912 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2913 let _ = unsafe { Box::from_raw(self.contents.err) };
2918 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2919 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2920 let contents = if o.result_ok {
2921 let result = unsafe { o.contents.result };
2922 unsafe { o.contents.result = std::ptr::null_mut() };
2923 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
2925 let err = unsafe { o.contents.err };
2926 unsafe { o.contents.err = std::ptr::null_mut(); }
2927 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
2931 result_ok: o.result_ok,
2935 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2936 fn clone(&self) -> Self {
2938 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2939 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2942 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2943 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2949 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2950 /// but with all dynamically-allocated buffers duplicated in new buffers.
2951 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
2953 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2954 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2955 /// A pointer to the contents in the success state.
2956 /// Reading from this pointer when `result_ok` is not set is undefined.
2957 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
2958 /// A pointer to the contents in the error state.
2959 /// Reading from this pointer when `result_ok` is set is undefined.
2960 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2963 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2964 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2966 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2967 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2968 /// `err` or `result` depending on the state of `result_ok`.
2969 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
2970 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2971 pub result_ok: bool,
2974 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
2975 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2976 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2977 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2978 result: Box::into_raw(Box::new(o)),
2984 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
2985 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2986 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2987 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2988 err: Box::into_raw(Box::new(e)),
2994 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
2995 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
2996 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2997 fn drop(&mut self) {
2999 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3000 let _ = unsafe { Box::from_raw(self.contents.result) };
3003 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3004 let _ = unsafe { Box::from_raw(self.contents.err) };
3009 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3010 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3011 let contents = if o.result_ok {
3012 let result = unsafe { o.contents.result };
3013 unsafe { o.contents.result = std::ptr::null_mut() };
3014 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
3016 let err = unsafe { o.contents.err };
3017 unsafe { o.contents.err = std::ptr::null_mut(); }
3018 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
3022 result_ok: o.result_ok,
3026 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3027 fn clone(&self) -> Self {
3029 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3030 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3033 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3034 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3040 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3041 /// but with all dynamically-allocated buffers duplicated in new buffers.
3042 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3044 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3045 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3046 /// A pointer to the contents in the success state.
3047 /// Reading from this pointer when `result_ok` is not set is undefined.
3048 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3049 /// A pointer to the contents in the error state.
3050 /// Reading from this pointer when `result_ok` is set is undefined.
3051 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3054 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3055 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3057 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3058 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3059 /// `err` or `result` depending on the state of `result_ok`.
3060 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3061 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3062 pub result_ok: bool,
3065 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
3066 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3067 CResult_SpendableOutputDescriptorDecodeErrorZ {
3068 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3069 result: Box::into_raw(Box::new(o)),
3075 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
3076 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3077 CResult_SpendableOutputDescriptorDecodeErrorZ {
3078 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3079 err: Box::into_raw(Box::new(e)),
3085 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
3086 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3087 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3088 fn drop(&mut self) {
3090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3091 let _ = unsafe { Box::from_raw(self.contents.result) };
3094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3095 let _ = unsafe { Box::from_raw(self.contents.err) };
3100 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3102 let contents = if o.result_ok {
3103 let result = unsafe { o.contents.result };
3104 unsafe { o.contents.result = std::ptr::null_mut() };
3105 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3107 let err = unsafe { o.contents.err };
3108 unsafe { o.contents.err = std::ptr::null_mut(); }
3109 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3113 result_ok: o.result_ok,
3117 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3118 fn clone(&self) -> Self {
3120 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3121 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3124 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3125 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3131 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3132 /// but with all dynamically-allocated buffers duplicated in new buffers.
3133 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3135 /// The contents of CResult_NoneNoneZ
3136 pub union CResult_NoneNoneZPtr {
3137 /// Note that this value is always NULL, as there are no contents in the OK variant
3138 pub result: *mut std::ffi::c_void,
3139 /// Note that this value is always NULL, as there are no contents in the Err variant
3140 pub err: *mut std::ffi::c_void,
3143 /// A CResult_NoneNoneZ represents the result of a fallible operation,
3144 /// containing a () on success and a () on failure.
3145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3146 pub struct CResult_NoneNoneZ {
3147 /// The contents of this CResult_NoneNoneZ, accessible via either
3148 /// `err` or `result` depending on the state of `result_ok`.
3149 pub contents: CResult_NoneNoneZPtr,
3150 /// Whether this CResult_NoneNoneZ represents a success state.
3151 pub result_ok: bool,
3154 /// Creates a new CResult_NoneNoneZ in the success state.
3155 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
3157 contents: CResult_NoneNoneZPtr {
3158 result: std::ptr::null_mut(),
3164 /// Creates a new CResult_NoneNoneZ in the error state.
3165 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
3167 contents: CResult_NoneNoneZPtr {
3168 err: std::ptr::null_mut(),
3174 /// Frees any resources used by the CResult_NoneNoneZ.
3175 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
3176 impl Drop for CResult_NoneNoneZ {
3177 fn drop(&mut self) {
3183 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
3184 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
3185 let contents = if o.result_ok {
3186 let _ = unsafe { Box::from_raw(o.contents.result) };
3187 o.contents.result = std::ptr::null_mut();
3188 CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
3190 let _ = unsafe { Box::from_raw(o.contents.err) };
3191 o.contents.err = std::ptr::null_mut();
3192 CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
3196 result_ok: o.result_ok,
3200 impl Clone for CResult_NoneNoneZ {
3201 fn clone(&self) -> Self {
3203 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
3204 result: std::ptr::null_mut()
3207 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
3208 err: std::ptr::null_mut()
3214 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
3215 /// but with all dynamically-allocated buffers duplicated in new buffers.
3216 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
3218 /// A tuple of 2 elements. See the individual fields for the types contained.
3219 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3220 /// The element at position 0
3221 pub a: crate::c_types::Signature,
3222 /// The element at position 1
3223 pub b: crate::c_types::derived::CVec_SignatureZ,
3225 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3226 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3233 impl C2Tuple_SignatureCVec_SignatureZZ {
3234 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3238 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3239 fn clone(&self) -> Self {
3241 a: Clone::clone(&self.a),
3242 b: Clone::clone(&self.b),
3247 /// Creates a new tuple which has the same data as `orig`
3248 /// but with all dynamically-allocated buffers duplicated in new buffers.
3249 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
3250 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3252 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3253 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3257 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3258 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3260 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3261 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3262 /// A pointer to the contents in the success state.
3263 /// Reading from this pointer when `result_ok` is not set is undefined.
3264 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3265 /// Note that this value is always NULL, as there are no contents in the Err variant
3266 pub err: *mut std::ffi::c_void,
3269 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3270 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3271 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3272 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3273 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3274 /// `err` or `result` depending on the state of `result_ok`.
3275 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3276 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3277 pub result_ok: bool,
3280 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3281 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3282 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3283 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3284 result: Box::into_raw(Box::new(o)),
3290 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3291 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3292 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3293 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3294 err: std::ptr::null_mut(),
3300 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3301 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3302 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3303 fn drop(&mut self) {
3305 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3306 let _ = unsafe { Box::from_raw(self.contents.result) };
3312 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3313 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3314 let contents = if o.result_ok {
3315 let result = unsafe { o.contents.result };
3316 unsafe { o.contents.result = std::ptr::null_mut() };
3317 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3319 let _ = unsafe { Box::from_raw(o.contents.err) };
3320 o.contents.err = std::ptr::null_mut();
3321 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3325 result_ok: o.result_ok,
3329 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3330 fn clone(&self) -> Self {
3332 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3333 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3336 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3337 err: std::ptr::null_mut()
3343 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3344 /// but with all dynamically-allocated buffers duplicated in new buffers.
3345 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
3347 /// The contents of CResult_SignatureNoneZ
3348 pub union CResult_SignatureNoneZPtr {
3349 /// A pointer to the contents in the success state.
3350 /// Reading from this pointer when `result_ok` is not set is undefined.
3351 pub result: *mut crate::c_types::Signature,
3352 /// Note that this value is always NULL, as there are no contents in the Err variant
3353 pub err: *mut std::ffi::c_void,
3356 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3357 /// containing a crate::c_types::Signature on success and a () on failure.
3358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3359 pub struct CResult_SignatureNoneZ {
3360 /// The contents of this CResult_SignatureNoneZ, accessible via either
3361 /// `err` or `result` depending on the state of `result_ok`.
3362 pub contents: CResult_SignatureNoneZPtr,
3363 /// Whether this CResult_SignatureNoneZ represents a success state.
3364 pub result_ok: bool,
3367 /// Creates a new CResult_SignatureNoneZ in the success state.
3368 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3369 CResult_SignatureNoneZ {
3370 contents: CResult_SignatureNoneZPtr {
3371 result: Box::into_raw(Box::new(o)),
3377 /// Creates a new CResult_SignatureNoneZ in the error state.
3378 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3379 CResult_SignatureNoneZ {
3380 contents: CResult_SignatureNoneZPtr {
3381 err: std::ptr::null_mut(),
3387 /// Frees any resources used by the CResult_SignatureNoneZ.
3388 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3389 impl Drop for CResult_SignatureNoneZ {
3390 fn drop(&mut self) {
3392 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3393 let _ = unsafe { Box::from_raw(self.contents.result) };
3399 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3400 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3401 let contents = if o.result_ok {
3402 let result = unsafe { o.contents.result };
3403 unsafe { o.contents.result = std::ptr::null_mut() };
3404 CResult_SignatureNoneZPtr { result }
3406 let _ = unsafe { Box::from_raw(o.contents.err) };
3407 o.contents.err = std::ptr::null_mut();
3408 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3412 result_ok: o.result_ok,
3416 impl Clone for CResult_SignatureNoneZ {
3417 fn clone(&self) -> Self {
3419 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3420 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3423 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3424 err: std::ptr::null_mut()
3430 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3431 /// but with all dynamically-allocated buffers duplicated in new buffers.
3432 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
3434 /// The contents of CResult_SignDecodeErrorZ
3435 pub union CResult_SignDecodeErrorZPtr {
3436 /// A pointer to the contents in the success state.
3437 /// Reading from this pointer when `result_ok` is not set is undefined.
3438 pub result: *mut crate::lightning::chain::keysinterface::Sign,
3439 /// A pointer to the contents in the error state.
3440 /// Reading from this pointer when `result_ok` is set is undefined.
3441 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3444 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3445 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3446 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3447 pub struct CResult_SignDecodeErrorZ {
3448 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3449 /// `err` or `result` depending on the state of `result_ok`.
3450 pub contents: CResult_SignDecodeErrorZPtr,
3451 /// Whether this CResult_SignDecodeErrorZ represents a success state.
3452 pub result_ok: bool,
3455 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3456 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3457 CResult_SignDecodeErrorZ {
3458 contents: CResult_SignDecodeErrorZPtr {
3459 result: Box::into_raw(Box::new(o)),
3465 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3466 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3467 CResult_SignDecodeErrorZ {
3468 contents: CResult_SignDecodeErrorZPtr {
3469 err: Box::into_raw(Box::new(e)),
3475 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3476 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3477 impl Drop for CResult_SignDecodeErrorZ {
3478 fn drop(&mut self) {
3480 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3481 let _ = unsafe { Box::from_raw(self.contents.result) };
3484 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3485 let _ = unsafe { Box::from_raw(self.contents.err) };
3490 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3491 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3492 let contents = if o.result_ok {
3493 let result = unsafe { o.contents.result };
3494 unsafe { o.contents.result = std::ptr::null_mut() };
3495 CResult_SignDecodeErrorZPtr { result }
3497 let err = unsafe { o.contents.err };
3498 unsafe { o.contents.err = std::ptr::null_mut(); }
3499 CResult_SignDecodeErrorZPtr { err }
3503 result_ok: o.result_ok,
3507 impl Clone for CResult_SignDecodeErrorZ {
3508 fn clone(&self) -> Self {
3510 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3511 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3514 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3515 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3521 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3522 /// but with all dynamically-allocated buffers duplicated in new buffers.
3523 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
3525 /// A dynamically-allocated array of u8s of arbitrary size.
3526 /// This corresponds to std::vector in C++
3527 pub struct CVec_u8Z {
3528 /// The elements in the array.
3529 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3531 /// The number of elements pointed to by `data`.
3535 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3536 if self.datalen == 0 { return Vec::new(); }
3537 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3538 self.data = std::ptr::null_mut();
3542 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3543 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3546 impl From<Vec<u8>> for CVec_u8Z {
3547 fn from(v: Vec<u8>) -> Self {
3548 let datalen = v.len();
3549 let data = Box::into_raw(v.into_boxed_slice());
3550 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3554 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3555 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3556 impl Drop for CVec_u8Z {
3557 fn drop(&mut self) {
3558 if self.datalen == 0 { return; }
3559 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3562 impl Clone for CVec_u8Z {
3563 fn clone(&self) -> Self {
3564 let mut res = Vec::new();
3565 if self.datalen == 0 { return Self::from(res); }
3566 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3571 /// The contents of CResult_RecoverableSignatureNoneZ
3572 pub union CResult_RecoverableSignatureNoneZPtr {
3573 /// A pointer to the contents in the success state.
3574 /// Reading from this pointer when `result_ok` is not set is undefined.
3575 pub result: *mut crate::c_types::RecoverableSignature,
3576 /// Note that this value is always NULL, as there are no contents in the Err variant
3577 pub err: *mut std::ffi::c_void,
3580 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3581 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3582 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3583 pub struct CResult_RecoverableSignatureNoneZ {
3584 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3585 /// `err` or `result` depending on the state of `result_ok`.
3586 pub contents: CResult_RecoverableSignatureNoneZPtr,
3587 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3588 pub result_ok: bool,
3591 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
3592 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
3593 CResult_RecoverableSignatureNoneZ {
3594 contents: CResult_RecoverableSignatureNoneZPtr {
3595 result: Box::into_raw(Box::new(o)),
3601 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
3602 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
3603 CResult_RecoverableSignatureNoneZ {
3604 contents: CResult_RecoverableSignatureNoneZPtr {
3605 err: std::ptr::null_mut(),
3611 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
3612 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
3613 impl Drop for CResult_RecoverableSignatureNoneZ {
3614 fn drop(&mut self) {
3616 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3617 let _ = unsafe { Box::from_raw(self.contents.result) };
3623 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
3624 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
3625 let contents = if o.result_ok {
3626 let result = unsafe { o.contents.result };
3627 unsafe { o.contents.result = std::ptr::null_mut() };
3628 CResult_RecoverableSignatureNoneZPtr { result }
3630 let _ = unsafe { Box::from_raw(o.contents.err) };
3631 o.contents.err = std::ptr::null_mut();
3632 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
3636 result_ok: o.result_ok,
3640 impl Clone for CResult_RecoverableSignatureNoneZ {
3641 fn clone(&self) -> Self {
3643 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
3644 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
3647 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
3648 err: std::ptr::null_mut()
3654 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
3655 /// but with all dynamically-allocated buffers duplicated in new buffers.
3656 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
3658 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3659 /// This corresponds to std::vector in C++
3660 pub struct CVec_CVec_u8ZZ {
3661 /// The elements in the array.
3662 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3663 pub data: *mut crate::c_types::derived::CVec_u8Z,
3664 /// The number of elements pointed to by `data`.
3667 impl CVec_CVec_u8ZZ {
3668 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3669 if self.datalen == 0 { return Vec::new(); }
3670 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3671 self.data = std::ptr::null_mut();
3675 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3676 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3679 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3680 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3681 let datalen = v.len();
3682 let data = Box::into_raw(v.into_boxed_slice());
3683 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3687 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3688 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3689 impl Drop for CVec_CVec_u8ZZ {
3690 fn drop(&mut self) {
3691 if self.datalen == 0 { return; }
3692 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3695 impl Clone for CVec_CVec_u8ZZ {
3696 fn clone(&self) -> Self {
3697 let mut res = Vec::new();
3698 if self.datalen == 0 { return Self::from(res); }
3699 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3704 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3705 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3706 /// A pointer to the contents in the success state.
3707 /// Reading from this pointer when `result_ok` is not set is undefined.
3708 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3709 /// Note that this value is always NULL, as there are no contents in the Err variant
3710 pub err: *mut std::ffi::c_void,
3713 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3714 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3715 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3716 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3717 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3718 /// `err` or `result` depending on the state of `result_ok`.
3719 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3720 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3721 pub result_ok: bool,
3724 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3725 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3726 CResult_CVec_CVec_u8ZZNoneZ {
3727 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3728 result: Box::into_raw(Box::new(o)),
3734 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3735 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3736 CResult_CVec_CVec_u8ZZNoneZ {
3737 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3738 err: std::ptr::null_mut(),
3744 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3745 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3746 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3747 fn drop(&mut self) {
3749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3750 let _ = unsafe { Box::from_raw(self.contents.result) };
3756 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3757 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3758 let contents = if o.result_ok {
3759 let result = unsafe { o.contents.result };
3760 unsafe { o.contents.result = std::ptr::null_mut() };
3761 CResult_CVec_CVec_u8ZZNoneZPtr { result }
3763 let _ = unsafe { Box::from_raw(o.contents.err) };
3764 o.contents.err = std::ptr::null_mut();
3765 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
3769 result_ok: o.result_ok,
3773 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3774 fn clone(&self) -> Self {
3776 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3777 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3780 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3781 err: std::ptr::null_mut()
3787 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3788 /// but with all dynamically-allocated buffers duplicated in new buffers.
3789 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
3791 /// The contents of CResult_InMemorySignerDecodeErrorZ
3792 pub union CResult_InMemorySignerDecodeErrorZPtr {
3793 /// A pointer to the contents in the success state.
3794 /// Reading from this pointer when `result_ok` is not set is undefined.
3795 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
3796 /// A pointer to the contents in the error state.
3797 /// Reading from this pointer when `result_ok` is set is undefined.
3798 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3801 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3802 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3804 pub struct CResult_InMemorySignerDecodeErrorZ {
3805 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3806 /// `err` or `result` depending on the state of `result_ok`.
3807 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3808 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3809 pub result_ok: bool,
3812 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3813 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3814 CResult_InMemorySignerDecodeErrorZ {
3815 contents: CResult_InMemorySignerDecodeErrorZPtr {
3816 result: Box::into_raw(Box::new(o)),
3822 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3823 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3824 CResult_InMemorySignerDecodeErrorZ {
3825 contents: CResult_InMemorySignerDecodeErrorZPtr {
3826 err: Box::into_raw(Box::new(e)),
3832 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3833 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3834 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3835 fn drop(&mut self) {
3837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838 let _ = unsafe { Box::from_raw(self.contents.result) };
3841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842 let _ = unsafe { Box::from_raw(self.contents.err) };
3847 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849 let contents = if o.result_ok {
3850 let result = unsafe { o.contents.result };
3851 unsafe { o.contents.result = std::ptr::null_mut() };
3852 CResult_InMemorySignerDecodeErrorZPtr { result }
3854 let err = unsafe { o.contents.err };
3855 unsafe { o.contents.err = std::ptr::null_mut(); }
3856 CResult_InMemorySignerDecodeErrorZPtr { err }
3860 result_ok: o.result_ok,
3864 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3865 fn clone(&self) -> Self {
3867 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3868 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3871 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3872 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3878 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3879 /// but with all dynamically-allocated buffers duplicated in new buffers.
3880 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3882 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3883 /// This corresponds to std::vector in C++
3884 pub struct CVec_TxOutZ {
3885 /// The elements in the array.
3886 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3887 pub data: *mut crate::c_types::TxOut,
3888 /// The number of elements pointed to by `data`.
3892 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
3893 if self.datalen == 0 { return Vec::new(); }
3894 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3895 self.data = std::ptr::null_mut();
3899 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
3900 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3903 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
3904 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
3905 let datalen = v.len();
3906 let data = Box::into_raw(v.into_boxed_slice());
3907 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3911 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3912 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
3913 impl Drop for CVec_TxOutZ {
3914 fn drop(&mut self) {
3915 if self.datalen == 0 { return; }
3916 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3919 impl Clone for CVec_TxOutZ {
3920 fn clone(&self) -> Self {
3921 let mut res = Vec::new();
3922 if self.datalen == 0 { return Self::from(res); }
3923 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3928 /// The contents of CResult_TransactionNoneZ
3929 pub union CResult_TransactionNoneZPtr {
3930 /// A pointer to the contents in the success state.
3931 /// Reading from this pointer when `result_ok` is not set is undefined.
3932 pub result: *mut crate::c_types::Transaction,
3933 /// Note that this value is always NULL, as there are no contents in the Err variant
3934 pub err: *mut std::ffi::c_void,
3937 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3938 /// containing a crate::c_types::Transaction on success and a () on failure.
3939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3940 pub struct CResult_TransactionNoneZ {
3941 /// The contents of this CResult_TransactionNoneZ, accessible via either
3942 /// `err` or `result` depending on the state of `result_ok`.
3943 pub contents: CResult_TransactionNoneZPtr,
3944 /// Whether this CResult_TransactionNoneZ represents a success state.
3945 pub result_ok: bool,
3948 /// Creates a new CResult_TransactionNoneZ in the success state.
3949 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3950 CResult_TransactionNoneZ {
3951 contents: CResult_TransactionNoneZPtr {
3952 result: Box::into_raw(Box::new(o)),
3958 /// Creates a new CResult_TransactionNoneZ in the error state.
3959 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3960 CResult_TransactionNoneZ {
3961 contents: CResult_TransactionNoneZPtr {
3962 err: std::ptr::null_mut(),
3968 /// Frees any resources used by the CResult_TransactionNoneZ.
3969 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3970 impl Drop for CResult_TransactionNoneZ {
3971 fn drop(&mut self) {
3973 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3974 let _ = unsafe { Box::from_raw(self.contents.result) };
3980 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3981 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3982 let contents = if o.result_ok {
3983 let result = unsafe { o.contents.result };
3984 unsafe { o.contents.result = std::ptr::null_mut() };
3985 CResult_TransactionNoneZPtr { result }
3987 let _ = unsafe { Box::from_raw(o.contents.err) };
3988 o.contents.err = std::ptr::null_mut();
3989 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
3993 result_ok: o.result_ok,
3997 impl Clone for CResult_TransactionNoneZ {
3998 fn clone(&self) -> Self {
4000 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
4001 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
4004 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
4005 err: std::ptr::null_mut()
4011 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
4012 /// but with all dynamically-allocated buffers duplicated in new buffers.
4013 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
4015 /// A tuple of 2 elements. See the individual fields for the types contained.
4016 pub struct C2Tuple_BlockHashChannelMonitorZ {
4017 /// The element at position 0
4018 pub a: crate::c_types::ThirtyTwoBytes,
4019 /// The element at position 1
4020 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
4022 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4023 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
4030 impl C2Tuple_BlockHashChannelMonitorZ {
4031 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
4035 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4037 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4038 C2Tuple_BlockHashChannelMonitorZ { a, b, }
4042 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4043 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4045 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4046 /// This corresponds to std::vector in C++
4047 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
4048 /// The elements in the array.
4049 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4050 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4051 /// The number of elements pointed to by `data`.
4054 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
4055 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
4056 if self.datalen == 0 { return Vec::new(); }
4057 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4058 self.data = std::ptr::null_mut();
4062 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
4063 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4066 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4067 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
4068 let datalen = v.len();
4069 let data = Box::into_raw(v.into_boxed_slice());
4070 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4074 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4075 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
4076 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4077 fn drop(&mut self) {
4078 if self.datalen == 0 { return; }
4079 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4083 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4084 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4085 /// A pointer to the contents in the success state.
4086 /// Reading from this pointer when `result_ok` is not set is undefined.
4087 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
4088 /// A pointer to the contents in the error state.
4089 /// Reading from this pointer when `result_ok` is set is undefined.
4090 pub err: *mut crate::c_types::IOError,
4093 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4094 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4096 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4097 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4098 /// `err` or `result` depending on the state of `result_ok`.
4099 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
4100 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4101 pub result_ok: bool,
4104 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
4105 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4106 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4107 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4108 result: Box::into_raw(Box::new(o)),
4114 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
4115 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4116 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4117 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4118 err: Box::into_raw(Box::new(e)),
4124 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
4125 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
4126 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4127 fn drop(&mut self) {
4129 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4130 let _ = unsafe { Box::from_raw(self.contents.result) };
4133 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4134 let _ = unsafe { Box::from_raw(self.contents.err) };
4139 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4140 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
4141 let contents = if o.result_ok {
4142 let result = unsafe { o.contents.result };
4143 unsafe { o.contents.result = std::ptr::null_mut() };
4144 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
4146 let err = unsafe { o.contents.err };
4147 unsafe { o.contents.err = std::ptr::null_mut(); }
4148 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
4152 result_ok: o.result_ok,
4158 /// An enum which can either contain a u16 or not
4159 pub enum COption_u16Z {
4160 /// When we're in this state, this COption_u16Z contains a u16
4162 /// When we're in this state, this COption_u16Z contains nothing
4166 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4167 if let Self::Some(_) = self { true } else { false }
4169 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4172 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
4173 if let Self::Some(v) = self { v } else { unreachable!() }
4177 /// Constructs a new COption_u16Z containing a u16
4178 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
4179 COption_u16Z::Some(o)
4182 /// Constructs a new COption_u16Z containing nothing
4183 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
4187 /// Frees any resources associated with the u16, if we are in the Some state
4188 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
4190 /// Creates a new COption_u16Z which has the same data as `orig`
4191 /// but with all dynamically-allocated buffers duplicated in new buffers.
4192 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
4194 /// The contents of CResult_NoneAPIErrorZ
4195 pub union CResult_NoneAPIErrorZPtr {
4196 /// Note that this value is always NULL, as there are no contents in the OK variant
4197 pub result: *mut std::ffi::c_void,
4198 /// A pointer to the contents in the error state.
4199 /// Reading from this pointer when `result_ok` is set is undefined.
4200 pub err: *mut crate::lightning::util::errors::APIError,
4203 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4204 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4206 pub struct CResult_NoneAPIErrorZ {
4207 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4208 /// `err` or `result` depending on the state of `result_ok`.
4209 pub contents: CResult_NoneAPIErrorZPtr,
4210 /// Whether this CResult_NoneAPIErrorZ represents a success state.
4211 pub result_ok: bool,
4214 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4215 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4216 CResult_NoneAPIErrorZ {
4217 contents: CResult_NoneAPIErrorZPtr {
4218 result: std::ptr::null_mut(),
4224 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4225 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4226 CResult_NoneAPIErrorZ {
4227 contents: CResult_NoneAPIErrorZPtr {
4228 err: Box::into_raw(Box::new(e)),
4234 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4235 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4236 impl Drop for CResult_NoneAPIErrorZ {
4237 fn drop(&mut self) {
4240 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4241 let _ = unsafe { Box::from_raw(self.contents.err) };
4246 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4247 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4248 let contents = if o.result_ok {
4249 let _ = unsafe { Box::from_raw(o.contents.result) };
4250 o.contents.result = std::ptr::null_mut();
4251 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4253 let err = unsafe { o.contents.err };
4254 unsafe { o.contents.err = std::ptr::null_mut(); }
4255 CResult_NoneAPIErrorZPtr { err }
4259 result_ok: o.result_ok,
4263 impl Clone for CResult_NoneAPIErrorZ {
4264 fn clone(&self) -> Self {
4266 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4267 result: std::ptr::null_mut()
4270 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4271 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4277 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4278 /// but with all dynamically-allocated buffers duplicated in new buffers.
4279 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
4281 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4282 /// This corresponds to std::vector in C++
4283 pub struct CVec_CResult_NoneAPIErrorZZ {
4284 /// The elements in the array.
4285 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4286 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4287 /// The number of elements pointed to by `data`.
4290 impl CVec_CResult_NoneAPIErrorZZ {
4291 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4292 if self.datalen == 0 { return Vec::new(); }
4293 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4294 self.data = std::ptr::null_mut();
4298 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4299 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4302 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4303 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4304 let datalen = v.len();
4305 let data = Box::into_raw(v.into_boxed_slice());
4306 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4310 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4311 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4312 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4313 fn drop(&mut self) {
4314 if self.datalen == 0 { return; }
4315 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4318 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4319 fn clone(&self) -> Self {
4320 let mut res = Vec::new();
4321 if self.datalen == 0 { return Self::from(res); }
4322 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4327 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4328 /// This corresponds to std::vector in C++
4329 pub struct CVec_APIErrorZ {
4330 /// The elements in the array.
4331 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4332 pub data: *mut crate::lightning::util::errors::APIError,
4333 /// The number of elements pointed to by `data`.
4336 impl CVec_APIErrorZ {
4337 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4338 if self.datalen == 0 { return Vec::new(); }
4339 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4340 self.data = std::ptr::null_mut();
4344 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4345 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4348 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4349 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4350 let datalen = v.len();
4351 let data = Box::into_raw(v.into_boxed_slice());
4352 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4356 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4357 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4358 impl Drop for CVec_APIErrorZ {
4359 fn drop(&mut self) {
4360 if self.datalen == 0 { return; }
4361 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4364 impl Clone for CVec_APIErrorZ {
4365 fn clone(&self) -> Self {
4366 let mut res = Vec::new();
4367 if self.datalen == 0 { return Self::from(res); }
4368 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4373 /// The contents of CResult_NonePaymentSendFailureZ
4374 pub union CResult_NonePaymentSendFailureZPtr {
4375 /// Note that this value is always NULL, as there are no contents in the OK variant
4376 pub result: *mut std::ffi::c_void,
4377 /// A pointer to the contents in the error state.
4378 /// Reading from this pointer when `result_ok` is set is undefined.
4379 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4382 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4383 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4385 pub struct CResult_NonePaymentSendFailureZ {
4386 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4387 /// `err` or `result` depending on the state of `result_ok`.
4388 pub contents: CResult_NonePaymentSendFailureZPtr,
4389 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4390 pub result_ok: bool,
4393 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4394 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4395 CResult_NonePaymentSendFailureZ {
4396 contents: CResult_NonePaymentSendFailureZPtr {
4397 result: std::ptr::null_mut(),
4403 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4404 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4405 CResult_NonePaymentSendFailureZ {
4406 contents: CResult_NonePaymentSendFailureZPtr {
4407 err: Box::into_raw(Box::new(e)),
4413 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4414 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4415 impl Drop for CResult_NonePaymentSendFailureZ {
4416 fn drop(&mut self) {
4419 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4420 let _ = unsafe { Box::from_raw(self.contents.err) };
4425 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4426 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4427 let contents = if o.result_ok {
4428 let _ = unsafe { Box::from_raw(o.contents.result) };
4429 o.contents.result = std::ptr::null_mut();
4430 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4432 let err = unsafe { o.contents.err };
4433 unsafe { o.contents.err = std::ptr::null_mut(); }
4434 CResult_NonePaymentSendFailureZPtr { err }
4438 result_ok: o.result_ok,
4442 impl Clone for CResult_NonePaymentSendFailureZ {
4443 fn clone(&self) -> Self {
4445 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4446 result: std::ptr::null_mut()
4449 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4450 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4456 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4457 /// but with all dynamically-allocated buffers duplicated in new buffers.
4458 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
4460 /// The contents of CResult_PaymentHashPaymentSendFailureZ
4461 pub union CResult_PaymentHashPaymentSendFailureZPtr {
4462 /// A pointer to the contents in the success state.
4463 /// Reading from this pointer when `result_ok` is not set is undefined.
4464 pub result: *mut crate::c_types::ThirtyTwoBytes,
4465 /// A pointer to the contents in the error state.
4466 /// Reading from this pointer when `result_ok` is set is undefined.
4467 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4470 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
4471 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4473 pub struct CResult_PaymentHashPaymentSendFailureZ {
4474 /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
4475 /// `err` or `result` depending on the state of `result_ok`.
4476 pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
4477 /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
4478 pub result_ok: bool,
4481 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
4482 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
4483 CResult_PaymentHashPaymentSendFailureZ {
4484 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4485 result: Box::into_raw(Box::new(o)),
4491 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
4492 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
4493 CResult_PaymentHashPaymentSendFailureZ {
4494 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4495 err: Box::into_raw(Box::new(e)),
4501 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
4502 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
4503 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
4504 fn drop(&mut self) {
4506 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4507 let _ = unsafe { Box::from_raw(self.contents.result) };
4510 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4511 let _ = unsafe { Box::from_raw(self.contents.err) };
4516 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
4517 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4518 let contents = if o.result_ok {
4519 let result = unsafe { o.contents.result };
4520 unsafe { o.contents.result = std::ptr::null_mut() };
4521 CResult_PaymentHashPaymentSendFailureZPtr { result }
4523 let err = unsafe { o.contents.err };
4524 unsafe { o.contents.err = std::ptr::null_mut(); }
4525 CResult_PaymentHashPaymentSendFailureZPtr { err }
4529 result_ok: o.result_ok,
4533 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
4534 fn clone(&self) -> Self {
4536 Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4537 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4540 Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4541 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4547 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
4548 /// but with all dynamically-allocated buffers duplicated in new buffers.
4549 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
4551 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4552 /// This corresponds to std::vector in C++
4553 pub struct CVec_NetAddressZ {
4554 /// The elements in the array.
4555 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4556 pub data: *mut crate::lightning::ln::msgs::NetAddress,
4557 /// The number of elements pointed to by `data`.
4560 impl CVec_NetAddressZ {
4561 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4562 if self.datalen == 0 { return Vec::new(); }
4563 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4564 self.data = std::ptr::null_mut();
4568 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4569 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4572 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4573 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4574 let datalen = v.len();
4575 let data = Box::into_raw(v.into_boxed_slice());
4576 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4580 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4581 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4582 impl Drop for CVec_NetAddressZ {
4583 fn drop(&mut self) {
4584 if self.datalen == 0 { return; }
4585 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4588 impl Clone for CVec_NetAddressZ {
4589 fn clone(&self) -> Self {
4590 let mut res = Vec::new();
4591 if self.datalen == 0 { return Self::from(res); }
4592 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4597 /// A tuple of 2 elements. See the individual fields for the types contained.
4598 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4599 /// The element at position 0
4600 pub a: crate::c_types::ThirtyTwoBytes,
4601 /// The element at position 1
4602 pub b: crate::c_types::ThirtyTwoBytes,
4604 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4605 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4612 impl C2Tuple_PaymentHashPaymentSecretZ {
4613 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4617 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4618 fn clone(&self) -> Self {
4620 a: Clone::clone(&self.a),
4621 b: Clone::clone(&self.b),
4626 /// Creates a new tuple which has the same data as `orig`
4627 /// but with all dynamically-allocated buffers duplicated in new buffers.
4628 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
4629 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4631 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4632 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4636 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4637 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4639 /// The contents of CResult_PaymentSecretAPIErrorZ
4640 pub union CResult_PaymentSecretAPIErrorZPtr {
4641 /// A pointer to the contents in the success state.
4642 /// Reading from this pointer when `result_ok` is not set is undefined.
4643 pub result: *mut crate::c_types::ThirtyTwoBytes,
4644 /// A pointer to the contents in the error state.
4645 /// Reading from this pointer when `result_ok` is set is undefined.
4646 pub err: *mut crate::lightning::util::errors::APIError,
4649 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4650 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4652 pub struct CResult_PaymentSecretAPIErrorZ {
4653 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4654 /// `err` or `result` depending on the state of `result_ok`.
4655 pub contents: CResult_PaymentSecretAPIErrorZPtr,
4656 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4657 pub result_ok: bool,
4660 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4661 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4662 CResult_PaymentSecretAPIErrorZ {
4663 contents: CResult_PaymentSecretAPIErrorZPtr {
4664 result: Box::into_raw(Box::new(o)),
4670 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4671 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4672 CResult_PaymentSecretAPIErrorZ {
4673 contents: CResult_PaymentSecretAPIErrorZPtr {
4674 err: Box::into_raw(Box::new(e)),
4680 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4681 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4682 impl Drop for CResult_PaymentSecretAPIErrorZ {
4683 fn drop(&mut self) {
4685 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4686 let _ = unsafe { Box::from_raw(self.contents.result) };
4689 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4690 let _ = unsafe { Box::from_raw(self.contents.err) };
4695 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4696 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4697 let contents = if o.result_ok {
4698 let result = unsafe { o.contents.result };
4699 unsafe { o.contents.result = std::ptr::null_mut() };
4700 CResult_PaymentSecretAPIErrorZPtr { result }
4702 let err = unsafe { o.contents.err };
4703 unsafe { o.contents.err = std::ptr::null_mut(); }
4704 CResult_PaymentSecretAPIErrorZPtr { err }
4708 result_ok: o.result_ok,
4712 impl Clone for CResult_PaymentSecretAPIErrorZ {
4713 fn clone(&self) -> Self {
4715 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4716 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4719 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4720 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4726 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4727 /// but with all dynamically-allocated buffers duplicated in new buffers.
4728 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
4730 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4731 /// This corresponds to std::vector in C++
4732 pub struct CVec_ChannelMonitorZ {
4733 /// The elements in the array.
4734 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4735 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4736 /// The number of elements pointed to by `data`.
4739 impl CVec_ChannelMonitorZ {
4740 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4741 if self.datalen == 0 { return Vec::new(); }
4742 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4743 self.data = std::ptr::null_mut();
4747 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4748 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4751 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4752 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4753 let datalen = v.len();
4754 let data = Box::into_raw(v.into_boxed_slice());
4755 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4759 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4760 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4761 impl Drop for CVec_ChannelMonitorZ {
4762 fn drop(&mut self) {
4763 if self.datalen == 0 { return; }
4764 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4768 /// A tuple of 2 elements. See the individual fields for the types contained.
4769 pub struct C2Tuple_BlockHashChannelManagerZ {
4770 /// The element at position 0
4771 pub a: crate::c_types::ThirtyTwoBytes,
4772 /// The element at position 1
4773 pub b: crate::lightning::ln::channelmanager::ChannelManager,
4775 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4776 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4783 impl C2Tuple_BlockHashChannelManagerZ {
4784 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4788 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4790 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4791 C2Tuple_BlockHashChannelManagerZ { a, b, }
4795 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4796 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4798 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4799 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4800 /// A pointer to the contents in the success state.
4801 /// Reading from this pointer when `result_ok` is not set is undefined.
4802 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4803 /// A pointer to the contents in the error state.
4804 /// Reading from this pointer when `result_ok` is set is undefined.
4805 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4808 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4809 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4810 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4811 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4812 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4813 /// `err` or `result` depending on the state of `result_ok`.
4814 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4815 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4816 pub result_ok: bool,
4819 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4820 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4821 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4822 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4823 result: Box::into_raw(Box::new(o)),
4829 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4830 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4831 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4832 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4833 err: Box::into_raw(Box::new(e)),
4839 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4840 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4841 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4842 fn drop(&mut self) {
4844 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4845 let _ = unsafe { Box::from_raw(self.contents.result) };
4848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4849 let _ = unsafe { Box::from_raw(self.contents.err) };
4854 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4855 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4856 let contents = if o.result_ok {
4857 let result = unsafe { o.contents.result };
4858 unsafe { o.contents.result = std::ptr::null_mut() };
4859 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4861 let err = unsafe { o.contents.err };
4862 unsafe { o.contents.err = std::ptr::null_mut(); }
4863 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4867 result_ok: o.result_ok,
4872 /// The contents of CResult_ChannelConfigDecodeErrorZ
4873 pub union CResult_ChannelConfigDecodeErrorZPtr {
4874 /// A pointer to the contents in the success state.
4875 /// Reading from this pointer when `result_ok` is not set is undefined.
4876 pub result: *mut crate::lightning::util::config::ChannelConfig,
4877 /// A pointer to the contents in the error state.
4878 /// Reading from this pointer when `result_ok` is set is undefined.
4879 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4882 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4883 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4885 pub struct CResult_ChannelConfigDecodeErrorZ {
4886 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4887 /// `err` or `result` depending on the state of `result_ok`.
4888 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4889 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4890 pub result_ok: bool,
4893 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4894 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4895 CResult_ChannelConfigDecodeErrorZ {
4896 contents: CResult_ChannelConfigDecodeErrorZPtr {
4897 result: Box::into_raw(Box::new(o)),
4903 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4904 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4905 CResult_ChannelConfigDecodeErrorZ {
4906 contents: CResult_ChannelConfigDecodeErrorZPtr {
4907 err: Box::into_raw(Box::new(e)),
4913 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4914 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4915 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4916 fn drop(&mut self) {
4918 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4919 let _ = unsafe { Box::from_raw(self.contents.result) };
4922 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4923 let _ = unsafe { Box::from_raw(self.contents.err) };
4928 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4929 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4930 let contents = if o.result_ok {
4931 let result = unsafe { o.contents.result };
4932 unsafe { o.contents.result = std::ptr::null_mut() };
4933 CResult_ChannelConfigDecodeErrorZPtr { result }
4935 let err = unsafe { o.contents.err };
4936 unsafe { o.contents.err = std::ptr::null_mut(); }
4937 CResult_ChannelConfigDecodeErrorZPtr { err }
4941 result_ok: o.result_ok,
4945 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4946 fn clone(&self) -> Self {
4948 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4949 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4952 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4953 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4959 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4960 /// but with all dynamically-allocated buffers duplicated in new buffers.
4961 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
4963 /// The contents of CResult_OutPointDecodeErrorZ
4964 pub union CResult_OutPointDecodeErrorZPtr {
4965 /// A pointer to the contents in the success state.
4966 /// Reading from this pointer when `result_ok` is not set is undefined.
4967 pub result: *mut crate::lightning::chain::transaction::OutPoint,
4968 /// A pointer to the contents in the error state.
4969 /// Reading from this pointer when `result_ok` is set is undefined.
4970 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4973 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4974 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4976 pub struct CResult_OutPointDecodeErrorZ {
4977 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4978 /// `err` or `result` depending on the state of `result_ok`.
4979 pub contents: CResult_OutPointDecodeErrorZPtr,
4980 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4981 pub result_ok: bool,
4984 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4985 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4986 CResult_OutPointDecodeErrorZ {
4987 contents: CResult_OutPointDecodeErrorZPtr {
4988 result: Box::into_raw(Box::new(o)),
4994 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4995 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4996 CResult_OutPointDecodeErrorZ {
4997 contents: CResult_OutPointDecodeErrorZPtr {
4998 err: Box::into_raw(Box::new(e)),
5004 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
5005 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
5006 impl Drop for CResult_OutPointDecodeErrorZ {
5007 fn drop(&mut self) {
5009 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5010 let _ = unsafe { Box::from_raw(self.contents.result) };
5013 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5014 let _ = unsafe { Box::from_raw(self.contents.err) };
5019 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
5020 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5021 let contents = if o.result_ok {
5022 let result = unsafe { o.contents.result };
5023 unsafe { o.contents.result = std::ptr::null_mut() };
5024 CResult_OutPointDecodeErrorZPtr { result }
5026 let err = unsafe { o.contents.err };
5027 unsafe { o.contents.err = std::ptr::null_mut(); }
5028 CResult_OutPointDecodeErrorZPtr { err }
5032 result_ok: o.result_ok,
5036 impl Clone for CResult_OutPointDecodeErrorZ {
5037 fn clone(&self) -> Self {
5039 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
5040 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
5043 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
5044 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5050 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
5051 /// but with all dynamically-allocated buffers duplicated in new buffers.
5052 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
5054 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
5055 pub enum COption_TypeZ {
5056 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5057 Some(crate::lightning::ln::wire::Type),
5058 /// When we're in this state, this COption_TypeZ contains nothing
5061 impl COption_TypeZ {
5062 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5063 if let Self::Some(_) = self { true } else { false }
5065 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5068 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
5069 if let Self::Some(v) = self { v } else { unreachable!() }
5073 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
5074 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
5075 COption_TypeZ::Some(o)
5078 /// Constructs a new COption_TypeZ containing nothing
5079 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
5083 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
5084 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
5086 /// The contents of CResult_COption_TypeZDecodeErrorZ
5087 pub union CResult_COption_TypeZDecodeErrorZPtr {
5088 /// A pointer to the contents in the success state.
5089 /// Reading from this pointer when `result_ok` is not set is undefined.
5090 pub result: *mut crate::c_types::derived::COption_TypeZ,
5091 /// A pointer to the contents in the error state.
5092 /// Reading from this pointer when `result_ok` is set is undefined.
5093 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5096 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5097 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5099 pub struct CResult_COption_TypeZDecodeErrorZ {
5100 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5101 /// `err` or `result` depending on the state of `result_ok`.
5102 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
5103 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5104 pub result_ok: bool,
5107 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
5108 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
5109 CResult_COption_TypeZDecodeErrorZ {
5110 contents: CResult_COption_TypeZDecodeErrorZPtr {
5111 result: Box::into_raw(Box::new(o)),
5117 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
5118 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
5119 CResult_COption_TypeZDecodeErrorZ {
5120 contents: CResult_COption_TypeZDecodeErrorZPtr {
5121 err: Box::into_raw(Box::new(e)),
5127 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
5128 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
5129 impl Drop for CResult_COption_TypeZDecodeErrorZ {
5130 fn drop(&mut self) {
5132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5133 let _ = unsafe { Box::from_raw(self.contents.result) };
5136 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5137 let _ = unsafe { Box::from_raw(self.contents.err) };
5142 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
5143 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5144 let contents = if o.result_ok {
5145 let result = unsafe { o.contents.result };
5146 unsafe { o.contents.result = std::ptr::null_mut() };
5147 CResult_COption_TypeZDecodeErrorZPtr { result }
5149 let err = unsafe { o.contents.err };
5150 unsafe { o.contents.err = std::ptr::null_mut(); }
5151 CResult_COption_TypeZDecodeErrorZPtr { err }
5155 result_ok: o.result_ok,
5160 /// The contents of CResult_SiPrefixNoneZ
5161 pub union CResult_SiPrefixNoneZPtr {
5162 /// A pointer to the contents in the success state.
5163 /// Reading from this pointer when `result_ok` is not set is undefined.
5164 pub result: *mut crate::lightning_invoice::SiPrefix,
5165 /// Note that this value is always NULL, as there are no contents in the Err variant
5166 pub err: *mut std::ffi::c_void,
5169 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5170 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_SiPrefixNoneZ {
5173 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
5174 /// `err` or `result` depending on the state of `result_ok`.
5175 pub contents: CResult_SiPrefixNoneZPtr,
5176 /// Whether this CResult_SiPrefixNoneZ represents a success state.
5177 pub result_ok: bool,
5180 /// Creates a new CResult_SiPrefixNoneZ in the success state.
5181 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
5182 CResult_SiPrefixNoneZ {
5183 contents: CResult_SiPrefixNoneZPtr {
5184 result: Box::into_raw(Box::new(o)),
5190 /// Creates a new CResult_SiPrefixNoneZ in the error state.
5191 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
5192 CResult_SiPrefixNoneZ {
5193 contents: CResult_SiPrefixNoneZPtr {
5194 err: std::ptr::null_mut(),
5200 /// Frees any resources used by the CResult_SiPrefixNoneZ.
5201 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
5202 impl Drop for CResult_SiPrefixNoneZ {
5203 fn drop(&mut self) {
5205 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5206 let _ = unsafe { Box::from_raw(self.contents.result) };
5212 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
5213 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
5214 let contents = if o.result_ok {
5215 let result = unsafe { o.contents.result };
5216 unsafe { o.contents.result = std::ptr::null_mut() };
5217 CResult_SiPrefixNoneZPtr { result }
5219 let _ = unsafe { Box::from_raw(o.contents.err) };
5220 o.contents.err = std::ptr::null_mut();
5221 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
5225 result_ok: o.result_ok,
5229 impl Clone for CResult_SiPrefixNoneZ {
5230 fn clone(&self) -> Self {
5232 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
5233 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
5236 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
5237 err: std::ptr::null_mut()
5243 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
5244 /// but with all dynamically-allocated buffers duplicated in new buffers.
5245 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
5247 /// The contents of CResult_InvoiceNoneZ
5248 pub union CResult_InvoiceNoneZPtr {
5249 /// A pointer to the contents in the success state.
5250 /// Reading from this pointer when `result_ok` is not set is undefined.
5251 pub result: *mut crate::lightning_invoice::Invoice,
5252 /// Note that this value is always NULL, as there are no contents in the Err variant
5253 pub err: *mut std::ffi::c_void,
5256 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
5257 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
5258 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5259 pub struct CResult_InvoiceNoneZ {
5260 /// The contents of this CResult_InvoiceNoneZ, accessible via either
5261 /// `err` or `result` depending on the state of `result_ok`.
5262 pub contents: CResult_InvoiceNoneZPtr,
5263 /// Whether this CResult_InvoiceNoneZ represents a success state.
5264 pub result_ok: bool,
5267 /// Creates a new CResult_InvoiceNoneZ in the success state.
5268 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
5269 CResult_InvoiceNoneZ {
5270 contents: CResult_InvoiceNoneZPtr {
5271 result: Box::into_raw(Box::new(o)),
5277 /// Creates a new CResult_InvoiceNoneZ in the error state.
5278 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
5279 CResult_InvoiceNoneZ {
5280 contents: CResult_InvoiceNoneZPtr {
5281 err: std::ptr::null_mut(),
5287 /// Frees any resources used by the CResult_InvoiceNoneZ.
5288 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
5289 impl Drop for CResult_InvoiceNoneZ {
5290 fn drop(&mut self) {
5292 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5293 let _ = unsafe { Box::from_raw(self.contents.result) };
5299 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
5300 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
5301 let contents = if o.result_ok {
5302 let result = unsafe { o.contents.result };
5303 unsafe { o.contents.result = std::ptr::null_mut() };
5304 CResult_InvoiceNoneZPtr { result }
5306 let _ = unsafe { Box::from_raw(o.contents.err) };
5307 o.contents.err = std::ptr::null_mut();
5308 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
5312 result_ok: o.result_ok,
5316 impl Clone for CResult_InvoiceNoneZ {
5317 fn clone(&self) -> Self {
5319 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
5320 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5323 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
5324 err: std::ptr::null_mut()
5330 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
5331 /// but with all dynamically-allocated buffers duplicated in new buffers.
5332 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
5334 /// The contents of CResult_SignedRawInvoiceNoneZ
5335 pub union CResult_SignedRawInvoiceNoneZPtr {
5336 /// A pointer to the contents in the success state.
5337 /// Reading from this pointer when `result_ok` is not set is undefined.
5338 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
5339 /// Note that this value is always NULL, as there are no contents in the Err variant
5340 pub err: *mut std::ffi::c_void,
5343 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5344 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5346 pub struct CResult_SignedRawInvoiceNoneZ {
5347 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5348 /// `err` or `result` depending on the state of `result_ok`.
5349 pub contents: CResult_SignedRawInvoiceNoneZPtr,
5350 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5351 pub result_ok: bool,
5354 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
5355 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
5356 CResult_SignedRawInvoiceNoneZ {
5357 contents: CResult_SignedRawInvoiceNoneZPtr {
5358 result: Box::into_raw(Box::new(o)),
5364 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
5365 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
5366 CResult_SignedRawInvoiceNoneZ {
5367 contents: CResult_SignedRawInvoiceNoneZPtr {
5368 err: std::ptr::null_mut(),
5374 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
5375 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
5376 impl Drop for CResult_SignedRawInvoiceNoneZ {
5377 fn drop(&mut self) {
5379 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5380 let _ = unsafe { Box::from_raw(self.contents.result) };
5386 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
5387 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
5388 let contents = if o.result_ok {
5389 let result = unsafe { o.contents.result };
5390 unsafe { o.contents.result = std::ptr::null_mut() };
5391 CResult_SignedRawInvoiceNoneZPtr { result }
5393 let _ = unsafe { Box::from_raw(o.contents.err) };
5394 o.contents.err = std::ptr::null_mut();
5395 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
5399 result_ok: o.result_ok,
5403 impl Clone for CResult_SignedRawInvoiceNoneZ {
5404 fn clone(&self) -> Self {
5406 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
5407 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
5410 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
5411 err: std::ptr::null_mut()
5417 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
5418 /// but with all dynamically-allocated buffers duplicated in new buffers.
5419 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
5421 /// A tuple of 3 elements. See the individual fields for the types contained.
5422 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5423 /// The element at position 0
5424 pub a: crate::lightning_invoice::RawInvoice,
5425 /// The element at position 1
5426 pub b: crate::c_types::ThirtyTwoBytes,
5427 /// The element at position 2
5428 pub c: crate::lightning_invoice::InvoiceSignature,
5430 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5431 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
5439 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5440 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
5441 (self.a, self.b, self.c)
5444 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5445 fn clone(&self) -> Self {
5447 a: Clone::clone(&self.a),
5448 b: Clone::clone(&self.b),
5449 c: Clone::clone(&self.c),
5454 /// Creates a new tuple which has the same data as `orig`
5455 /// but with all dynamically-allocated buffers duplicated in new buffers.
5456 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
5457 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
5459 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 {
5460 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
5464 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
5465 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
5467 /// The contents of CResult_PayeePubKeyErrorZ
5468 pub union CResult_PayeePubKeyErrorZPtr {
5469 /// A pointer to the contents in the success state.
5470 /// Reading from this pointer when `result_ok` is not set is undefined.
5471 pub result: *mut crate::lightning_invoice::PayeePubKey,
5472 /// A pointer to the contents in the error state.
5473 /// Reading from this pointer when `result_ok` is set is undefined.
5474 pub err: *mut crate::c_types::Secp256k1Error,
5477 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5478 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5479 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5480 pub struct CResult_PayeePubKeyErrorZ {
5481 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5482 /// `err` or `result` depending on the state of `result_ok`.
5483 pub contents: CResult_PayeePubKeyErrorZPtr,
5484 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
5485 pub result_ok: bool,
5488 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
5489 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
5490 CResult_PayeePubKeyErrorZ {
5491 contents: CResult_PayeePubKeyErrorZPtr {
5492 result: Box::into_raw(Box::new(o)),
5498 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
5499 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
5500 CResult_PayeePubKeyErrorZ {
5501 contents: CResult_PayeePubKeyErrorZPtr {
5502 err: Box::into_raw(Box::new(e)),
5508 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
5509 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
5510 impl Drop for CResult_PayeePubKeyErrorZ {
5511 fn drop(&mut self) {
5513 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5514 let _ = unsafe { Box::from_raw(self.contents.result) };
5517 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5518 let _ = unsafe { Box::from_raw(self.contents.err) };
5523 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
5524 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
5525 let contents = if o.result_ok {
5526 let result = unsafe { o.contents.result };
5527 unsafe { o.contents.result = std::ptr::null_mut() };
5528 CResult_PayeePubKeyErrorZPtr { result }
5530 let err = unsafe { o.contents.err };
5531 unsafe { o.contents.err = std::ptr::null_mut(); }
5532 CResult_PayeePubKeyErrorZPtr { err }
5536 result_ok: o.result_ok,
5540 impl Clone for CResult_PayeePubKeyErrorZ {
5541 fn clone(&self) -> Self {
5543 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
5544 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
5547 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
5548 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5554 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
5555 /// but with all dynamically-allocated buffers duplicated in new buffers.
5556 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
5558 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5559 /// This corresponds to std::vector in C++
5560 pub struct CVec_PrivateRouteZ {
5561 /// The elements in the array.
5562 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5563 pub data: *mut crate::lightning_invoice::PrivateRoute,
5564 /// The number of elements pointed to by `data`.
5567 impl CVec_PrivateRouteZ {
5568 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5569 if self.datalen == 0 { return Vec::new(); }
5570 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5571 self.data = std::ptr::null_mut();
5575 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5576 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5579 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5580 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5581 let datalen = v.len();
5582 let data = Box::into_raw(v.into_boxed_slice());
5583 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5587 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5588 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5589 impl Drop for CVec_PrivateRouteZ {
5590 fn drop(&mut self) {
5591 if self.datalen == 0 { return; }
5592 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5595 impl Clone for CVec_PrivateRouteZ {
5596 fn clone(&self) -> Self {
5597 let mut res = Vec::new();
5598 if self.datalen == 0 { return Self::from(res); }
5599 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5604 /// The contents of CResult_PositiveTimestampCreationErrorZ
5605 pub union CResult_PositiveTimestampCreationErrorZPtr {
5606 /// A pointer to the contents in the success state.
5607 /// Reading from this pointer when `result_ok` is not set is undefined.
5608 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5609 /// A pointer to the contents in the error state.
5610 /// Reading from this pointer when `result_ok` is set is undefined.
5611 pub err: *mut crate::lightning_invoice::CreationError,
5614 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5615 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5617 pub struct CResult_PositiveTimestampCreationErrorZ {
5618 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5619 /// `err` or `result` depending on the state of `result_ok`.
5620 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5621 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5622 pub result_ok: bool,
5625 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5626 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5627 CResult_PositiveTimestampCreationErrorZ {
5628 contents: CResult_PositiveTimestampCreationErrorZPtr {
5629 result: Box::into_raw(Box::new(o)),
5635 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5636 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5637 CResult_PositiveTimestampCreationErrorZ {
5638 contents: CResult_PositiveTimestampCreationErrorZPtr {
5639 err: Box::into_raw(Box::new(e)),
5645 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5646 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5647 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5648 fn drop(&mut self) {
5650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5651 let _ = unsafe { Box::from_raw(self.contents.result) };
5654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5655 let _ = unsafe { Box::from_raw(self.contents.err) };
5660 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5661 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5662 let contents = if o.result_ok {
5663 let result = unsafe { o.contents.result };
5664 unsafe { o.contents.result = std::ptr::null_mut() };
5665 CResult_PositiveTimestampCreationErrorZPtr { result }
5667 let err = unsafe { o.contents.err };
5668 unsafe { o.contents.err = std::ptr::null_mut(); }
5669 CResult_PositiveTimestampCreationErrorZPtr { err }
5673 result_ok: o.result_ok,
5677 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5678 fn clone(&self) -> Self {
5680 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5681 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5684 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5685 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5691 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5692 /// but with all dynamically-allocated buffers duplicated in new buffers.
5693 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
5695 /// The contents of CResult_NoneSemanticErrorZ
5696 pub union CResult_NoneSemanticErrorZPtr {
5697 /// Note that this value is always NULL, as there are no contents in the OK variant
5698 pub result: *mut std::ffi::c_void,
5699 /// A pointer to the contents in the error state.
5700 /// Reading from this pointer when `result_ok` is set is undefined.
5701 pub err: *mut crate::lightning_invoice::SemanticError,
5704 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5705 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5707 pub struct CResult_NoneSemanticErrorZ {
5708 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5709 /// `err` or `result` depending on the state of `result_ok`.
5710 pub contents: CResult_NoneSemanticErrorZPtr,
5711 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5712 pub result_ok: bool,
5715 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5716 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5717 CResult_NoneSemanticErrorZ {
5718 contents: CResult_NoneSemanticErrorZPtr {
5719 result: std::ptr::null_mut(),
5725 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5726 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5727 CResult_NoneSemanticErrorZ {
5728 contents: CResult_NoneSemanticErrorZPtr {
5729 err: Box::into_raw(Box::new(e)),
5735 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5736 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5737 impl Drop for CResult_NoneSemanticErrorZ {
5738 fn drop(&mut self) {
5741 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5742 let _ = unsafe { Box::from_raw(self.contents.err) };
5747 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5748 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5749 let contents = if o.result_ok {
5750 let _ = unsafe { Box::from_raw(o.contents.result) };
5751 o.contents.result = std::ptr::null_mut();
5752 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5754 let err = unsafe { o.contents.err };
5755 unsafe { o.contents.err = std::ptr::null_mut(); }
5756 CResult_NoneSemanticErrorZPtr { err }
5760 result_ok: o.result_ok,
5764 impl Clone for CResult_NoneSemanticErrorZ {
5765 fn clone(&self) -> Self {
5767 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5768 result: std::ptr::null_mut()
5771 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5772 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5778 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5779 /// but with all dynamically-allocated buffers duplicated in new buffers.
5780 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
5782 /// The contents of CResult_InvoiceSemanticErrorZ
5783 pub union CResult_InvoiceSemanticErrorZPtr {
5784 /// A pointer to the contents in the success state.
5785 /// Reading from this pointer when `result_ok` is not set is undefined.
5786 pub result: *mut crate::lightning_invoice::Invoice,
5787 /// A pointer to the contents in the error state.
5788 /// Reading from this pointer when `result_ok` is set is undefined.
5789 pub err: *mut crate::lightning_invoice::SemanticError,
5792 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5793 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5795 pub struct CResult_InvoiceSemanticErrorZ {
5796 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5797 /// `err` or `result` depending on the state of `result_ok`.
5798 pub contents: CResult_InvoiceSemanticErrorZPtr,
5799 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5800 pub result_ok: bool,
5803 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5804 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5805 CResult_InvoiceSemanticErrorZ {
5806 contents: CResult_InvoiceSemanticErrorZPtr {
5807 result: Box::into_raw(Box::new(o)),
5813 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5814 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5815 CResult_InvoiceSemanticErrorZ {
5816 contents: CResult_InvoiceSemanticErrorZPtr {
5817 err: Box::into_raw(Box::new(e)),
5823 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
5824 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5825 impl Drop for CResult_InvoiceSemanticErrorZ {
5826 fn drop(&mut self) {
5828 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5829 let _ = unsafe { Box::from_raw(self.contents.result) };
5832 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5833 let _ = unsafe { Box::from_raw(self.contents.err) };
5838 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5839 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
5840 let contents = if o.result_ok {
5841 let result = unsafe { o.contents.result };
5842 unsafe { o.contents.result = std::ptr::null_mut() };
5843 CResult_InvoiceSemanticErrorZPtr { result }
5845 let err = unsafe { o.contents.err };
5846 unsafe { o.contents.err = std::ptr::null_mut(); }
5847 CResult_InvoiceSemanticErrorZPtr { err }
5851 result_ok: o.result_ok,
5855 impl Clone for CResult_InvoiceSemanticErrorZ {
5856 fn clone(&self) -> Self {
5858 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5859 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5862 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
5863 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5869 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
5873 /// The contents of CResult_DescriptionCreationErrorZ
5874 pub union CResult_DescriptionCreationErrorZPtr {
5875 /// A pointer to the contents in the success state.
5876 /// Reading from this pointer when `result_ok` is not set is undefined.
5877 pub result: *mut crate::lightning_invoice::Description,
5878 /// A pointer to the contents in the error state.
5879 /// Reading from this pointer when `result_ok` is set is undefined.
5880 pub err: *mut crate::lightning_invoice::CreationError,
5883 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5884 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5886 pub struct CResult_DescriptionCreationErrorZ {
5887 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5888 /// `err` or `result` depending on the state of `result_ok`.
5889 pub contents: CResult_DescriptionCreationErrorZPtr,
5890 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5891 pub result_ok: bool,
5894 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5895 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5896 CResult_DescriptionCreationErrorZ {
5897 contents: CResult_DescriptionCreationErrorZPtr {
5898 result: Box::into_raw(Box::new(o)),
5904 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5905 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5906 CResult_DescriptionCreationErrorZ {
5907 contents: CResult_DescriptionCreationErrorZPtr {
5908 err: Box::into_raw(Box::new(e)),
5914 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
5915 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5916 impl Drop for CResult_DescriptionCreationErrorZ {
5917 fn drop(&mut self) {
5919 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5920 let _ = unsafe { Box::from_raw(self.contents.result) };
5923 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5924 let _ = unsafe { Box::from_raw(self.contents.err) };
5929 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5930 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
5931 let contents = if o.result_ok {
5932 let result = unsafe { o.contents.result };
5933 unsafe { o.contents.result = std::ptr::null_mut() };
5934 CResult_DescriptionCreationErrorZPtr { result }
5936 let err = unsafe { o.contents.err };
5937 unsafe { o.contents.err = std::ptr::null_mut(); }
5938 CResult_DescriptionCreationErrorZPtr { err }
5942 result_ok: o.result_ok,
5946 impl Clone for CResult_DescriptionCreationErrorZ {
5947 fn clone(&self) -> Self {
5949 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5950 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5953 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5954 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5960 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5961 /// but with all dynamically-allocated buffers duplicated in new buffers.
5962 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
5964 /// The contents of CResult_ExpiryTimeCreationErrorZ
5965 pub union CResult_ExpiryTimeCreationErrorZPtr {
5966 /// A pointer to the contents in the success state.
5967 /// Reading from this pointer when `result_ok` is not set is undefined.
5968 pub result: *mut crate::lightning_invoice::ExpiryTime,
5969 /// A pointer to the contents in the error state.
5970 /// Reading from this pointer when `result_ok` is set is undefined.
5971 pub err: *mut crate::lightning_invoice::CreationError,
5974 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5975 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5977 pub struct CResult_ExpiryTimeCreationErrorZ {
5978 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5979 /// `err` or `result` depending on the state of `result_ok`.
5980 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5981 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5982 pub result_ok: bool,
5985 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5986 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5987 CResult_ExpiryTimeCreationErrorZ {
5988 contents: CResult_ExpiryTimeCreationErrorZPtr {
5989 result: Box::into_raw(Box::new(o)),
5995 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5996 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5997 CResult_ExpiryTimeCreationErrorZ {
5998 contents: CResult_ExpiryTimeCreationErrorZPtr {
5999 err: Box::into_raw(Box::new(e)),
6005 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
6006 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
6007 impl Drop for CResult_ExpiryTimeCreationErrorZ {
6008 fn drop(&mut self) {
6010 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6011 let _ = unsafe { Box::from_raw(self.contents.result) };
6014 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6015 let _ = unsafe { Box::from_raw(self.contents.err) };
6020 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
6021 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
6022 let contents = if o.result_ok {
6023 let result = unsafe { o.contents.result };
6024 unsafe { o.contents.result = std::ptr::null_mut() };
6025 CResult_ExpiryTimeCreationErrorZPtr { result }
6027 let err = unsafe { o.contents.err };
6028 unsafe { o.contents.err = std::ptr::null_mut(); }
6029 CResult_ExpiryTimeCreationErrorZPtr { err }
6033 result_ok: o.result_ok,
6037 impl Clone for CResult_ExpiryTimeCreationErrorZ {
6038 fn clone(&self) -> Self {
6040 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
6041 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
6044 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
6045 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6051 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
6052 /// but with all dynamically-allocated buffers duplicated in new buffers.
6053 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
6055 /// The contents of CResult_PrivateRouteCreationErrorZ
6056 pub union CResult_PrivateRouteCreationErrorZPtr {
6057 /// A pointer to the contents in the success state.
6058 /// Reading from this pointer when `result_ok` is not set is undefined.
6059 pub result: *mut crate::lightning_invoice::PrivateRoute,
6060 /// A pointer to the contents in the error state.
6061 /// Reading from this pointer when `result_ok` is set is undefined.
6062 pub err: *mut crate::lightning_invoice::CreationError,
6065 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6066 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6067 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6068 pub struct CResult_PrivateRouteCreationErrorZ {
6069 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6070 /// `err` or `result` depending on the state of `result_ok`.
6071 pub contents: CResult_PrivateRouteCreationErrorZPtr,
6072 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6073 pub result_ok: bool,
6076 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
6077 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
6078 CResult_PrivateRouteCreationErrorZ {
6079 contents: CResult_PrivateRouteCreationErrorZPtr {
6080 result: Box::into_raw(Box::new(o)),
6086 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
6087 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
6088 CResult_PrivateRouteCreationErrorZ {
6089 contents: CResult_PrivateRouteCreationErrorZPtr {
6090 err: Box::into_raw(Box::new(e)),
6096 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
6097 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
6098 impl Drop for CResult_PrivateRouteCreationErrorZ {
6099 fn drop(&mut self) {
6101 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6102 let _ = unsafe { Box::from_raw(self.contents.result) };
6105 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6106 let _ = unsafe { Box::from_raw(self.contents.err) };
6111 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
6112 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
6113 let contents = if o.result_ok {
6114 let result = unsafe { o.contents.result };
6115 unsafe { o.contents.result = std::ptr::null_mut() };
6116 CResult_PrivateRouteCreationErrorZPtr { result }
6118 let err = unsafe { o.contents.err };
6119 unsafe { o.contents.err = std::ptr::null_mut(); }
6120 CResult_PrivateRouteCreationErrorZPtr { err }
6124 result_ok: o.result_ok,
6128 impl Clone for CResult_PrivateRouteCreationErrorZ {
6129 fn clone(&self) -> Self {
6131 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
6132 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
6135 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
6136 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6142 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
6143 /// but with all dynamically-allocated buffers duplicated in new buffers.
6144 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
6146 /// The contents of CResult_StringErrorZ
6147 pub union CResult_StringErrorZPtr {
6148 /// A pointer to the contents in the success state.
6149 /// Reading from this pointer when `result_ok` is not set is undefined.
6150 pub result: *mut crate::c_types::Str,
6151 /// A pointer to the contents in the error state.
6152 /// Reading from this pointer when `result_ok` is set is undefined.
6153 pub err: *mut crate::c_types::Secp256k1Error,
6156 /// A CResult_StringErrorZ represents the result of a fallible operation,
6157 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6158 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6159 pub struct CResult_StringErrorZ {
6160 /// The contents of this CResult_StringErrorZ, accessible via either
6161 /// `err` or `result` depending on the state of `result_ok`.
6162 pub contents: CResult_StringErrorZPtr,
6163 /// Whether this CResult_StringErrorZ represents a success state.
6164 pub result_ok: bool,
6167 /// Creates a new CResult_StringErrorZ in the success state.
6168 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
6169 CResult_StringErrorZ {
6170 contents: CResult_StringErrorZPtr {
6171 result: Box::into_raw(Box::new(o)),
6177 /// Creates a new CResult_StringErrorZ in the error state.
6178 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
6179 CResult_StringErrorZ {
6180 contents: CResult_StringErrorZPtr {
6181 err: Box::into_raw(Box::new(e)),
6187 /// Frees any resources used by the CResult_StringErrorZ.
6188 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
6189 impl Drop for CResult_StringErrorZ {
6190 fn drop(&mut self) {
6192 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6193 let _ = unsafe { Box::from_raw(self.contents.result) };
6196 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6197 let _ = unsafe { Box::from_raw(self.contents.err) };
6202 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
6203 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
6204 let contents = if o.result_ok {
6205 let result = unsafe { o.contents.result };
6206 unsafe { o.contents.result = std::ptr::null_mut() };
6207 CResult_StringErrorZPtr { result }
6209 let err = unsafe { o.contents.err };
6210 unsafe { o.contents.err = std::ptr::null_mut(); }
6211 CResult_StringErrorZPtr { err }
6215 result_ok: o.result_ok,
6220 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6221 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6222 /// A pointer to the contents in the success state.
6223 /// Reading from this pointer when `result_ok` is not set is undefined.
6224 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
6225 /// A pointer to the contents in the error state.
6226 /// Reading from this pointer when `result_ok` is set is undefined.
6227 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6230 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6231 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6233 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
6234 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6235 /// `err` or `result` depending on the state of `result_ok`.
6236 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
6237 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6238 pub result_ok: bool,
6241 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
6242 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6243 CResult_ChannelMonitorUpdateDecodeErrorZ {
6244 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6245 result: Box::into_raw(Box::new(o)),
6251 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
6252 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6253 CResult_ChannelMonitorUpdateDecodeErrorZ {
6254 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6255 err: Box::into_raw(Box::new(e)),
6261 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
6262 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
6263 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
6264 fn drop(&mut self) {
6266 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6267 let _ = unsafe { Box::from_raw(self.contents.result) };
6270 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6271 let _ = unsafe { Box::from_raw(self.contents.err) };
6276 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
6277 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6278 let contents = if o.result_ok {
6279 let result = unsafe { o.contents.result };
6280 unsafe { o.contents.result = std::ptr::null_mut() };
6281 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
6283 let err = unsafe { o.contents.err };
6284 unsafe { o.contents.err = std::ptr::null_mut(); }
6285 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
6289 result_ok: o.result_ok,
6293 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
6294 fn clone(&self) -> Self {
6296 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6297 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
6300 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6301 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6307 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
6308 /// but with all dynamically-allocated buffers duplicated in new buffers.
6309 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
6311 /// The contents of CResult_HTLCUpdateDecodeErrorZ
6312 pub union CResult_HTLCUpdateDecodeErrorZPtr {
6313 /// A pointer to the contents in the success state.
6314 /// Reading from this pointer when `result_ok` is not set is undefined.
6315 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
6316 /// A pointer to the contents in the error state.
6317 /// Reading from this pointer when `result_ok` is set is undefined.
6318 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6321 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6322 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6324 pub struct CResult_HTLCUpdateDecodeErrorZ {
6325 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6326 /// `err` or `result` depending on the state of `result_ok`.
6327 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
6328 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6329 pub result_ok: bool,
6332 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
6333 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
6334 CResult_HTLCUpdateDecodeErrorZ {
6335 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6336 result: Box::into_raw(Box::new(o)),
6342 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
6343 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
6344 CResult_HTLCUpdateDecodeErrorZ {
6345 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6346 err: Box::into_raw(Box::new(e)),
6352 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
6353 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
6354 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
6355 fn drop(&mut self) {
6357 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6358 let _ = unsafe { Box::from_raw(self.contents.result) };
6361 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6362 let _ = unsafe { Box::from_raw(self.contents.err) };
6367 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
6368 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6369 let contents = if o.result_ok {
6370 let result = unsafe { o.contents.result };
6371 unsafe { o.contents.result = std::ptr::null_mut() };
6372 CResult_HTLCUpdateDecodeErrorZPtr { result }
6374 let err = unsafe { o.contents.err };
6375 unsafe { o.contents.err = std::ptr::null_mut(); }
6376 CResult_HTLCUpdateDecodeErrorZPtr { err }
6380 result_ok: o.result_ok,
6384 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
6385 fn clone(&self) -> Self {
6387 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6388 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
6391 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6392 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6398 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
6399 /// but with all dynamically-allocated buffers duplicated in new buffers.
6400 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
6402 /// The contents of CResult_NoneMonitorUpdateErrorZ
6403 pub union CResult_NoneMonitorUpdateErrorZPtr {
6404 /// Note that this value is always NULL, as there are no contents in the OK variant
6405 pub result: *mut std::ffi::c_void,
6406 /// A pointer to the contents in the error state.
6407 /// Reading from this pointer when `result_ok` is set is undefined.
6408 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
6411 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6412 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6414 pub struct CResult_NoneMonitorUpdateErrorZ {
6415 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6416 /// `err` or `result` depending on the state of `result_ok`.
6417 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
6418 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6419 pub result_ok: bool,
6422 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
6423 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
6424 CResult_NoneMonitorUpdateErrorZ {
6425 contents: CResult_NoneMonitorUpdateErrorZPtr {
6426 result: std::ptr::null_mut(),
6432 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
6433 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
6434 CResult_NoneMonitorUpdateErrorZ {
6435 contents: CResult_NoneMonitorUpdateErrorZPtr {
6436 err: Box::into_raw(Box::new(e)),
6442 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
6443 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
6444 impl Drop for CResult_NoneMonitorUpdateErrorZ {
6445 fn drop(&mut self) {
6448 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6449 let _ = unsafe { Box::from_raw(self.contents.err) };
6454 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
6455 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
6456 let contents = if o.result_ok {
6457 let _ = unsafe { Box::from_raw(o.contents.result) };
6458 o.contents.result = std::ptr::null_mut();
6459 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
6461 let err = unsafe { o.contents.err };
6462 unsafe { o.contents.err = std::ptr::null_mut(); }
6463 CResult_NoneMonitorUpdateErrorZPtr { err }
6467 result_ok: o.result_ok,
6471 impl Clone for CResult_NoneMonitorUpdateErrorZ {
6472 fn clone(&self) -> Self {
6474 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
6475 result: std::ptr::null_mut()
6478 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
6479 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
6485 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
6486 /// but with all dynamically-allocated buffers duplicated in new buffers.
6487 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
6489 /// A tuple of 2 elements. See the individual fields for the types contained.
6490 pub struct C2Tuple_OutPointScriptZ {
6491 /// The element at position 0
6492 pub a: crate::lightning::chain::transaction::OutPoint,
6493 /// The element at position 1
6494 pub b: crate::c_types::derived::CVec_u8Z,
6496 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
6497 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
6504 impl C2Tuple_OutPointScriptZ {
6505 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
6509 impl Clone for C2Tuple_OutPointScriptZ {
6510 fn clone(&self) -> Self {
6512 a: Clone::clone(&self.a),
6513 b: Clone::clone(&self.b),
6518 /// Creates a new tuple which has the same data as `orig`
6519 /// but with all dynamically-allocated buffers duplicated in new buffers.
6520 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
6521 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
6523 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
6524 C2Tuple_OutPointScriptZ { a, b, }
6528 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
6529 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
6531 /// A tuple of 2 elements. See the individual fields for the types contained.
6532 pub struct C2Tuple_u32ScriptZ {
6533 /// The element at position 0
6535 /// The element at position 1
6536 pub b: crate::c_types::derived::CVec_u8Z,
6538 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
6539 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
6546 impl C2Tuple_u32ScriptZ {
6547 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
6551 impl Clone for C2Tuple_u32ScriptZ {
6552 fn clone(&self) -> Self {
6554 a: Clone::clone(&self.a),
6555 b: Clone::clone(&self.b),
6560 /// Creates a new tuple which has the same data as `orig`
6561 /// but with all dynamically-allocated buffers duplicated in new buffers.
6562 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
6563 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6565 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6566 C2Tuple_u32ScriptZ { a, b, }
6570 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6571 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6573 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6574 /// This corresponds to std::vector in C++
6575 pub struct CVec_C2Tuple_u32ScriptZZ {
6576 /// The elements in the array.
6577 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6578 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6579 /// The number of elements pointed to by `data`.
6582 impl CVec_C2Tuple_u32ScriptZZ {
6583 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6584 if self.datalen == 0 { return Vec::new(); }
6585 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6586 self.data = std::ptr::null_mut();
6590 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6591 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6594 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6595 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6596 let datalen = v.len();
6597 let data = Box::into_raw(v.into_boxed_slice());
6598 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6602 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6603 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6604 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6605 fn drop(&mut self) {
6606 if self.datalen == 0 { return; }
6607 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6610 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6611 fn clone(&self) -> Self {
6612 let mut res = Vec::new();
6613 if self.datalen == 0 { return Self::from(res); }
6614 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6619 /// A tuple of 2 elements. See the individual fields for the types contained.
6620 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6621 /// The element at position 0
6622 pub a: crate::c_types::ThirtyTwoBytes,
6623 /// The element at position 1
6624 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6626 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6627 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6634 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6635 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6639 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6640 fn clone(&self) -> Self {
6642 a: Clone::clone(&self.a),
6643 b: Clone::clone(&self.b),
6648 /// Creates a new tuple which has the same data as `orig`
6649 /// but with all dynamically-allocated buffers duplicated in new buffers.
6650 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
6651 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6653 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 {
6654 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6658 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6659 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6661 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6662 /// This corresponds to std::vector in C++
6663 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6664 /// The elements in the array.
6665 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6666 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6667 /// The number of elements pointed to by `data`.
6670 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6671 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6672 if self.datalen == 0 { return Vec::new(); }
6673 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6674 self.data = std::ptr::null_mut();
6678 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6679 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6682 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6683 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6684 let datalen = v.len();
6685 let data = Box::into_raw(v.into_boxed_slice());
6686 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6690 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6691 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6692 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6693 fn drop(&mut self) {
6694 if self.datalen == 0 { return; }
6695 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6698 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6699 fn clone(&self) -> Self {
6700 let mut res = Vec::new();
6701 if self.datalen == 0 { return Self::from(res); }
6702 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6707 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6708 /// This corresponds to std::vector in C++
6709 pub struct CVec_EventZ {
6710 /// The elements in the array.
6711 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6712 pub data: *mut crate::lightning::util::events::Event,
6713 /// The number of elements pointed to by `data`.
6717 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6718 if self.datalen == 0 { return Vec::new(); }
6719 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6720 self.data = std::ptr::null_mut();
6724 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6725 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6728 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6729 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6730 let datalen = v.len();
6731 let data = Box::into_raw(v.into_boxed_slice());
6732 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6736 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6737 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6738 impl Drop for CVec_EventZ {
6739 fn drop(&mut self) {
6740 if self.datalen == 0 { return; }
6741 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6744 impl Clone for CVec_EventZ {
6745 fn clone(&self) -> Self {
6746 let mut res = Vec::new();
6747 if self.datalen == 0 { return Self::from(res); }
6748 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6753 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6754 /// This corresponds to std::vector in C++
6755 pub struct CVec_TransactionZ {
6756 /// The elements in the array.
6757 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6758 pub data: *mut crate::c_types::Transaction,
6759 /// The number of elements pointed to by `data`.
6762 impl CVec_TransactionZ {
6763 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6764 if self.datalen == 0 { return Vec::new(); }
6765 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6766 self.data = std::ptr::null_mut();
6770 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6771 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6774 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6775 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6776 let datalen = v.len();
6777 let data = Box::into_raw(v.into_boxed_slice());
6778 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6782 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6783 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6784 impl Drop for CVec_TransactionZ {
6785 fn drop(&mut self) {
6786 if self.datalen == 0 { return; }
6787 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6790 impl Clone for CVec_TransactionZ {
6791 fn clone(&self) -> Self {
6792 let mut res = Vec::new();
6793 if self.datalen == 0 { return Self::from(res); }
6794 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6799 /// A tuple of 2 elements. See the individual fields for the types contained.
6800 pub struct C2Tuple_u32TxOutZ {
6801 /// The element at position 0
6803 /// The element at position 1
6804 pub b: crate::c_types::TxOut,
6806 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6807 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6814 impl C2Tuple_u32TxOutZ {
6815 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6819 impl Clone for C2Tuple_u32TxOutZ {
6820 fn clone(&self) -> Self {
6822 a: Clone::clone(&self.a),
6823 b: Clone::clone(&self.b),
6828 /// Creates a new tuple which has the same data as `orig`
6829 /// but with all dynamically-allocated buffers duplicated in new buffers.
6830 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
6831 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6833 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6834 C2Tuple_u32TxOutZ { a, b, }
6838 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6839 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6841 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6842 /// This corresponds to std::vector in C++
6843 pub struct CVec_C2Tuple_u32TxOutZZ {
6844 /// The elements in the array.
6845 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6846 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6847 /// The number of elements pointed to by `data`.
6850 impl CVec_C2Tuple_u32TxOutZZ {
6851 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6852 if self.datalen == 0 { return Vec::new(); }
6853 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6854 self.data = std::ptr::null_mut();
6858 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6859 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6862 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6863 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6864 let datalen = v.len();
6865 let data = Box::into_raw(v.into_boxed_slice());
6866 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6871 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6872 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6873 fn drop(&mut self) {
6874 if self.datalen == 0 { return; }
6875 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6878 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6879 fn clone(&self) -> Self {
6880 let mut res = Vec::new();
6881 if self.datalen == 0 { return Self::from(res); }
6882 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6887 /// A tuple of 2 elements. See the individual fields for the types contained.
6888 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6889 /// The element at position 0
6890 pub a: crate::c_types::ThirtyTwoBytes,
6891 /// The element at position 1
6892 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6894 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6895 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6902 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6903 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6907 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6908 fn clone(&self) -> Self {
6910 a: Clone::clone(&self.a),
6911 b: Clone::clone(&self.b),
6916 /// Creates a new tuple which has the same data as `orig`
6917 /// but with all dynamically-allocated buffers duplicated in new buffers.
6918 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
6919 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6921 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 {
6922 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6926 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6927 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6929 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6930 /// This corresponds to std::vector in C++
6931 pub struct CVec_TransactionOutputsZ {
6932 /// The elements in the array.
6933 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6934 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6935 /// The number of elements pointed to by `data`.
6938 impl CVec_TransactionOutputsZ {
6939 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6940 if self.datalen == 0 { return Vec::new(); }
6941 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6942 self.data = std::ptr::null_mut();
6946 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6947 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6950 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6951 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6952 let datalen = v.len();
6953 let data = Box::into_raw(v.into_boxed_slice());
6954 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6958 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6959 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6960 impl Drop for CVec_TransactionOutputsZ {
6961 fn drop(&mut self) {
6962 if self.datalen == 0 { return; }
6963 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6966 impl Clone for CVec_TransactionOutputsZ {
6967 fn clone(&self) -> Self {
6968 let mut res = Vec::new();
6969 if self.datalen == 0 { return Self::from(res); }
6970 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6975 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
6976 /// This corresponds to std::vector in C++
6977 pub struct CVec_BalanceZ {
6978 /// The elements in the array.
6979 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6980 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
6981 /// The number of elements pointed to by `data`.
6984 impl CVec_BalanceZ {
6985 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
6986 if self.datalen == 0 { return Vec::new(); }
6987 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6988 self.data = std::ptr::null_mut();
6992 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
6993 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6996 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
6997 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
6998 let datalen = v.len();
6999 let data = Box::into_raw(v.into_boxed_slice());
7000 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7004 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7005 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
7006 impl Drop for CVec_BalanceZ {
7007 fn drop(&mut self) {
7008 if self.datalen == 0 { return; }
7009 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7012 impl Clone for CVec_BalanceZ {
7013 fn clone(&self) -> Self {
7014 let mut res = Vec::new();
7015 if self.datalen == 0 { return Self::from(res); }
7016 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7021 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7022 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7023 /// A pointer to the contents in the success state.
7024 /// Reading from this pointer when `result_ok` is not set is undefined.
7025 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7026 /// A pointer to the contents in the error state.
7027 /// Reading from this pointer when `result_ok` is set is undefined.
7028 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7031 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7032 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7034 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7035 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7036 /// `err` or `result` depending on the state of `result_ok`.
7037 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
7038 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7039 pub result_ok: bool,
7042 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
7043 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7044 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7045 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7046 result: Box::into_raw(Box::new(o)),
7052 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
7053 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7054 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7055 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7056 err: Box::into_raw(Box::new(e)),
7062 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
7063 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
7064 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7065 fn drop(&mut self) {
7067 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7068 let _ = unsafe { Box::from_raw(self.contents.result) };
7071 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7072 let _ = unsafe { Box::from_raw(self.contents.err) };
7077 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7078 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7079 let contents = if o.result_ok {
7080 let result = unsafe { o.contents.result };
7081 unsafe { o.contents.result = std::ptr::null_mut() };
7082 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
7084 let err = unsafe { o.contents.err };
7085 unsafe { o.contents.err = std::ptr::null_mut(); }
7086 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
7090 result_ok: o.result_ok,
7095 /// The contents of CResult_NoneLightningErrorZ
7096 pub union CResult_NoneLightningErrorZPtr {
7097 /// Note that this value is always NULL, as there are no contents in the OK variant
7098 pub result: *mut std::ffi::c_void,
7099 /// A pointer to the contents in the error state.
7100 /// Reading from this pointer when `result_ok` is set is undefined.
7101 pub err: *mut crate::lightning::ln::msgs::LightningError,
7104 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7105 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7107 pub struct CResult_NoneLightningErrorZ {
7108 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7109 /// `err` or `result` depending on the state of `result_ok`.
7110 pub contents: CResult_NoneLightningErrorZPtr,
7111 /// Whether this CResult_NoneLightningErrorZ represents a success state.
7112 pub result_ok: bool,
7115 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7116 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7117 CResult_NoneLightningErrorZ {
7118 contents: CResult_NoneLightningErrorZPtr {
7119 result: std::ptr::null_mut(),
7125 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7126 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7127 CResult_NoneLightningErrorZ {
7128 contents: CResult_NoneLightningErrorZPtr {
7129 err: Box::into_raw(Box::new(e)),
7135 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7136 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7137 impl Drop for CResult_NoneLightningErrorZ {
7138 fn drop(&mut self) {
7141 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7142 let _ = unsafe { Box::from_raw(self.contents.err) };
7147 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7148 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7149 let contents = if o.result_ok {
7150 let _ = unsafe { Box::from_raw(o.contents.result) };
7151 o.contents.result = std::ptr::null_mut();
7152 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
7154 let err = unsafe { o.contents.err };
7155 unsafe { o.contents.err = std::ptr::null_mut(); }
7156 CResult_NoneLightningErrorZPtr { err }
7160 result_ok: o.result_ok,
7164 impl Clone for CResult_NoneLightningErrorZ {
7165 fn clone(&self) -> Self {
7167 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7168 result: std::ptr::null_mut()
7171 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7172 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7178 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7179 /// but with all dynamically-allocated buffers duplicated in new buffers.
7180 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7182 /// A tuple of 2 elements. See the individual fields for the types contained.
7183 pub struct C2Tuple_PublicKeyTypeZ {
7184 /// The element at position 0
7185 pub a: crate::c_types::PublicKey,
7186 /// The element at position 1
7187 pub b: crate::lightning::ln::wire::Type,
7189 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
7190 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
7197 impl C2Tuple_PublicKeyTypeZ {
7198 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
7202 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
7204 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
7205 C2Tuple_PublicKeyTypeZ { a, b, }
7209 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
7210 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
7212 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7213 /// This corresponds to std::vector in C++
7214 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
7215 /// The elements in the array.
7216 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7217 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
7218 /// The number of elements pointed to by `data`.
7221 impl CVec_C2Tuple_PublicKeyTypeZZ {
7222 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
7223 if self.datalen == 0 { return Vec::new(); }
7224 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7225 self.data = std::ptr::null_mut();
7229 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
7230 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7233 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
7234 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
7235 let datalen = v.len();
7236 let data = Box::into_raw(v.into_boxed_slice());
7237 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7241 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7242 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
7243 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
7244 fn drop(&mut self) {
7245 if self.datalen == 0 { return; }
7246 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7250 /// The contents of CResult_boolLightningErrorZ
7251 pub union CResult_boolLightningErrorZPtr {
7252 /// A pointer to the contents in the success state.
7253 /// Reading from this pointer when `result_ok` is not set is undefined.
7254 pub result: *mut bool,
7255 /// A pointer to the contents in the error state.
7256 /// Reading from this pointer when `result_ok` is set is undefined.
7257 pub err: *mut crate::lightning::ln::msgs::LightningError,
7260 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7261 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7263 pub struct CResult_boolLightningErrorZ {
7264 /// The contents of this CResult_boolLightningErrorZ, accessible via either
7265 /// `err` or `result` depending on the state of `result_ok`.
7266 pub contents: CResult_boolLightningErrorZPtr,
7267 /// Whether this CResult_boolLightningErrorZ represents a success state.
7268 pub result_ok: bool,
7271 /// Creates a new CResult_boolLightningErrorZ in the success state.
7272 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7273 CResult_boolLightningErrorZ {
7274 contents: CResult_boolLightningErrorZPtr {
7275 result: Box::into_raw(Box::new(o)),
7281 /// Creates a new CResult_boolLightningErrorZ in the error state.
7282 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
7283 CResult_boolLightningErrorZ {
7284 contents: CResult_boolLightningErrorZPtr {
7285 err: Box::into_raw(Box::new(e)),
7291 /// Frees any resources used by the CResult_boolLightningErrorZ.
7292 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
7293 impl Drop for CResult_boolLightningErrorZ {
7294 fn drop(&mut self) {
7296 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7297 let _ = unsafe { Box::from_raw(self.contents.result) };
7300 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7301 let _ = unsafe { Box::from_raw(self.contents.err) };
7306 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
7307 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
7308 let contents = if o.result_ok {
7309 let result = unsafe { o.contents.result };
7310 unsafe { o.contents.result = std::ptr::null_mut() };
7311 CResult_boolLightningErrorZPtr { result }
7313 let err = unsafe { o.contents.err };
7314 unsafe { o.contents.err = std::ptr::null_mut(); }
7315 CResult_boolLightningErrorZPtr { err }
7319 result_ok: o.result_ok,
7323 impl Clone for CResult_boolLightningErrorZ {
7324 fn clone(&self) -> Self {
7326 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
7327 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7330 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
7331 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7337 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7338 /// but with all dynamically-allocated buffers duplicated in new buffers.
7339 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
7341 /// A tuple of 3 elements. See the individual fields for the types contained.
7342 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7343 /// The element at position 0
7344 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
7345 /// The element at position 1
7346 pub b: crate::lightning::ln::msgs::ChannelUpdate,
7347 /// The element at position 2
7348 pub c: crate::lightning::ln::msgs::ChannelUpdate,
7350 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7351 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
7359 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7360 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
7361 (self.a, self.b, self.c)
7364 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7365 fn clone(&self) -> Self {
7367 a: Clone::clone(&self.a),
7368 b: Clone::clone(&self.b),
7369 c: Clone::clone(&self.c),
7374 /// Creates a new tuple which has the same data as `orig`
7375 /// but with all dynamically-allocated buffers duplicated in new buffers.
7376 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
7377 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7379 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 {
7380 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
7384 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7385 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
7387 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
7388 /// This corresponds to std::vector in C++
7389 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7390 /// The elements in the array.
7391 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7392 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
7393 /// The number of elements pointed to by `data`.
7396 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7397 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
7398 if self.datalen == 0 { return Vec::new(); }
7399 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7400 self.data = std::ptr::null_mut();
7404 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
7405 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7408 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7409 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
7410 let datalen = v.len();
7411 let data = Box::into_raw(v.into_boxed_slice());
7412 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7416 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7417 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
7418 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7419 fn drop(&mut self) {
7420 if self.datalen == 0 { return; }
7421 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7424 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7425 fn clone(&self) -> Self {
7426 let mut res = Vec::new();
7427 if self.datalen == 0 { return Self::from(res); }
7428 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7433 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
7434 /// This corresponds to std::vector in C++
7435 pub struct CVec_NodeAnnouncementZ {
7436 /// The elements in the array.
7437 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7438 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
7439 /// The number of elements pointed to by `data`.
7442 impl CVec_NodeAnnouncementZ {
7443 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
7444 if self.datalen == 0 { return Vec::new(); }
7445 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7446 self.data = std::ptr::null_mut();
7450 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
7451 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7454 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
7455 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
7456 let datalen = v.len();
7457 let data = Box::into_raw(v.into_boxed_slice());
7458 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7462 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7463 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
7464 impl Drop for CVec_NodeAnnouncementZ {
7465 fn drop(&mut self) {
7466 if self.datalen == 0 { return; }
7467 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7470 impl Clone for CVec_NodeAnnouncementZ {
7471 fn clone(&self) -> Self {
7472 let mut res = Vec::new();
7473 if self.datalen == 0 { return Self::from(res); }
7474 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7479 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7480 /// This corresponds to std::vector in C++
7481 pub struct CVec_PublicKeyZ {
7482 /// The elements in the array.
7483 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7484 pub data: *mut crate::c_types::PublicKey,
7485 /// The number of elements pointed to by `data`.
7488 impl CVec_PublicKeyZ {
7489 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
7490 if self.datalen == 0 { return Vec::new(); }
7491 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7492 self.data = std::ptr::null_mut();
7496 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
7497 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7500 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
7501 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
7502 let datalen = v.len();
7503 let data = Box::into_raw(v.into_boxed_slice());
7504 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7508 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7509 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
7510 impl Drop for CVec_PublicKeyZ {
7511 fn drop(&mut self) {
7512 if self.datalen == 0 { return; }
7513 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7516 impl Clone for CVec_PublicKeyZ {
7517 fn clone(&self) -> Self {
7518 let mut res = Vec::new();
7519 if self.datalen == 0 { return Self::from(res); }
7520 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7525 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
7526 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
7527 /// A pointer to the contents in the success state.
7528 /// Reading from this pointer when `result_ok` is not set is undefined.
7529 pub result: *mut crate::c_types::derived::CVec_u8Z,
7530 /// A pointer to the contents in the error state.
7531 /// Reading from this pointer when `result_ok` is set is undefined.
7532 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7535 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7536 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7537 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7538 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
7539 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7540 /// `err` or `result` depending on the state of `result_ok`.
7541 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
7542 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7543 pub result_ok: bool,
7546 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
7547 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
7548 CResult_CVec_u8ZPeerHandleErrorZ {
7549 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7550 result: Box::into_raw(Box::new(o)),
7556 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
7557 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
7558 CResult_CVec_u8ZPeerHandleErrorZ {
7559 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7560 err: Box::into_raw(Box::new(e)),
7566 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
7567 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
7568 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
7569 fn drop(&mut self) {
7571 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7572 let _ = unsafe { Box::from_raw(self.contents.result) };
7575 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7576 let _ = unsafe { Box::from_raw(self.contents.err) };
7581 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
7582 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7583 let contents = if o.result_ok {
7584 let result = unsafe { o.contents.result };
7585 unsafe { o.contents.result = std::ptr::null_mut() };
7586 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
7588 let err = unsafe { o.contents.err };
7589 unsafe { o.contents.err = std::ptr::null_mut(); }
7590 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
7594 result_ok: o.result_ok,
7598 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
7599 fn clone(&self) -> Self {
7601 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7602 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
7605 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7606 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7612 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
7613 /// but with all dynamically-allocated buffers duplicated in new buffers.
7614 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
7616 /// The contents of CResult_NonePeerHandleErrorZ
7617 pub union CResult_NonePeerHandleErrorZPtr {
7618 /// Note that this value is always NULL, as there are no contents in the OK variant
7619 pub result: *mut std::ffi::c_void,
7620 /// A pointer to the contents in the error state.
7621 /// Reading from this pointer when `result_ok` is set is undefined.
7622 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7625 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7626 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7628 pub struct CResult_NonePeerHandleErrorZ {
7629 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7630 /// `err` or `result` depending on the state of `result_ok`.
7631 pub contents: CResult_NonePeerHandleErrorZPtr,
7632 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
7633 pub result_ok: bool,
7636 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
7637 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
7638 CResult_NonePeerHandleErrorZ {
7639 contents: CResult_NonePeerHandleErrorZPtr {
7640 result: std::ptr::null_mut(),
7646 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
7647 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
7648 CResult_NonePeerHandleErrorZ {
7649 contents: CResult_NonePeerHandleErrorZPtr {
7650 err: Box::into_raw(Box::new(e)),
7656 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
7657 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
7658 impl Drop for CResult_NonePeerHandleErrorZ {
7659 fn drop(&mut self) {
7662 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7663 let _ = unsafe { Box::from_raw(self.contents.err) };
7668 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
7669 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7670 let contents = if o.result_ok {
7671 let _ = unsafe { Box::from_raw(o.contents.result) };
7672 o.contents.result = std::ptr::null_mut();
7673 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
7675 let err = unsafe { o.contents.err };
7676 unsafe { o.contents.err = std::ptr::null_mut(); }
7677 CResult_NonePeerHandleErrorZPtr { err }
7681 result_ok: o.result_ok,
7685 impl Clone for CResult_NonePeerHandleErrorZ {
7686 fn clone(&self) -> Self {
7688 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
7689 result: std::ptr::null_mut()
7692 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
7693 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7699 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
7700 /// but with all dynamically-allocated buffers duplicated in new buffers.
7701 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
7703 /// The contents of CResult_boolPeerHandleErrorZ
7704 pub union CResult_boolPeerHandleErrorZPtr {
7705 /// A pointer to the contents in the success state.
7706 /// Reading from this pointer when `result_ok` is not set is undefined.
7707 pub result: *mut bool,
7708 /// A pointer to the contents in the error state.
7709 /// Reading from this pointer when `result_ok` is set is undefined.
7710 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7713 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7714 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7715 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7716 pub struct CResult_boolPeerHandleErrorZ {
7717 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7718 /// `err` or `result` depending on the state of `result_ok`.
7719 pub contents: CResult_boolPeerHandleErrorZPtr,
7720 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7721 pub result_ok: bool,
7724 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7725 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7726 CResult_boolPeerHandleErrorZ {
7727 contents: CResult_boolPeerHandleErrorZPtr {
7728 result: Box::into_raw(Box::new(o)),
7734 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7735 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7736 CResult_boolPeerHandleErrorZ {
7737 contents: CResult_boolPeerHandleErrorZPtr {
7738 err: Box::into_raw(Box::new(e)),
7744 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7745 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7746 impl Drop for CResult_boolPeerHandleErrorZ {
7747 fn drop(&mut self) {
7749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7750 let _ = unsafe { Box::from_raw(self.contents.result) };
7753 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7754 let _ = unsafe { Box::from_raw(self.contents.err) };
7759 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7760 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7761 let contents = if o.result_ok {
7762 let result = unsafe { o.contents.result };
7763 unsafe { o.contents.result = std::ptr::null_mut() };
7764 CResult_boolPeerHandleErrorZPtr { result }
7766 let err = unsafe { o.contents.err };
7767 unsafe { o.contents.err = std::ptr::null_mut(); }
7768 CResult_boolPeerHandleErrorZPtr { err }
7772 result_ok: o.result_ok,
7776 impl Clone for CResult_boolPeerHandleErrorZ {
7777 fn clone(&self) -> Self {
7779 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7780 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7783 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
7784 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7790 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7791 /// but with all dynamically-allocated buffers duplicated in new buffers.
7792 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
7794 /// An enum which can either contain a crate::lightning::chain::Access or not
7795 pub enum COption_AccessZ {
7796 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
7797 Some(crate::lightning::chain::Access),
7798 /// When we're in this state, this COption_AccessZ contains nothing
7801 impl COption_AccessZ {
7802 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7803 if let Self::Some(_) = self { true } else { false }
7805 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7808 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
7809 if let Self::Some(v) = self { v } else { unreachable!() }
7813 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
7814 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
7815 COption_AccessZ::Some(o)
7818 /// Constructs a new COption_AccessZ containing nothing
7819 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
7820 COption_AccessZ::None
7823 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
7824 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
7826 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7827 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
7828 /// A pointer to the contents in the success state.
7829 /// Reading from this pointer when `result_ok` is not set is undefined.
7830 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
7831 /// A pointer to the contents in the error state.
7832 /// Reading from this pointer when `result_ok` is set is undefined.
7833 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7836 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7837 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7839 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7840 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7841 /// `err` or `result` depending on the state of `result_ok`.
7842 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7843 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7844 pub result_ok: bool,
7847 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7848 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7849 CResult_DirectionalChannelInfoDecodeErrorZ {
7850 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7851 result: Box::into_raw(Box::new(o)),
7857 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7858 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7859 CResult_DirectionalChannelInfoDecodeErrorZ {
7860 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7861 err: Box::into_raw(Box::new(e)),
7867 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
7868 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7869 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
7870 fn drop(&mut self) {
7872 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7873 let _ = unsafe { Box::from_raw(self.contents.result) };
7876 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7877 let _ = unsafe { Box::from_raw(self.contents.err) };
7882 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7883 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7884 let contents = if o.result_ok {
7885 let result = unsafe { o.contents.result };
7886 unsafe { o.contents.result = std::ptr::null_mut() };
7887 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
7889 let err = unsafe { o.contents.err };
7890 unsafe { o.contents.err = std::ptr::null_mut(); }
7891 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7895 result_ok: o.result_ok,
7899 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7900 fn clone(&self) -> Self {
7902 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7903 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7906 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7907 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7913 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7914 /// but with all dynamically-allocated buffers duplicated in new buffers.
7915 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
7917 /// The contents of CResult_ChannelInfoDecodeErrorZ
7918 pub union CResult_ChannelInfoDecodeErrorZPtr {
7919 /// A pointer to the contents in the success state.
7920 /// Reading from this pointer when `result_ok` is not set is undefined.
7921 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
7922 /// A pointer to the contents in the error state.
7923 /// Reading from this pointer when `result_ok` is set is undefined.
7924 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7927 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7928 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7930 pub struct CResult_ChannelInfoDecodeErrorZ {
7931 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7932 /// `err` or `result` depending on the state of `result_ok`.
7933 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7934 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7935 pub result_ok: bool,
7938 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7939 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7940 CResult_ChannelInfoDecodeErrorZ {
7941 contents: CResult_ChannelInfoDecodeErrorZPtr {
7942 result: Box::into_raw(Box::new(o)),
7948 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7949 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7950 CResult_ChannelInfoDecodeErrorZ {
7951 contents: CResult_ChannelInfoDecodeErrorZPtr {
7952 err: Box::into_raw(Box::new(e)),
7958 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7959 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7960 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7961 fn drop(&mut self) {
7963 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7964 let _ = unsafe { Box::from_raw(self.contents.result) };
7967 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7968 let _ = unsafe { Box::from_raw(self.contents.err) };
7973 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7974 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7975 let contents = if o.result_ok {
7976 let result = unsafe { o.contents.result };
7977 unsafe { o.contents.result = std::ptr::null_mut() };
7978 CResult_ChannelInfoDecodeErrorZPtr { result }
7980 let err = unsafe { o.contents.err };
7981 unsafe { o.contents.err = std::ptr::null_mut(); }
7982 CResult_ChannelInfoDecodeErrorZPtr { err }
7986 result_ok: o.result_ok,
7990 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7991 fn clone(&self) -> Self {
7993 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7994 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7997 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7998 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8004 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8005 /// but with all dynamically-allocated buffers duplicated in new buffers.
8006 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8008 /// The contents of CResult_RoutingFeesDecodeErrorZ
8009 pub union CResult_RoutingFeesDecodeErrorZPtr {
8010 /// A pointer to the contents in the success state.
8011 /// Reading from this pointer when `result_ok` is not set is undefined.
8012 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
8013 /// A pointer to the contents in the error state.
8014 /// Reading from this pointer when `result_ok` is set is undefined.
8015 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8018 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8019 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8020 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8021 pub struct CResult_RoutingFeesDecodeErrorZ {
8022 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8023 /// `err` or `result` depending on the state of `result_ok`.
8024 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8025 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8026 pub result_ok: bool,
8029 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8030 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8031 CResult_RoutingFeesDecodeErrorZ {
8032 contents: CResult_RoutingFeesDecodeErrorZPtr {
8033 result: Box::into_raw(Box::new(o)),
8039 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8040 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8041 CResult_RoutingFeesDecodeErrorZ {
8042 contents: CResult_RoutingFeesDecodeErrorZPtr {
8043 err: Box::into_raw(Box::new(e)),
8049 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8050 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8051 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8052 fn drop(&mut self) {
8054 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8055 let _ = unsafe { Box::from_raw(self.contents.result) };
8058 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8059 let _ = unsafe { Box::from_raw(self.contents.err) };
8064 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8065 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8066 let contents = if o.result_ok {
8067 let result = unsafe { o.contents.result };
8068 unsafe { o.contents.result = std::ptr::null_mut() };
8069 CResult_RoutingFeesDecodeErrorZPtr { result }
8071 let err = unsafe { o.contents.err };
8072 unsafe { o.contents.err = std::ptr::null_mut(); }
8073 CResult_RoutingFeesDecodeErrorZPtr { err }
8077 result_ok: o.result_ok,
8081 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8082 fn clone(&self) -> Self {
8084 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8085 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
8088 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8089 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8095 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8096 /// but with all dynamically-allocated buffers duplicated in new buffers.
8097 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8099 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8100 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8101 /// A pointer to the contents in the success state.
8102 /// Reading from this pointer when `result_ok` is not set is undefined.
8103 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
8104 /// A pointer to the contents in the error state.
8105 /// Reading from this pointer when `result_ok` is set is undefined.
8106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8109 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8110 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8112 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8113 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8114 /// `err` or `result` depending on the state of `result_ok`.
8115 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8116 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8117 pub result_ok: bool,
8120 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8121 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8122 CResult_NodeAnnouncementInfoDecodeErrorZ {
8123 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8124 result: Box::into_raw(Box::new(o)),
8130 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8131 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8132 CResult_NodeAnnouncementInfoDecodeErrorZ {
8133 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8134 err: Box::into_raw(Box::new(e)),
8140 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8141 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8142 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8143 fn drop(&mut self) {
8145 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8146 let _ = unsafe { Box::from_raw(self.contents.result) };
8149 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8150 let _ = unsafe { Box::from_raw(self.contents.err) };
8155 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8156 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8157 let contents = if o.result_ok {
8158 let result = unsafe { o.contents.result };
8159 unsafe { o.contents.result = std::ptr::null_mut() };
8160 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8162 let err = unsafe { o.contents.err };
8163 unsafe { o.contents.err = std::ptr::null_mut(); }
8164 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8168 result_ok: o.result_ok,
8172 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8173 fn clone(&self) -> Self {
8175 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8176 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8179 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8180 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8186 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8187 /// but with all dynamically-allocated buffers duplicated in new buffers.
8188 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
8190 /// A dynamically-allocated array of u64s of arbitrary size.
8191 /// This corresponds to std::vector in C++
8192 pub struct CVec_u64Z {
8193 /// The elements in the array.
8194 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8196 /// The number of elements pointed to by `data`.
8200 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
8201 if self.datalen == 0 { return Vec::new(); }
8202 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8203 self.data = std::ptr::null_mut();
8207 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
8208 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8211 impl From<Vec<u64>> for CVec_u64Z {
8212 fn from(v: Vec<u64>) -> Self {
8213 let datalen = v.len();
8214 let data = Box::into_raw(v.into_boxed_slice());
8215 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8219 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8220 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
8221 impl Drop for CVec_u64Z {
8222 fn drop(&mut self) {
8223 if self.datalen == 0 { return; }
8224 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8227 impl Clone for CVec_u64Z {
8228 fn clone(&self) -> Self {
8229 let mut res = Vec::new();
8230 if self.datalen == 0 { return Self::from(res); }
8231 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8236 /// The contents of CResult_NodeInfoDecodeErrorZ
8237 pub union CResult_NodeInfoDecodeErrorZPtr {
8238 /// A pointer to the contents in the success state.
8239 /// Reading from this pointer when `result_ok` is not set is undefined.
8240 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
8241 /// A pointer to the contents in the error state.
8242 /// Reading from this pointer when `result_ok` is set is undefined.
8243 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8246 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8247 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8249 pub struct CResult_NodeInfoDecodeErrorZ {
8250 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8251 /// `err` or `result` depending on the state of `result_ok`.
8252 pub contents: CResult_NodeInfoDecodeErrorZPtr,
8253 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8254 pub result_ok: bool,
8257 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8258 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
8259 CResult_NodeInfoDecodeErrorZ {
8260 contents: CResult_NodeInfoDecodeErrorZPtr {
8261 result: Box::into_raw(Box::new(o)),
8267 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8268 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
8269 CResult_NodeInfoDecodeErrorZ {
8270 contents: CResult_NodeInfoDecodeErrorZPtr {
8271 err: Box::into_raw(Box::new(e)),
8277 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8278 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
8279 impl Drop for CResult_NodeInfoDecodeErrorZ {
8280 fn drop(&mut self) {
8282 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8283 let _ = unsafe { Box::from_raw(self.contents.result) };
8286 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8287 let _ = unsafe { Box::from_raw(self.contents.err) };
8292 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
8293 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8294 let contents = if o.result_ok {
8295 let result = unsafe { o.contents.result };
8296 unsafe { o.contents.result = std::ptr::null_mut() };
8297 CResult_NodeInfoDecodeErrorZPtr { result }
8299 let err = unsafe { o.contents.err };
8300 unsafe { o.contents.err = std::ptr::null_mut(); }
8301 CResult_NodeInfoDecodeErrorZPtr { err }
8305 result_ok: o.result_ok,
8309 impl Clone for CResult_NodeInfoDecodeErrorZ {
8310 fn clone(&self) -> Self {
8312 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
8313 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
8316 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
8317 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8323 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8324 /// but with all dynamically-allocated buffers duplicated in new buffers.
8325 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
8327 /// The contents of CResult_NetworkGraphDecodeErrorZ
8328 pub union CResult_NetworkGraphDecodeErrorZPtr {
8329 /// A pointer to the contents in the success state.
8330 /// Reading from this pointer when `result_ok` is not set is undefined.
8331 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
8332 /// A pointer to the contents in the error state.
8333 /// Reading from this pointer when `result_ok` is set is undefined.
8334 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8337 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8338 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8340 pub struct CResult_NetworkGraphDecodeErrorZ {
8341 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8342 /// `err` or `result` depending on the state of `result_ok`.
8343 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
8344 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8345 pub result_ok: bool,
8348 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8349 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
8350 CResult_NetworkGraphDecodeErrorZ {
8351 contents: CResult_NetworkGraphDecodeErrorZPtr {
8352 result: Box::into_raw(Box::new(o)),
8358 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8359 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
8360 CResult_NetworkGraphDecodeErrorZ {
8361 contents: CResult_NetworkGraphDecodeErrorZPtr {
8362 err: Box::into_raw(Box::new(e)),
8368 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8369 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
8370 impl Drop for CResult_NetworkGraphDecodeErrorZ {
8371 fn drop(&mut self) {
8373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8374 let _ = unsafe { Box::from_raw(self.contents.result) };
8377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8378 let _ = unsafe { Box::from_raw(self.contents.err) };
8383 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
8384 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
8385 let contents = if o.result_ok {
8386 let result = unsafe { o.contents.result };
8387 unsafe { o.contents.result = std::ptr::null_mut() };
8388 CResult_NetworkGraphDecodeErrorZPtr { result }
8390 let err = unsafe { o.contents.err };
8391 unsafe { o.contents.err = std::ptr::null_mut(); }
8392 CResult_NetworkGraphDecodeErrorZPtr { err }
8396 result_ok: o.result_ok,
8400 impl Clone for CResult_NetworkGraphDecodeErrorZ {
8401 fn clone(&self) -> Self {
8403 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
8404 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
8407 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
8408 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8414 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8415 /// but with all dynamically-allocated buffers duplicated in new buffers.
8416 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
8418 /// The contents of CResult_NetAddressu8Z
8419 pub union CResult_NetAddressu8ZPtr {
8420 /// A pointer to the contents in the success state.
8421 /// Reading from this pointer when `result_ok` is not set is undefined.
8422 pub result: *mut crate::lightning::ln::msgs::NetAddress,
8423 /// A pointer to the contents in the error state.
8424 /// Reading from this pointer when `result_ok` is set is undefined.
8428 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
8429 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
8430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8431 pub struct CResult_NetAddressu8Z {
8432 /// The contents of this CResult_NetAddressu8Z, accessible via either
8433 /// `err` or `result` depending on the state of `result_ok`.
8434 pub contents: CResult_NetAddressu8ZPtr,
8435 /// Whether this CResult_NetAddressu8Z represents a success state.
8436 pub result_ok: bool,
8439 /// Creates a new CResult_NetAddressu8Z in the success state.
8440 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
8441 CResult_NetAddressu8Z {
8442 contents: CResult_NetAddressu8ZPtr {
8443 result: Box::into_raw(Box::new(o)),
8449 /// Creates a new CResult_NetAddressu8Z in the error state.
8450 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
8451 CResult_NetAddressu8Z {
8452 contents: CResult_NetAddressu8ZPtr {
8453 err: Box::into_raw(Box::new(e)),
8459 /// Frees any resources used by the CResult_NetAddressu8Z.
8460 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
8461 impl Drop for CResult_NetAddressu8Z {
8462 fn drop(&mut self) {
8464 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8465 let _ = unsafe { Box::from_raw(self.contents.result) };
8468 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8469 let _ = unsafe { Box::from_raw(self.contents.err) };
8474 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
8475 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
8476 let contents = if o.result_ok {
8477 let result = unsafe { o.contents.result };
8478 unsafe { o.contents.result = std::ptr::null_mut() };
8479 CResult_NetAddressu8ZPtr { result }
8481 let err = unsafe { o.contents.err };
8482 unsafe { o.contents.err = std::ptr::null_mut(); }
8483 CResult_NetAddressu8ZPtr { err }
8487 result_ok: o.result_ok,
8491 impl Clone for CResult_NetAddressu8Z {
8492 fn clone(&self) -> Self {
8494 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
8495 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8498 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
8499 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
8505 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8506 /// but with all dynamically-allocated buffers duplicated in new buffers.
8507 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { Clone::clone(&orig) }
8509 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
8510 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8511 /// A pointer to the contents in the success state.
8512 /// Reading from this pointer when `result_ok` is not set is undefined.
8513 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
8514 /// A pointer to the contents in the error state.
8515 /// Reading from this pointer when `result_ok` is set is undefined.
8516 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8519 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
8520 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
8521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8522 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
8523 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
8524 /// `err` or `result` depending on the state of `result_ok`.
8525 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
8526 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
8527 pub result_ok: bool,
8530 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8531 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8532 CResult_CResult_NetAddressu8ZDecodeErrorZ {
8533 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8534 result: Box::into_raw(Box::new(o)),
8540 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8541 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8542 CResult_CResult_NetAddressu8ZDecodeErrorZ {
8543 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8544 err: Box::into_raw(Box::new(e)),
8550 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8551 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
8552 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8553 fn drop(&mut self) {
8555 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8556 let _ = unsafe { Box::from_raw(self.contents.result) };
8559 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8560 let _ = unsafe { Box::from_raw(self.contents.err) };
8565 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8566 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
8567 let contents = if o.result_ok {
8568 let result = unsafe { o.contents.result };
8569 unsafe { o.contents.result = std::ptr::null_mut() };
8570 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
8572 let err = unsafe { o.contents.err };
8573 unsafe { o.contents.err = std::ptr::null_mut(); }
8574 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
8578 result_ok: o.result_ok,
8582 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8583 fn clone(&self) -> Self {
8585 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8586 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
8589 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8590 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8596 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8597 /// but with all dynamically-allocated buffers duplicated in new buffers.
8598 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { Clone::clone(&orig) }
8600 /// The contents of CResult_NetAddressDecodeErrorZ
8601 pub union CResult_NetAddressDecodeErrorZPtr {
8602 /// A pointer to the contents in the success state.
8603 /// Reading from this pointer when `result_ok` is not set is undefined.
8604 pub result: *mut crate::lightning::ln::msgs::NetAddress,
8605 /// A pointer to the contents in the error state.
8606 /// Reading from this pointer when `result_ok` is set is undefined.
8607 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8610 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8611 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8613 pub struct CResult_NetAddressDecodeErrorZ {
8614 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8615 /// `err` or `result` depending on the state of `result_ok`.
8616 pub contents: CResult_NetAddressDecodeErrorZPtr,
8617 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8618 pub result_ok: bool,
8621 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
8622 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
8623 CResult_NetAddressDecodeErrorZ {
8624 contents: CResult_NetAddressDecodeErrorZPtr {
8625 result: Box::into_raw(Box::new(o)),
8631 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
8632 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
8633 CResult_NetAddressDecodeErrorZ {
8634 contents: CResult_NetAddressDecodeErrorZPtr {
8635 err: Box::into_raw(Box::new(e)),
8641 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
8642 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
8643 impl Drop for CResult_NetAddressDecodeErrorZ {
8644 fn drop(&mut self) {
8646 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8647 let _ = unsafe { Box::from_raw(self.contents.result) };
8650 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8651 let _ = unsafe { Box::from_raw(self.contents.err) };
8656 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
8657 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
8658 let contents = if o.result_ok {
8659 let result = unsafe { o.contents.result };
8660 unsafe { o.contents.result = std::ptr::null_mut() };
8661 CResult_NetAddressDecodeErrorZPtr { result }
8663 let err = unsafe { o.contents.err };
8664 unsafe { o.contents.err = std::ptr::null_mut(); }
8665 CResult_NetAddressDecodeErrorZPtr { err }
8669 result_ok: o.result_ok,
8673 impl Clone for CResult_NetAddressDecodeErrorZ {
8674 fn clone(&self) -> Self {
8676 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
8677 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8680 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
8681 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8687 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
8688 /// but with all dynamically-allocated buffers duplicated in new buffers.
8689 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
8691 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8692 /// This corresponds to std::vector in C++
8693 pub struct CVec_UpdateAddHTLCZ {
8694 /// The elements in the array.
8695 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8696 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
8697 /// The number of elements pointed to by `data`.
8700 impl CVec_UpdateAddHTLCZ {
8701 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
8702 if self.datalen == 0 { return Vec::new(); }
8703 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8704 self.data = std::ptr::null_mut();
8708 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
8709 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8712 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
8713 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
8714 let datalen = v.len();
8715 let data = Box::into_raw(v.into_boxed_slice());
8716 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8720 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8721 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
8722 impl Drop for CVec_UpdateAddHTLCZ {
8723 fn drop(&mut self) {
8724 if self.datalen == 0 { return; }
8725 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8728 impl Clone for CVec_UpdateAddHTLCZ {
8729 fn clone(&self) -> Self {
8730 let mut res = Vec::new();
8731 if self.datalen == 0 { return Self::from(res); }
8732 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8737 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8738 /// This corresponds to std::vector in C++
8739 pub struct CVec_UpdateFulfillHTLCZ {
8740 /// The elements in the array.
8741 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8742 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
8743 /// The number of elements pointed to by `data`.
8746 impl CVec_UpdateFulfillHTLCZ {
8747 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8748 if self.datalen == 0 { return Vec::new(); }
8749 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8750 self.data = std::ptr::null_mut();
8754 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8755 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8758 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8759 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8760 let datalen = v.len();
8761 let data = Box::into_raw(v.into_boxed_slice());
8762 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8766 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8767 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8768 impl Drop for CVec_UpdateFulfillHTLCZ {
8769 fn drop(&mut self) {
8770 if self.datalen == 0 { return; }
8771 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8774 impl Clone for CVec_UpdateFulfillHTLCZ {
8775 fn clone(&self) -> Self {
8776 let mut res = Vec::new();
8777 if self.datalen == 0 { return Self::from(res); }
8778 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8783 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8784 /// This corresponds to std::vector in C++
8785 pub struct CVec_UpdateFailHTLCZ {
8786 /// The elements in the array.
8787 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8788 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8789 /// The number of elements pointed to by `data`.
8792 impl CVec_UpdateFailHTLCZ {
8793 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8794 if self.datalen == 0 { return Vec::new(); }
8795 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8796 self.data = std::ptr::null_mut();
8800 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8801 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8804 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8805 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8806 let datalen = v.len();
8807 let data = Box::into_raw(v.into_boxed_slice());
8808 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8812 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8813 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8814 impl Drop for CVec_UpdateFailHTLCZ {
8815 fn drop(&mut self) {
8816 if self.datalen == 0 { return; }
8817 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8820 impl Clone for CVec_UpdateFailHTLCZ {
8821 fn clone(&self) -> Self {
8822 let mut res = Vec::new();
8823 if self.datalen == 0 { return Self::from(res); }
8824 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8829 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8830 /// This corresponds to std::vector in C++
8831 pub struct CVec_UpdateFailMalformedHTLCZ {
8832 /// The elements in the array.
8833 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8834 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8835 /// The number of elements pointed to by `data`.
8838 impl CVec_UpdateFailMalformedHTLCZ {
8839 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8840 if self.datalen == 0 { return Vec::new(); }
8841 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8842 self.data = std::ptr::null_mut();
8846 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8847 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8850 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8851 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8852 let datalen = v.len();
8853 let data = Box::into_raw(v.into_boxed_slice());
8854 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8859 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8860 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8861 fn drop(&mut self) {
8862 if self.datalen == 0 { return; }
8863 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8866 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8867 fn clone(&self) -> Self {
8868 let mut res = Vec::new();
8869 if self.datalen == 0 { return Self::from(res); }
8870 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8875 /// The contents of CResult_AcceptChannelDecodeErrorZ
8876 pub union CResult_AcceptChannelDecodeErrorZPtr {
8877 /// A pointer to the contents in the success state.
8878 /// Reading from this pointer when `result_ok` is not set is undefined.
8879 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8880 /// A pointer to the contents in the error state.
8881 /// Reading from this pointer when `result_ok` is set is undefined.
8882 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8885 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8886 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8888 pub struct CResult_AcceptChannelDecodeErrorZ {
8889 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8890 /// `err` or `result` depending on the state of `result_ok`.
8891 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8892 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8893 pub result_ok: bool,
8896 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8897 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8898 CResult_AcceptChannelDecodeErrorZ {
8899 contents: CResult_AcceptChannelDecodeErrorZPtr {
8900 result: Box::into_raw(Box::new(o)),
8906 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8907 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8908 CResult_AcceptChannelDecodeErrorZ {
8909 contents: CResult_AcceptChannelDecodeErrorZPtr {
8910 err: Box::into_raw(Box::new(e)),
8916 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8917 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8918 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8919 fn drop(&mut self) {
8921 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8922 let _ = unsafe { Box::from_raw(self.contents.result) };
8925 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8926 let _ = unsafe { Box::from_raw(self.contents.err) };
8931 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8932 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8933 let contents = if o.result_ok {
8934 let result = unsafe { o.contents.result };
8935 unsafe { o.contents.result = std::ptr::null_mut() };
8936 CResult_AcceptChannelDecodeErrorZPtr { result }
8938 let err = unsafe { o.contents.err };
8939 unsafe { o.contents.err = std::ptr::null_mut(); }
8940 CResult_AcceptChannelDecodeErrorZPtr { err }
8944 result_ok: o.result_ok,
8948 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8949 fn clone(&self) -> Self {
8951 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8952 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8955 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8956 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8962 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8963 /// but with all dynamically-allocated buffers duplicated in new buffers.
8964 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
8966 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8967 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8968 /// A pointer to the contents in the success state.
8969 /// Reading from this pointer when `result_ok` is not set is undefined.
8970 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8971 /// A pointer to the contents in the error state.
8972 /// Reading from this pointer when `result_ok` is set is undefined.
8973 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8976 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8977 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8978 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8979 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8980 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8981 /// `err` or `result` depending on the state of `result_ok`.
8982 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8983 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8984 pub result_ok: bool,
8987 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8988 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8989 CResult_AnnouncementSignaturesDecodeErrorZ {
8990 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8991 result: Box::into_raw(Box::new(o)),
8997 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8998 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8999 CResult_AnnouncementSignaturesDecodeErrorZ {
9000 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9001 err: Box::into_raw(Box::new(e)),
9007 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
9008 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
9009 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
9010 fn drop(&mut self) {
9012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9013 let _ = unsafe { Box::from_raw(self.contents.result) };
9016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9017 let _ = unsafe { Box::from_raw(self.contents.err) };
9022 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9023 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
9024 let contents = if o.result_ok {
9025 let result = unsafe { o.contents.result };
9026 unsafe { o.contents.result = std::ptr::null_mut() };
9027 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
9029 let err = unsafe { o.contents.err };
9030 unsafe { o.contents.err = std::ptr::null_mut(); }
9031 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9035 result_ok: o.result_ok,
9039 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9040 fn clone(&self) -> Self {
9042 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9043 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9046 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9047 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9053 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9054 /// but with all dynamically-allocated buffers duplicated in new buffers.
9055 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9057 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9058 pub union CResult_ChannelReestablishDecodeErrorZPtr {
9059 /// A pointer to the contents in the success state.
9060 /// Reading from this pointer when `result_ok` is not set is undefined.
9061 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
9062 /// A pointer to the contents in the error state.
9063 /// Reading from this pointer when `result_ok` is set is undefined.
9064 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9067 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9068 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9070 pub struct CResult_ChannelReestablishDecodeErrorZ {
9071 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9072 /// `err` or `result` depending on the state of `result_ok`.
9073 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9074 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9075 pub result_ok: bool,
9078 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9079 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9080 CResult_ChannelReestablishDecodeErrorZ {
9081 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9082 result: Box::into_raw(Box::new(o)),
9088 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9089 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9090 CResult_ChannelReestablishDecodeErrorZ {
9091 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9092 err: Box::into_raw(Box::new(e)),
9098 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
9099 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9100 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
9101 fn drop(&mut self) {
9103 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9104 let _ = unsafe { Box::from_raw(self.contents.result) };
9107 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9108 let _ = unsafe { Box::from_raw(self.contents.err) };
9113 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9114 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
9115 let contents = if o.result_ok {
9116 let result = unsafe { o.contents.result };
9117 unsafe { o.contents.result = std::ptr::null_mut() };
9118 CResult_ChannelReestablishDecodeErrorZPtr { result }
9120 let err = unsafe { o.contents.err };
9121 unsafe { o.contents.err = std::ptr::null_mut(); }
9122 CResult_ChannelReestablishDecodeErrorZPtr { err }
9126 result_ok: o.result_ok,
9130 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9131 fn clone(&self) -> Self {
9133 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9134 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9137 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9138 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9144 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9145 /// but with all dynamically-allocated buffers duplicated in new buffers.
9146 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9148 /// The contents of CResult_ClosingSignedDecodeErrorZ
9149 pub union CResult_ClosingSignedDecodeErrorZPtr {
9150 /// A pointer to the contents in the success state.
9151 /// Reading from this pointer when `result_ok` is not set is undefined.
9152 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
9153 /// A pointer to the contents in the error state.
9154 /// Reading from this pointer when `result_ok` is set is undefined.
9155 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9158 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9159 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9160 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9161 pub struct CResult_ClosingSignedDecodeErrorZ {
9162 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9163 /// `err` or `result` depending on the state of `result_ok`.
9164 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9165 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9166 pub result_ok: bool,
9169 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9170 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9171 CResult_ClosingSignedDecodeErrorZ {
9172 contents: CResult_ClosingSignedDecodeErrorZPtr {
9173 result: Box::into_raw(Box::new(o)),
9179 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9180 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
9181 CResult_ClosingSignedDecodeErrorZ {
9182 contents: CResult_ClosingSignedDecodeErrorZPtr {
9183 err: Box::into_raw(Box::new(e)),
9189 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
9190 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
9191 impl Drop for CResult_ClosingSignedDecodeErrorZ {
9192 fn drop(&mut self) {
9194 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9195 let _ = unsafe { Box::from_raw(self.contents.result) };
9198 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9199 let _ = unsafe { Box::from_raw(self.contents.err) };
9204 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
9205 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9206 let contents = if o.result_ok {
9207 let result = unsafe { o.contents.result };
9208 unsafe { o.contents.result = std::ptr::null_mut() };
9209 CResult_ClosingSignedDecodeErrorZPtr { result }
9211 let err = unsafe { o.contents.err };
9212 unsafe { o.contents.err = std::ptr::null_mut(); }
9213 CResult_ClosingSignedDecodeErrorZPtr { err }
9217 result_ok: o.result_ok,
9221 impl Clone for CResult_ClosingSignedDecodeErrorZ {
9222 fn clone(&self) -> Self {
9224 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
9225 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
9228 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
9229 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9235 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
9236 /// but with all dynamically-allocated buffers duplicated in new buffers.
9237 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
9239 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9240 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9241 /// A pointer to the contents in the success state.
9242 /// Reading from this pointer when `result_ok` is not set is undefined.
9243 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
9244 /// A pointer to the contents in the error state.
9245 /// Reading from this pointer when `result_ok` is set is undefined.
9246 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9249 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9250 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9252 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
9253 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9254 /// `err` or `result` depending on the state of `result_ok`.
9255 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
9256 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9257 pub result_ok: bool,
9260 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
9261 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9262 CResult_ClosingSignedFeeRangeDecodeErrorZ {
9263 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9264 result: Box::into_raw(Box::new(o)),
9270 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
9271 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9272 CResult_ClosingSignedFeeRangeDecodeErrorZ {
9273 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9274 err: Box::into_raw(Box::new(e)),
9280 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
9281 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
9282 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9283 fn drop(&mut self) {
9285 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9286 let _ = unsafe { Box::from_raw(self.contents.result) };
9289 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9290 let _ = unsafe { Box::from_raw(self.contents.err) };
9295 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9296 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
9297 let contents = if o.result_ok {
9298 let result = unsafe { o.contents.result };
9299 unsafe { o.contents.result = std::ptr::null_mut() };
9300 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
9302 let err = unsafe { o.contents.err };
9303 unsafe { o.contents.err = std::ptr::null_mut(); }
9304 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
9308 result_ok: o.result_ok,
9312 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9313 fn clone(&self) -> Self {
9315 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9316 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
9319 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9320 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9326 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
9327 /// but with all dynamically-allocated buffers duplicated in new buffers.
9328 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
9330 /// The contents of CResult_CommitmentSignedDecodeErrorZ
9331 pub union CResult_CommitmentSignedDecodeErrorZPtr {
9332 /// A pointer to the contents in the success state.
9333 /// Reading from this pointer when `result_ok` is not set is undefined.
9334 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
9335 /// A pointer to the contents in the error state.
9336 /// Reading from this pointer when `result_ok` is set is undefined.
9337 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9340 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9341 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9343 pub struct CResult_CommitmentSignedDecodeErrorZ {
9344 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9345 /// `err` or `result` depending on the state of `result_ok`.
9346 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
9347 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9348 pub result_ok: bool,
9351 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
9352 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
9353 CResult_CommitmentSignedDecodeErrorZ {
9354 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9355 result: Box::into_raw(Box::new(o)),
9361 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
9362 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
9363 CResult_CommitmentSignedDecodeErrorZ {
9364 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9365 err: Box::into_raw(Box::new(e)),
9371 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
9372 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
9373 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
9374 fn drop(&mut self) {
9376 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9377 let _ = unsafe { Box::from_raw(self.contents.result) };
9380 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9381 let _ = unsafe { Box::from_raw(self.contents.err) };
9386 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
9387 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9388 let contents = if o.result_ok {
9389 let result = unsafe { o.contents.result };
9390 unsafe { o.contents.result = std::ptr::null_mut() };
9391 CResult_CommitmentSignedDecodeErrorZPtr { result }
9393 let err = unsafe { o.contents.err };
9394 unsafe { o.contents.err = std::ptr::null_mut(); }
9395 CResult_CommitmentSignedDecodeErrorZPtr { err }
9399 result_ok: o.result_ok,
9403 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
9404 fn clone(&self) -> Self {
9406 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9407 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
9410 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9411 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9417 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
9418 /// but with all dynamically-allocated buffers duplicated in new buffers.
9419 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
9421 /// The contents of CResult_FundingCreatedDecodeErrorZ
9422 pub union CResult_FundingCreatedDecodeErrorZPtr {
9423 /// A pointer to the contents in the success state.
9424 /// Reading from this pointer when `result_ok` is not set is undefined.
9425 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
9426 /// A pointer to the contents in the error state.
9427 /// Reading from this pointer when `result_ok` is set is undefined.
9428 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9431 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9432 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9434 pub struct CResult_FundingCreatedDecodeErrorZ {
9435 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9436 /// `err` or `result` depending on the state of `result_ok`.
9437 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
9438 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9439 pub result_ok: bool,
9442 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
9443 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
9444 CResult_FundingCreatedDecodeErrorZ {
9445 contents: CResult_FundingCreatedDecodeErrorZPtr {
9446 result: Box::into_raw(Box::new(o)),
9452 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
9453 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
9454 CResult_FundingCreatedDecodeErrorZ {
9455 contents: CResult_FundingCreatedDecodeErrorZPtr {
9456 err: Box::into_raw(Box::new(e)),
9462 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
9463 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
9464 impl Drop for CResult_FundingCreatedDecodeErrorZ {
9465 fn drop(&mut self) {
9467 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9468 let _ = unsafe { Box::from_raw(self.contents.result) };
9471 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9472 let _ = unsafe { Box::from_raw(self.contents.err) };
9477 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
9478 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
9479 let contents = if o.result_ok {
9480 let result = unsafe { o.contents.result };
9481 unsafe { o.contents.result = std::ptr::null_mut() };
9482 CResult_FundingCreatedDecodeErrorZPtr { result }
9484 let err = unsafe { o.contents.err };
9485 unsafe { o.contents.err = std::ptr::null_mut(); }
9486 CResult_FundingCreatedDecodeErrorZPtr { err }
9490 result_ok: o.result_ok,
9494 impl Clone for CResult_FundingCreatedDecodeErrorZ {
9495 fn clone(&self) -> Self {
9497 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
9498 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
9501 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
9502 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9508 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
9509 /// but with all dynamically-allocated buffers duplicated in new buffers.
9510 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
9512 /// The contents of CResult_FundingSignedDecodeErrorZ
9513 pub union CResult_FundingSignedDecodeErrorZPtr {
9514 /// A pointer to the contents in the success state.
9515 /// Reading from this pointer when `result_ok` is not set is undefined.
9516 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
9517 /// A pointer to the contents in the error state.
9518 /// Reading from this pointer when `result_ok` is set is undefined.
9519 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9522 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9523 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9525 pub struct CResult_FundingSignedDecodeErrorZ {
9526 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9527 /// `err` or `result` depending on the state of `result_ok`.
9528 pub contents: CResult_FundingSignedDecodeErrorZPtr,
9529 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9530 pub result_ok: bool,
9533 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
9534 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
9535 CResult_FundingSignedDecodeErrorZ {
9536 contents: CResult_FundingSignedDecodeErrorZPtr {
9537 result: Box::into_raw(Box::new(o)),
9543 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
9544 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
9545 CResult_FundingSignedDecodeErrorZ {
9546 contents: CResult_FundingSignedDecodeErrorZPtr {
9547 err: Box::into_raw(Box::new(e)),
9553 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
9554 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
9555 impl Drop for CResult_FundingSignedDecodeErrorZ {
9556 fn drop(&mut self) {
9558 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9559 let _ = unsafe { Box::from_raw(self.contents.result) };
9562 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9563 let _ = unsafe { Box::from_raw(self.contents.err) };
9568 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
9569 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9570 let contents = if o.result_ok {
9571 let result = unsafe { o.contents.result };
9572 unsafe { o.contents.result = std::ptr::null_mut() };
9573 CResult_FundingSignedDecodeErrorZPtr { result }
9575 let err = unsafe { o.contents.err };
9576 unsafe { o.contents.err = std::ptr::null_mut(); }
9577 CResult_FundingSignedDecodeErrorZPtr { err }
9581 result_ok: o.result_ok,
9585 impl Clone for CResult_FundingSignedDecodeErrorZ {
9586 fn clone(&self) -> Self {
9588 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
9589 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
9592 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
9593 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9599 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
9600 /// but with all dynamically-allocated buffers duplicated in new buffers.
9601 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
9603 /// The contents of CResult_FundingLockedDecodeErrorZ
9604 pub union CResult_FundingLockedDecodeErrorZPtr {
9605 /// A pointer to the contents in the success state.
9606 /// Reading from this pointer when `result_ok` is not set is undefined.
9607 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
9608 /// A pointer to the contents in the error state.
9609 /// Reading from this pointer when `result_ok` is set is undefined.
9610 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9613 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9614 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9616 pub struct CResult_FundingLockedDecodeErrorZ {
9617 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9618 /// `err` or `result` depending on the state of `result_ok`.
9619 pub contents: CResult_FundingLockedDecodeErrorZPtr,
9620 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9621 pub result_ok: bool,
9624 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
9625 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
9626 CResult_FundingLockedDecodeErrorZ {
9627 contents: CResult_FundingLockedDecodeErrorZPtr {
9628 result: Box::into_raw(Box::new(o)),
9634 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
9635 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
9636 CResult_FundingLockedDecodeErrorZ {
9637 contents: CResult_FundingLockedDecodeErrorZPtr {
9638 err: Box::into_raw(Box::new(e)),
9644 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
9645 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
9646 impl Drop for CResult_FundingLockedDecodeErrorZ {
9647 fn drop(&mut self) {
9649 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9650 let _ = unsafe { Box::from_raw(self.contents.result) };
9653 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9654 let _ = unsafe { Box::from_raw(self.contents.err) };
9659 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
9660 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
9661 let contents = if o.result_ok {
9662 let result = unsafe { o.contents.result };
9663 unsafe { o.contents.result = std::ptr::null_mut() };
9664 CResult_FundingLockedDecodeErrorZPtr { result }
9666 let err = unsafe { o.contents.err };
9667 unsafe { o.contents.err = std::ptr::null_mut(); }
9668 CResult_FundingLockedDecodeErrorZPtr { err }
9672 result_ok: o.result_ok,
9676 impl Clone for CResult_FundingLockedDecodeErrorZ {
9677 fn clone(&self) -> Self {
9679 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
9680 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
9683 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
9684 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9690 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
9691 /// but with all dynamically-allocated buffers duplicated in new buffers.
9692 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
9694 /// The contents of CResult_InitDecodeErrorZ
9695 pub union CResult_InitDecodeErrorZPtr {
9696 /// A pointer to the contents in the success state.
9697 /// Reading from this pointer when `result_ok` is not set is undefined.
9698 pub result: *mut crate::lightning::ln::msgs::Init,
9699 /// A pointer to the contents in the error state.
9700 /// Reading from this pointer when `result_ok` is set is undefined.
9701 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9704 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9705 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9707 pub struct CResult_InitDecodeErrorZ {
9708 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
9709 /// `err` or `result` depending on the state of `result_ok`.
9710 pub contents: CResult_InitDecodeErrorZPtr,
9711 /// Whether this CResult_InitDecodeErrorZ represents a success state.
9712 pub result_ok: bool,
9715 /// Creates a new CResult_InitDecodeErrorZ in the success state.
9716 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
9717 CResult_InitDecodeErrorZ {
9718 contents: CResult_InitDecodeErrorZPtr {
9719 result: Box::into_raw(Box::new(o)),
9725 /// Creates a new CResult_InitDecodeErrorZ in the error state.
9726 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
9727 CResult_InitDecodeErrorZ {
9728 contents: CResult_InitDecodeErrorZPtr {
9729 err: Box::into_raw(Box::new(e)),
9735 /// Frees any resources used by the CResult_InitDecodeErrorZ.
9736 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
9737 impl Drop for CResult_InitDecodeErrorZ {
9738 fn drop(&mut self) {
9740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9741 let _ = unsafe { Box::from_raw(self.contents.result) };
9744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9745 let _ = unsafe { Box::from_raw(self.contents.err) };
9750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
9751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
9752 let contents = if o.result_ok {
9753 let result = unsafe { o.contents.result };
9754 unsafe { o.contents.result = std::ptr::null_mut() };
9755 CResult_InitDecodeErrorZPtr { result }
9757 let err = unsafe { o.contents.err };
9758 unsafe { o.contents.err = std::ptr::null_mut(); }
9759 CResult_InitDecodeErrorZPtr { err }
9763 result_ok: o.result_ok,
9767 impl Clone for CResult_InitDecodeErrorZ {
9768 fn clone(&self) -> Self {
9770 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
9771 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
9774 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
9775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9781 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
9782 /// but with all dynamically-allocated buffers duplicated in new buffers.
9783 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
9785 /// The contents of CResult_OpenChannelDecodeErrorZ
9786 pub union CResult_OpenChannelDecodeErrorZPtr {
9787 /// A pointer to the contents in the success state.
9788 /// Reading from this pointer when `result_ok` is not set is undefined.
9789 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
9790 /// A pointer to the contents in the error state.
9791 /// Reading from this pointer when `result_ok` is set is undefined.
9792 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9795 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9796 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9798 pub struct CResult_OpenChannelDecodeErrorZ {
9799 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9800 /// `err` or `result` depending on the state of `result_ok`.
9801 pub contents: CResult_OpenChannelDecodeErrorZPtr,
9802 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9803 pub result_ok: bool,
9806 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9807 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
9808 CResult_OpenChannelDecodeErrorZ {
9809 contents: CResult_OpenChannelDecodeErrorZPtr {
9810 result: Box::into_raw(Box::new(o)),
9816 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9817 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
9818 CResult_OpenChannelDecodeErrorZ {
9819 contents: CResult_OpenChannelDecodeErrorZPtr {
9820 err: Box::into_raw(Box::new(e)),
9826 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9827 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
9828 impl Drop for CResult_OpenChannelDecodeErrorZ {
9829 fn drop(&mut self) {
9831 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9832 let _ = unsafe { Box::from_raw(self.contents.result) };
9835 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9836 let _ = unsafe { Box::from_raw(self.contents.err) };
9841 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9842 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9843 let contents = if o.result_ok {
9844 let result = unsafe { o.contents.result };
9845 unsafe { o.contents.result = std::ptr::null_mut() };
9846 CResult_OpenChannelDecodeErrorZPtr { result }
9848 let err = unsafe { o.contents.err };
9849 unsafe { o.contents.err = std::ptr::null_mut(); }
9850 CResult_OpenChannelDecodeErrorZPtr { err }
9854 result_ok: o.result_ok,
9858 impl Clone for CResult_OpenChannelDecodeErrorZ {
9859 fn clone(&self) -> Self {
9861 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9862 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9865 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9866 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9872 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9873 /// but with all dynamically-allocated buffers duplicated in new buffers.
9874 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
9876 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9877 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9878 /// A pointer to the contents in the success state.
9879 /// Reading from this pointer when `result_ok` is not set is undefined.
9880 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9881 /// A pointer to the contents in the error state.
9882 /// Reading from this pointer when `result_ok` is set is undefined.
9883 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9886 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9887 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9889 pub struct CResult_RevokeAndACKDecodeErrorZ {
9890 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9891 /// `err` or `result` depending on the state of `result_ok`.
9892 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9893 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9894 pub result_ok: bool,
9897 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9898 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9899 CResult_RevokeAndACKDecodeErrorZ {
9900 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9901 result: Box::into_raw(Box::new(o)),
9907 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9908 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9909 CResult_RevokeAndACKDecodeErrorZ {
9910 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9911 err: Box::into_raw(Box::new(e)),
9917 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9918 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9919 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9920 fn drop(&mut self) {
9922 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9923 let _ = unsafe { Box::from_raw(self.contents.result) };
9926 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9927 let _ = unsafe { Box::from_raw(self.contents.err) };
9932 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9933 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9934 let contents = if o.result_ok {
9935 let result = unsafe { o.contents.result };
9936 unsafe { o.contents.result = std::ptr::null_mut() };
9937 CResult_RevokeAndACKDecodeErrorZPtr { result }
9939 let err = unsafe { o.contents.err };
9940 unsafe { o.contents.err = std::ptr::null_mut(); }
9941 CResult_RevokeAndACKDecodeErrorZPtr { err }
9945 result_ok: o.result_ok,
9949 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9950 fn clone(&self) -> Self {
9952 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9953 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9956 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9957 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9963 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9964 /// but with all dynamically-allocated buffers duplicated in new buffers.
9965 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
9967 /// The contents of CResult_ShutdownDecodeErrorZ
9968 pub union CResult_ShutdownDecodeErrorZPtr {
9969 /// A pointer to the contents in the success state.
9970 /// Reading from this pointer when `result_ok` is not set is undefined.
9971 pub result: *mut crate::lightning::ln::msgs::Shutdown,
9972 /// A pointer to the contents in the error state.
9973 /// Reading from this pointer when `result_ok` is set is undefined.
9974 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9977 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9978 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9980 pub struct CResult_ShutdownDecodeErrorZ {
9981 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9982 /// `err` or `result` depending on the state of `result_ok`.
9983 pub contents: CResult_ShutdownDecodeErrorZPtr,
9984 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9985 pub result_ok: bool,
9988 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9989 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9990 CResult_ShutdownDecodeErrorZ {
9991 contents: CResult_ShutdownDecodeErrorZPtr {
9992 result: Box::into_raw(Box::new(o)),
9998 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9999 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
10000 CResult_ShutdownDecodeErrorZ {
10001 contents: CResult_ShutdownDecodeErrorZPtr {
10002 err: Box::into_raw(Box::new(e)),
10008 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10009 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
10010 impl Drop for CResult_ShutdownDecodeErrorZ {
10011 fn drop(&mut self) {
10012 if self.result_ok {
10013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10014 let _ = unsafe { Box::from_raw(self.contents.result) };
10017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10018 let _ = unsafe { Box::from_raw(self.contents.err) };
10023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10024 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
10025 let contents = if o.result_ok {
10026 let result = unsafe { o.contents.result };
10027 unsafe { o.contents.result = std::ptr::null_mut() };
10028 CResult_ShutdownDecodeErrorZPtr { result }
10030 let err = unsafe { o.contents.err };
10031 unsafe { o.contents.err = std::ptr::null_mut(); }
10032 CResult_ShutdownDecodeErrorZPtr { err }
10036 result_ok: o.result_ok,
10040 impl Clone for CResult_ShutdownDecodeErrorZ {
10041 fn clone(&self) -> Self {
10042 if self.result_ok {
10043 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10044 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10047 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
10048 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10054 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10055 /// but with all dynamically-allocated buffers duplicated in new buffers.
10056 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10058 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10059 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
10060 /// A pointer to the contents in the success state.
10061 /// Reading from this pointer when `result_ok` is not set is undefined.
10062 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10063 /// A pointer to the contents in the error state.
10064 /// Reading from this pointer when `result_ok` is set is undefined.
10065 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10068 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10069 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10071 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
10072 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10073 /// `err` or `result` depending on the state of `result_ok`.
10074 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10075 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10076 pub result_ok: bool,
10079 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10080 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10081 CResult_UpdateFailHTLCDecodeErrorZ {
10082 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10083 result: Box::into_raw(Box::new(o)),
10089 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10090 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10091 CResult_UpdateFailHTLCDecodeErrorZ {
10092 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10093 err: Box::into_raw(Box::new(e)),
10099 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10100 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10101 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
10102 fn drop(&mut self) {
10103 if self.result_ok {
10104 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10105 let _ = unsafe { Box::from_raw(self.contents.result) };
10108 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10109 let _ = unsafe { Box::from_raw(self.contents.err) };
10114 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10115 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10116 let contents = if o.result_ok {
10117 let result = unsafe { o.contents.result };
10118 unsafe { o.contents.result = std::ptr::null_mut() };
10119 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
10121 let err = unsafe { o.contents.err };
10122 unsafe { o.contents.err = std::ptr::null_mut(); }
10123 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10127 result_ok: o.result_ok,
10131 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10132 fn clone(&self) -> Self {
10133 if self.result_ok {
10134 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10135 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10138 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10139 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10145 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10146 /// but with all dynamically-allocated buffers duplicated in new buffers.
10147 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10149 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10150 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10151 /// A pointer to the contents in the success state.
10152 /// Reading from this pointer when `result_ok` is not set is undefined.
10153 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10154 /// A pointer to the contents in the error state.
10155 /// Reading from this pointer when `result_ok` is set is undefined.
10156 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10159 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10160 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10162 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10163 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10164 /// `err` or `result` depending on the state of `result_ok`.
10165 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10166 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10167 pub result_ok: bool,
10170 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10171 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10172 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10173 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10174 result: Box::into_raw(Box::new(o)),
10180 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10181 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10182 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10183 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10184 err: Box::into_raw(Box::new(e)),
10190 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10191 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
10192 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10193 fn drop(&mut self) {
10194 if self.result_ok {
10195 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10196 let _ = unsafe { Box::from_raw(self.contents.result) };
10199 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10200 let _ = unsafe { Box::from_raw(self.contents.err) };
10205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10206 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10207 let contents = if o.result_ok {
10208 let result = unsafe { o.contents.result };
10209 unsafe { o.contents.result = std::ptr::null_mut() };
10210 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
10212 let err = unsafe { o.contents.err };
10213 unsafe { o.contents.err = std::ptr::null_mut(); }
10214 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
10218 result_ok: o.result_ok,
10222 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10223 fn clone(&self) -> Self {
10224 if self.result_ok {
10225 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10226 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
10229 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10230 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10236 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10237 /// but with all dynamically-allocated buffers duplicated in new buffers.
10238 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
10240 /// The contents of CResult_UpdateFeeDecodeErrorZ
10241 pub union CResult_UpdateFeeDecodeErrorZPtr {
10242 /// A pointer to the contents in the success state.
10243 /// Reading from this pointer when `result_ok` is not set is undefined.
10244 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
10245 /// A pointer to the contents in the error state.
10246 /// Reading from this pointer when `result_ok` is set is undefined.
10247 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10250 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10251 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10253 pub struct CResult_UpdateFeeDecodeErrorZ {
10254 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10255 /// `err` or `result` depending on the state of `result_ok`.
10256 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
10257 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10258 pub result_ok: bool,
10261 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10262 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
10263 CResult_UpdateFeeDecodeErrorZ {
10264 contents: CResult_UpdateFeeDecodeErrorZPtr {
10265 result: Box::into_raw(Box::new(o)),
10271 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10272 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
10273 CResult_UpdateFeeDecodeErrorZ {
10274 contents: CResult_UpdateFeeDecodeErrorZPtr {
10275 err: Box::into_raw(Box::new(e)),
10281 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10282 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
10283 impl Drop for CResult_UpdateFeeDecodeErrorZ {
10284 fn drop(&mut self) {
10285 if self.result_ok {
10286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10287 let _ = unsafe { Box::from_raw(self.contents.result) };
10290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10291 let _ = unsafe { Box::from_raw(self.contents.err) };
10296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
10297 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
10298 let contents = if o.result_ok {
10299 let result = unsafe { o.contents.result };
10300 unsafe { o.contents.result = std::ptr::null_mut() };
10301 CResult_UpdateFeeDecodeErrorZPtr { result }
10303 let err = unsafe { o.contents.err };
10304 unsafe { o.contents.err = std::ptr::null_mut(); }
10305 CResult_UpdateFeeDecodeErrorZPtr { err }
10309 result_ok: o.result_ok,
10313 impl Clone for CResult_UpdateFeeDecodeErrorZ {
10314 fn clone(&self) -> Self {
10315 if self.result_ok {
10316 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
10317 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
10320 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
10321 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10327 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10328 /// but with all dynamically-allocated buffers duplicated in new buffers.
10329 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
10331 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10332 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10333 /// A pointer to the contents in the success state.
10334 /// Reading from this pointer when `result_ok` is not set is undefined.
10335 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10336 /// A pointer to the contents in the error state.
10337 /// Reading from this pointer when `result_ok` is set is undefined.
10338 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10341 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10342 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10344 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
10345 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10346 /// `err` or `result` depending on the state of `result_ok`.
10347 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
10348 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10349 pub result_ok: bool,
10352 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10353 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10354 CResult_UpdateFulfillHTLCDecodeErrorZ {
10355 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10356 result: Box::into_raw(Box::new(o)),
10362 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10363 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10364 CResult_UpdateFulfillHTLCDecodeErrorZ {
10365 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10366 err: Box::into_raw(Box::new(e)),
10372 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10373 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
10374 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
10375 fn drop(&mut self) {
10376 if self.result_ok {
10377 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10378 let _ = unsafe { Box::from_raw(self.contents.result) };
10381 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10382 let _ = unsafe { Box::from_raw(self.contents.err) };
10387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
10388 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10389 let contents = if o.result_ok {
10390 let result = unsafe { o.contents.result };
10391 unsafe { o.contents.result = std::ptr::null_mut() };
10392 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
10394 let err = unsafe { o.contents.err };
10395 unsafe { o.contents.err = std::ptr::null_mut(); }
10396 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
10400 result_ok: o.result_ok,
10404 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
10405 fn clone(&self) -> Self {
10406 if self.result_ok {
10407 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10408 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
10411 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10412 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10418 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10419 /// but with all dynamically-allocated buffers duplicated in new buffers.
10420 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
10422 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
10423 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
10424 /// A pointer to the contents in the success state.
10425 /// Reading from this pointer when `result_ok` is not set is undefined.
10426 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10427 /// A pointer to the contents in the error state.
10428 /// Reading from this pointer when `result_ok` is set is undefined.
10429 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10432 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10433 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10435 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
10436 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10437 /// `err` or `result` depending on the state of `result_ok`.
10438 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
10439 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10440 pub result_ok: bool,
10443 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10444 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
10445 CResult_UpdateAddHTLCDecodeErrorZ {
10446 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10447 result: Box::into_raw(Box::new(o)),
10453 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10454 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
10455 CResult_UpdateAddHTLCDecodeErrorZ {
10456 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10457 err: Box::into_raw(Box::new(e)),
10463 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10464 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
10465 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
10466 fn drop(&mut self) {
10467 if self.result_ok {
10468 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10469 let _ = unsafe { Box::from_raw(self.contents.result) };
10472 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10473 let _ = unsafe { Box::from_raw(self.contents.err) };
10478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
10479 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10480 let contents = if o.result_ok {
10481 let result = unsafe { o.contents.result };
10482 unsafe { o.contents.result = std::ptr::null_mut() };
10483 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
10485 let err = unsafe { o.contents.err };
10486 unsafe { o.contents.err = std::ptr::null_mut(); }
10487 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
10491 result_ok: o.result_ok,
10495 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
10496 fn clone(&self) -> Self {
10497 if self.result_ok {
10498 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10499 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
10502 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10503 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10509 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10510 /// but with all dynamically-allocated buffers duplicated in new buffers.
10511 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
10513 /// The contents of CResult_PingDecodeErrorZ
10514 pub union CResult_PingDecodeErrorZPtr {
10515 /// A pointer to the contents in the success state.
10516 /// Reading from this pointer when `result_ok` is not set is undefined.
10517 pub result: *mut crate::lightning::ln::msgs::Ping,
10518 /// A pointer to the contents in the error state.
10519 /// Reading from this pointer when `result_ok` is set is undefined.
10520 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10523 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10524 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10526 pub struct CResult_PingDecodeErrorZ {
10527 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
10528 /// `err` or `result` depending on the state of `result_ok`.
10529 pub contents: CResult_PingDecodeErrorZPtr,
10530 /// Whether this CResult_PingDecodeErrorZ represents a success state.
10531 pub result_ok: bool,
10534 /// Creates a new CResult_PingDecodeErrorZ in the success state.
10535 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
10536 CResult_PingDecodeErrorZ {
10537 contents: CResult_PingDecodeErrorZPtr {
10538 result: Box::into_raw(Box::new(o)),
10544 /// Creates a new CResult_PingDecodeErrorZ in the error state.
10545 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
10546 CResult_PingDecodeErrorZ {
10547 contents: CResult_PingDecodeErrorZPtr {
10548 err: Box::into_raw(Box::new(e)),
10554 /// Frees any resources used by the CResult_PingDecodeErrorZ.
10555 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
10556 impl Drop for CResult_PingDecodeErrorZ {
10557 fn drop(&mut self) {
10558 if self.result_ok {
10559 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10560 let _ = unsafe { Box::from_raw(self.contents.result) };
10563 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10564 let _ = unsafe { Box::from_raw(self.contents.err) };
10569 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
10570 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
10571 let contents = if o.result_ok {
10572 let result = unsafe { o.contents.result };
10573 unsafe { o.contents.result = std::ptr::null_mut() };
10574 CResult_PingDecodeErrorZPtr { result }
10576 let err = unsafe { o.contents.err };
10577 unsafe { o.contents.err = std::ptr::null_mut(); }
10578 CResult_PingDecodeErrorZPtr { err }
10582 result_ok: o.result_ok,
10586 impl Clone for CResult_PingDecodeErrorZ {
10587 fn clone(&self) -> Self {
10588 if self.result_ok {
10589 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
10590 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
10593 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
10594 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10600 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10601 /// but with all dynamically-allocated buffers duplicated in new buffers.
10602 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
10604 /// The contents of CResult_PongDecodeErrorZ
10605 pub union CResult_PongDecodeErrorZPtr {
10606 /// A pointer to the contents in the success state.
10607 /// Reading from this pointer when `result_ok` is not set is undefined.
10608 pub result: *mut crate::lightning::ln::msgs::Pong,
10609 /// A pointer to the contents in the error state.
10610 /// Reading from this pointer when `result_ok` is set is undefined.
10611 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10614 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10615 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10617 pub struct CResult_PongDecodeErrorZ {
10618 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
10619 /// `err` or `result` depending on the state of `result_ok`.
10620 pub contents: CResult_PongDecodeErrorZPtr,
10621 /// Whether this CResult_PongDecodeErrorZ represents a success state.
10622 pub result_ok: bool,
10625 /// Creates a new CResult_PongDecodeErrorZ in the success state.
10626 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
10627 CResult_PongDecodeErrorZ {
10628 contents: CResult_PongDecodeErrorZPtr {
10629 result: Box::into_raw(Box::new(o)),
10635 /// Creates a new CResult_PongDecodeErrorZ in the error state.
10636 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
10637 CResult_PongDecodeErrorZ {
10638 contents: CResult_PongDecodeErrorZPtr {
10639 err: Box::into_raw(Box::new(e)),
10645 /// Frees any resources used by the CResult_PongDecodeErrorZ.
10646 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
10647 impl Drop for CResult_PongDecodeErrorZ {
10648 fn drop(&mut self) {
10649 if self.result_ok {
10650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10651 let _ = unsafe { Box::from_raw(self.contents.result) };
10654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10655 let _ = unsafe { Box::from_raw(self.contents.err) };
10660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
10661 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
10662 let contents = if o.result_ok {
10663 let result = unsafe { o.contents.result };
10664 unsafe { o.contents.result = std::ptr::null_mut() };
10665 CResult_PongDecodeErrorZPtr { result }
10667 let err = unsafe { o.contents.err };
10668 unsafe { o.contents.err = std::ptr::null_mut(); }
10669 CResult_PongDecodeErrorZPtr { err }
10673 result_ok: o.result_ok,
10677 impl Clone for CResult_PongDecodeErrorZ {
10678 fn clone(&self) -> Self {
10679 if self.result_ok {
10680 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
10681 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
10684 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
10685 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10691 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10692 /// but with all dynamically-allocated buffers duplicated in new buffers.
10693 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
10695 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10696 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10697 /// A pointer to the contents in the success state.
10698 /// Reading from this pointer when `result_ok` is not set is undefined.
10699 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
10700 /// A pointer to the contents in the error state.
10701 /// Reading from this pointer when `result_ok` is set is undefined.
10702 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10705 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10706 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10708 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10709 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10710 /// `err` or `result` depending on the state of `result_ok`.
10711 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
10712 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10713 pub result_ok: bool,
10716 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10717 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10718 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10719 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10720 result: Box::into_raw(Box::new(o)),
10726 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10727 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10728 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10729 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10730 err: Box::into_raw(Box::new(e)),
10736 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10737 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
10738 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10739 fn drop(&mut self) {
10740 if self.result_ok {
10741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10742 let _ = unsafe { Box::from_raw(self.contents.result) };
10745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10746 let _ = unsafe { Box::from_raw(self.contents.err) };
10751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10753 let contents = if o.result_ok {
10754 let result = unsafe { o.contents.result };
10755 unsafe { o.contents.result = std::ptr::null_mut() };
10756 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
10758 let err = unsafe { o.contents.err };
10759 unsafe { o.contents.err = std::ptr::null_mut(); }
10760 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
10764 result_ok: o.result_ok,
10768 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10769 fn clone(&self) -> Self {
10770 if self.result_ok {
10771 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10772 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10775 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10776 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10782 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10783 /// but with all dynamically-allocated buffers duplicated in new buffers.
10784 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
10786 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
10787 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
10788 /// A pointer to the contents in the success state.
10789 /// Reading from this pointer when `result_ok` is not set is undefined.
10790 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
10791 /// A pointer to the contents in the error state.
10792 /// Reading from this pointer when `result_ok` is set is undefined.
10793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10796 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10797 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10799 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
10800 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10801 /// `err` or `result` depending on the state of `result_ok`.
10802 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
10803 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10804 pub result_ok: bool,
10807 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10808 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
10809 CResult_ChannelAnnouncementDecodeErrorZ {
10810 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10811 result: Box::into_raw(Box::new(o)),
10817 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10818 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
10819 CResult_ChannelAnnouncementDecodeErrorZ {
10820 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10821 err: Box::into_raw(Box::new(e)),
10827 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10828 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
10829 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
10830 fn drop(&mut self) {
10831 if self.result_ok {
10832 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10833 let _ = unsafe { Box::from_raw(self.contents.result) };
10836 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10837 let _ = unsafe { Box::from_raw(self.contents.err) };
10842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10843 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10844 let contents = if o.result_ok {
10845 let result = unsafe { o.contents.result };
10846 unsafe { o.contents.result = std::ptr::null_mut() };
10847 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10849 let err = unsafe { o.contents.err };
10850 unsafe { o.contents.err = std::ptr::null_mut(); }
10851 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10855 result_ok: o.result_ok,
10859 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10860 fn clone(&self) -> Self {
10861 if self.result_ok {
10862 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10863 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10866 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10867 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10873 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10874 /// but with all dynamically-allocated buffers duplicated in new buffers.
10875 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
10877 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10878 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10879 /// A pointer to the contents in the success state.
10880 /// Reading from this pointer when `result_ok` is not set is undefined.
10881 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10882 /// A pointer to the contents in the error state.
10883 /// Reading from this pointer when `result_ok` is set is undefined.
10884 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10887 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10888 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10890 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10891 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10892 /// `err` or `result` depending on the state of `result_ok`.
10893 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10894 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10895 pub result_ok: bool,
10898 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10899 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10900 CResult_UnsignedChannelUpdateDecodeErrorZ {
10901 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10902 result: Box::into_raw(Box::new(o)),
10908 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10909 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10910 CResult_UnsignedChannelUpdateDecodeErrorZ {
10911 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10912 err: Box::into_raw(Box::new(e)),
10918 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10919 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10920 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10921 fn drop(&mut self) {
10922 if self.result_ok {
10923 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10924 let _ = unsafe { Box::from_raw(self.contents.result) };
10927 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10928 let _ = unsafe { Box::from_raw(self.contents.err) };
10933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10934 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10935 let contents = if o.result_ok {
10936 let result = unsafe { o.contents.result };
10937 unsafe { o.contents.result = std::ptr::null_mut() };
10938 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10940 let err = unsafe { o.contents.err };
10941 unsafe { o.contents.err = std::ptr::null_mut(); }
10942 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10946 result_ok: o.result_ok,
10950 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10951 fn clone(&self) -> Self {
10952 if self.result_ok {
10953 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10954 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10957 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10958 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10964 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10965 /// but with all dynamically-allocated buffers duplicated in new buffers.
10966 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
10968 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10969 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10970 /// A pointer to the contents in the success state.
10971 /// Reading from this pointer when `result_ok` is not set is undefined.
10972 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10973 /// A pointer to the contents in the error state.
10974 /// Reading from this pointer when `result_ok` is set is undefined.
10975 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10978 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10979 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10981 pub struct CResult_ChannelUpdateDecodeErrorZ {
10982 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10983 /// `err` or `result` depending on the state of `result_ok`.
10984 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10985 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10986 pub result_ok: bool,
10989 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10990 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10991 CResult_ChannelUpdateDecodeErrorZ {
10992 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10993 result: Box::into_raw(Box::new(o)),
10999 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11000 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
11001 CResult_ChannelUpdateDecodeErrorZ {
11002 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11003 err: Box::into_raw(Box::new(e)),
11009 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11010 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
11011 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
11012 fn drop(&mut self) {
11013 if self.result_ok {
11014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11015 let _ = unsafe { Box::from_raw(self.contents.result) };
11018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11019 let _ = unsafe { Box::from_raw(self.contents.err) };
11024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11026 let contents = if o.result_ok {
11027 let result = unsafe { o.contents.result };
11028 unsafe { o.contents.result = std::ptr::null_mut() };
11029 CResult_ChannelUpdateDecodeErrorZPtr { result }
11031 let err = unsafe { o.contents.err };
11032 unsafe { o.contents.err = std::ptr::null_mut(); }
11033 CResult_ChannelUpdateDecodeErrorZPtr { err }
11037 result_ok: o.result_ok,
11041 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11042 fn clone(&self) -> Self {
11043 if self.result_ok {
11044 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11045 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11048 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11049 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11055 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11056 /// but with all dynamically-allocated buffers duplicated in new buffers.
11057 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11059 /// The contents of CResult_ErrorMessageDecodeErrorZ
11060 pub union CResult_ErrorMessageDecodeErrorZPtr {
11061 /// A pointer to the contents in the success state.
11062 /// Reading from this pointer when `result_ok` is not set is undefined.
11063 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11064 /// A pointer to the contents in the error state.
11065 /// Reading from this pointer when `result_ok` is set is undefined.
11066 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11069 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11070 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11072 pub struct CResult_ErrorMessageDecodeErrorZ {
11073 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11074 /// `err` or `result` depending on the state of `result_ok`.
11075 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11076 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11077 pub result_ok: bool,
11080 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11081 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11082 CResult_ErrorMessageDecodeErrorZ {
11083 contents: CResult_ErrorMessageDecodeErrorZPtr {
11084 result: Box::into_raw(Box::new(o)),
11090 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11091 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11092 CResult_ErrorMessageDecodeErrorZ {
11093 contents: CResult_ErrorMessageDecodeErrorZPtr {
11094 err: Box::into_raw(Box::new(e)),
11100 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11101 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11102 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11103 fn drop(&mut self) {
11104 if self.result_ok {
11105 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11106 let _ = unsafe { Box::from_raw(self.contents.result) };
11109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11110 let _ = unsafe { Box::from_raw(self.contents.err) };
11115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11116 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11117 let contents = if o.result_ok {
11118 let result = unsafe { o.contents.result };
11119 unsafe { o.contents.result = std::ptr::null_mut() };
11120 CResult_ErrorMessageDecodeErrorZPtr { result }
11122 let err = unsafe { o.contents.err };
11123 unsafe { o.contents.err = std::ptr::null_mut(); }
11124 CResult_ErrorMessageDecodeErrorZPtr { err }
11128 result_ok: o.result_ok,
11132 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11133 fn clone(&self) -> Self {
11134 if self.result_ok {
11135 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11136 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11139 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11140 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11146 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11147 /// but with all dynamically-allocated buffers duplicated in new buffers.
11148 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11150 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11151 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11152 /// A pointer to the contents in the success state.
11153 /// Reading from this pointer when `result_ok` is not set is undefined.
11154 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11155 /// A pointer to the contents in the error state.
11156 /// Reading from this pointer when `result_ok` is set is undefined.
11157 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11160 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11161 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11163 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11164 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11165 /// `err` or `result` depending on the state of `result_ok`.
11166 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11167 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11168 pub result_ok: bool,
11171 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11172 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11173 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11174 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11175 result: Box::into_raw(Box::new(o)),
11181 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11182 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11183 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11184 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11185 err: Box::into_raw(Box::new(e)),
11191 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11192 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
11193 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11194 fn drop(&mut self) {
11195 if self.result_ok {
11196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11197 let _ = unsafe { Box::from_raw(self.contents.result) };
11200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11201 let _ = unsafe { Box::from_raw(self.contents.err) };
11206 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11207 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11208 let contents = if o.result_ok {
11209 let result = unsafe { o.contents.result };
11210 unsafe { o.contents.result = std::ptr::null_mut() };
11211 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
11213 let err = unsafe { o.contents.err };
11214 unsafe { o.contents.err = std::ptr::null_mut(); }
11215 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
11219 result_ok: o.result_ok,
11223 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11224 fn clone(&self) -> Self {
11225 if self.result_ok {
11226 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11227 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11230 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11231 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11237 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11238 /// but with all dynamically-allocated buffers duplicated in new buffers.
11239 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11241 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
11242 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
11243 /// A pointer to the contents in the success state.
11244 /// Reading from this pointer when `result_ok` is not set is undefined.
11245 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
11246 /// A pointer to the contents in the error state.
11247 /// Reading from this pointer when `result_ok` is set is undefined.
11248 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11251 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11252 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11254 pub struct CResult_NodeAnnouncementDecodeErrorZ {
11255 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11256 /// `err` or `result` depending on the state of `result_ok`.
11257 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
11258 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11259 pub result_ok: bool,
11262 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11263 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
11264 CResult_NodeAnnouncementDecodeErrorZ {
11265 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11266 result: Box::into_raw(Box::new(o)),
11272 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11273 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
11274 CResult_NodeAnnouncementDecodeErrorZ {
11275 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11276 err: Box::into_raw(Box::new(e)),
11282 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11283 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
11284 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
11285 fn drop(&mut self) {
11286 if self.result_ok {
11287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11288 let _ = unsafe { Box::from_raw(self.contents.result) };
11291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11292 let _ = unsafe { Box::from_raw(self.contents.err) };
11297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
11298 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11299 let contents = if o.result_ok {
11300 let result = unsafe { o.contents.result };
11301 unsafe { o.contents.result = std::ptr::null_mut() };
11302 CResult_NodeAnnouncementDecodeErrorZPtr { result }
11304 let err = unsafe { o.contents.err };
11305 unsafe { o.contents.err = std::ptr::null_mut(); }
11306 CResult_NodeAnnouncementDecodeErrorZPtr { err }
11310 result_ok: o.result_ok,
11314 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
11315 fn clone(&self) -> Self {
11316 if self.result_ok {
11317 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11318 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11321 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11322 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11328 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11329 /// but with all dynamically-allocated buffers duplicated in new buffers.
11330 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11332 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
11333 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
11334 /// A pointer to the contents in the success state.
11335 /// Reading from this pointer when `result_ok` is not set is undefined.
11336 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
11337 /// A pointer to the contents in the error state.
11338 /// Reading from this pointer when `result_ok` is set is undefined.
11339 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11342 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
11343 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
11344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11345 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
11346 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
11347 /// `err` or `result` depending on the state of `result_ok`.
11348 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
11349 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
11350 pub result_ok: bool,
11353 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11354 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11355 CResult_QueryShortChannelIdsDecodeErrorZ {
11356 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11357 result: Box::into_raw(Box::new(o)),
11363 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11364 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11365 CResult_QueryShortChannelIdsDecodeErrorZ {
11366 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11367 err: Box::into_raw(Box::new(e)),
11373 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11374 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
11375 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
11376 fn drop(&mut self) {
11377 if self.result_ok {
11378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11379 let _ = unsafe { Box::from_raw(self.contents.result) };
11382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11383 let _ = unsafe { Box::from_raw(self.contents.err) };
11388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
11389 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
11390 let contents = if o.result_ok {
11391 let result = unsafe { o.contents.result };
11392 unsafe { o.contents.result = std::ptr::null_mut() };
11393 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
11395 let err = unsafe { o.contents.err };
11396 unsafe { o.contents.err = std::ptr::null_mut(); }
11397 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
11401 result_ok: o.result_ok,
11405 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
11406 fn clone(&self) -> Self {
11407 if self.result_ok {
11408 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11409 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
11412 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11413 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11419 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11420 /// but with all dynamically-allocated buffers duplicated in new buffers.
11421 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
11423 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
11424 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11425 /// A pointer to the contents in the success state.
11426 /// Reading from this pointer when `result_ok` is not set is undefined.
11427 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
11428 /// A pointer to the contents in the error state.
11429 /// Reading from this pointer when `result_ok` is set is undefined.
11430 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11433 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
11434 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
11435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11436 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11437 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
11438 /// `err` or `result` depending on the state of `result_ok`.
11439 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
11440 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
11441 pub result_ok: bool,
11444 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11445 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11446 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11447 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11448 result: Box::into_raw(Box::new(o)),
11454 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11455 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11456 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11457 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11458 err: Box::into_raw(Box::new(e)),
11464 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11465 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
11466 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11467 fn drop(&mut self) {
11468 if self.result_ok {
11469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11470 let _ = unsafe { Box::from_raw(self.contents.result) };
11473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11474 let _ = unsafe { Box::from_raw(self.contents.err) };
11479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
11481 let contents = if o.result_ok {
11482 let result = unsafe { o.contents.result };
11483 unsafe { o.contents.result = std::ptr::null_mut() };
11484 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
11486 let err = unsafe { o.contents.err };
11487 unsafe { o.contents.err = std::ptr::null_mut(); }
11488 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
11492 result_ok: o.result_ok,
11496 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11497 fn clone(&self) -> Self {
11498 if self.result_ok {
11499 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11500 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
11503 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11504 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11510 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11511 /// but with all dynamically-allocated buffers duplicated in new buffers.
11512 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
11514 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
11515 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
11516 /// A pointer to the contents in the success state.
11517 /// Reading from this pointer when `result_ok` is not set is undefined.
11518 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
11519 /// A pointer to the contents in the error state.
11520 /// Reading from this pointer when `result_ok` is set is undefined.
11521 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11524 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11525 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11527 pub struct CResult_QueryChannelRangeDecodeErrorZ {
11528 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11529 /// `err` or `result` depending on the state of `result_ok`.
11530 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
11531 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11532 pub result_ok: bool,
11535 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11536 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
11537 CResult_QueryChannelRangeDecodeErrorZ {
11538 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11539 result: Box::into_raw(Box::new(o)),
11545 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11546 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
11547 CResult_QueryChannelRangeDecodeErrorZ {
11548 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11549 err: Box::into_raw(Box::new(e)),
11555 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11556 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
11557 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
11558 fn drop(&mut self) {
11559 if self.result_ok {
11560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11561 let _ = unsafe { Box::from_raw(self.contents.result) };
11564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11565 let _ = unsafe { Box::from_raw(self.contents.err) };
11570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
11571 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11572 let contents = if o.result_ok {
11573 let result = unsafe { o.contents.result };
11574 unsafe { o.contents.result = std::ptr::null_mut() };
11575 CResult_QueryChannelRangeDecodeErrorZPtr { result }
11577 let err = unsafe { o.contents.err };
11578 unsafe { o.contents.err = std::ptr::null_mut(); }
11579 CResult_QueryChannelRangeDecodeErrorZPtr { err }
11583 result_ok: o.result_ok,
11587 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
11588 fn clone(&self) -> Self {
11589 if self.result_ok {
11590 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11591 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
11594 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11595 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11601 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11602 /// but with all dynamically-allocated buffers duplicated in new buffers.
11603 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
11605 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
11606 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
11607 /// A pointer to the contents in the success state.
11608 /// Reading from this pointer when `result_ok` is not set is undefined.
11609 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
11610 /// A pointer to the contents in the error state.
11611 /// Reading from this pointer when `result_ok` is set is undefined.
11612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11615 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
11619 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
11620 /// `err` or `result` depending on the state of `result_ok`.
11621 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
11622 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
11623 pub result_ok: bool,
11626 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
11628 CResult_ReplyChannelRangeDecodeErrorZ {
11629 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11630 result: Box::into_raw(Box::new(o)),
11636 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
11638 CResult_ReplyChannelRangeDecodeErrorZ {
11639 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11640 err: Box::into_raw(Box::new(e)),
11646 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11647 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
11648 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
11649 fn drop(&mut self) {
11650 if self.result_ok {
11651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11652 let _ = unsafe { Box::from_raw(self.contents.result) };
11655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11656 let _ = unsafe { Box::from_raw(self.contents.err) };
11661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
11662 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11663 let contents = if o.result_ok {
11664 let result = unsafe { o.contents.result };
11665 unsafe { o.contents.result = std::ptr::null_mut() };
11666 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
11668 let err = unsafe { o.contents.err };
11669 unsafe { o.contents.err = std::ptr::null_mut(); }
11670 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
11674 result_ok: o.result_ok,
11678 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
11679 fn clone(&self) -> Self {
11680 if self.result_ok {
11681 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11682 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
11685 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11686 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11692 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11693 /// but with all dynamically-allocated buffers duplicated in new buffers.
11694 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
11696 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
11697 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
11698 /// A pointer to the contents in the success state.
11699 /// Reading from this pointer when `result_ok` is not set is undefined.
11700 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
11701 /// A pointer to the contents in the error state.
11702 /// Reading from this pointer when `result_ok` is set is undefined.
11703 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11706 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
11707 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
11708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11709 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
11710 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
11711 /// `err` or `result` depending on the state of `result_ok`.
11712 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
11713 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
11714 pub result_ok: bool,
11717 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11718 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
11719 CResult_GossipTimestampFilterDecodeErrorZ {
11720 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11721 result: Box::into_raw(Box::new(o)),
11727 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11728 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
11729 CResult_GossipTimestampFilterDecodeErrorZ {
11730 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11731 err: Box::into_raw(Box::new(e)),
11737 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11738 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
11739 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
11740 fn drop(&mut self) {
11741 if self.result_ok {
11742 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11743 let _ = unsafe { Box::from_raw(self.contents.result) };
11746 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11747 let _ = unsafe { Box::from_raw(self.contents.err) };
11752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
11753 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
11754 let contents = if o.result_ok {
11755 let result = unsafe { o.contents.result };
11756 unsafe { o.contents.result = std::ptr::null_mut() };
11757 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
11759 let err = unsafe { o.contents.err };
11760 unsafe { o.contents.err = std::ptr::null_mut(); }
11761 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
11765 result_ok: o.result_ok,
11769 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
11770 fn clone(&self) -> Self {
11771 if self.result_ok {
11772 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11773 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
11776 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11777 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11783 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11784 /// but with all dynamically-allocated buffers duplicated in new buffers.
11785 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
11787 /// The contents of CResult_InvoiceSignOrCreationErrorZ
11788 pub union CResult_InvoiceSignOrCreationErrorZPtr {
11789 /// A pointer to the contents in the success state.
11790 /// Reading from this pointer when `result_ok` is not set is undefined.
11791 pub result: *mut crate::lightning_invoice::Invoice,
11792 /// A pointer to the contents in the error state.
11793 /// Reading from this pointer when `result_ok` is set is undefined.
11794 pub err: *mut crate::lightning_invoice::SignOrCreationError,
11797 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11798 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11800 pub struct CResult_InvoiceSignOrCreationErrorZ {
11801 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11802 /// `err` or `result` depending on the state of `result_ok`.
11803 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
11804 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11805 pub result_ok: bool,
11808 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11809 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
11810 CResult_InvoiceSignOrCreationErrorZ {
11811 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11812 result: Box::into_raw(Box::new(o)),
11818 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11819 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
11820 CResult_InvoiceSignOrCreationErrorZ {
11821 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11822 err: Box::into_raw(Box::new(e)),
11828 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11829 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
11830 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
11831 fn drop(&mut self) {
11832 if self.result_ok {
11833 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11834 let _ = unsafe { Box::from_raw(self.contents.result) };
11837 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11838 let _ = unsafe { Box::from_raw(self.contents.err) };
11843 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11844 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11845 let contents = if o.result_ok {
11846 let result = unsafe { o.contents.result };
11847 unsafe { o.contents.result = std::ptr::null_mut() };
11848 CResult_InvoiceSignOrCreationErrorZPtr { result }
11850 let err = unsafe { o.contents.err };
11851 unsafe { o.contents.err = std::ptr::null_mut(); }
11852 CResult_InvoiceSignOrCreationErrorZPtr { err }
11856 result_ok: o.result_ok,
11860 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11861 fn clone(&self) -> Self {
11862 if self.result_ok {
11863 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11864 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11867 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11868 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11874 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11875 /// but with all dynamically-allocated buffers duplicated in new buffers.
11876 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
11878 /// An enum which can either contain a crate::lightning::chain::Filter or not
11879 pub enum COption_FilterZ {
11880 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
11881 Some(crate::lightning::chain::Filter),
11882 /// When we're in this state, this COption_FilterZ contains nothing
11885 impl COption_FilterZ {
11886 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11887 if let Self::Some(_) = self { true } else { false }
11889 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11892 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
11893 if let Self::Some(v) = self { v } else { unreachable!() }
11897 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
11898 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
11899 COption_FilterZ::Some(o)
11902 /// Constructs a new COption_FilterZ containing nothing
11903 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
11904 COption_FilterZ::None
11907 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
11908 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }