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,
8401 /// The contents of CResult_NetAddressu8Z
8402 pub union CResult_NetAddressu8ZPtr {
8403 /// A pointer to the contents in the success state.
8404 /// Reading from this pointer when `result_ok` is not set is undefined.
8405 pub result: *mut crate::lightning::ln::msgs::NetAddress,
8406 /// A pointer to the contents in the error state.
8407 /// Reading from this pointer when `result_ok` is set is undefined.
8411 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
8412 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
8413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8414 pub struct CResult_NetAddressu8Z {
8415 /// The contents of this CResult_NetAddressu8Z, accessible via either
8416 /// `err` or `result` depending on the state of `result_ok`.
8417 pub contents: CResult_NetAddressu8ZPtr,
8418 /// Whether this CResult_NetAddressu8Z represents a success state.
8419 pub result_ok: bool,
8422 /// Creates a new CResult_NetAddressu8Z in the success state.
8423 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
8424 CResult_NetAddressu8Z {
8425 contents: CResult_NetAddressu8ZPtr {
8426 result: Box::into_raw(Box::new(o)),
8432 /// Creates a new CResult_NetAddressu8Z in the error state.
8433 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
8434 CResult_NetAddressu8Z {
8435 contents: CResult_NetAddressu8ZPtr {
8436 err: Box::into_raw(Box::new(e)),
8442 /// Frees any resources used by the CResult_NetAddressu8Z.
8443 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
8444 impl Drop for CResult_NetAddressu8Z {
8445 fn drop(&mut self) {
8447 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8448 let _ = unsafe { Box::from_raw(self.contents.result) };
8451 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8452 let _ = unsafe { Box::from_raw(self.contents.err) };
8457 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
8458 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
8459 let contents = if o.result_ok {
8460 let result = unsafe { o.contents.result };
8461 unsafe { o.contents.result = std::ptr::null_mut() };
8462 CResult_NetAddressu8ZPtr { result }
8464 let err = unsafe { o.contents.err };
8465 unsafe { o.contents.err = std::ptr::null_mut(); }
8466 CResult_NetAddressu8ZPtr { err }
8470 result_ok: o.result_ok,
8474 impl Clone for CResult_NetAddressu8Z {
8475 fn clone(&self) -> Self {
8477 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
8478 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8481 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
8482 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
8488 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8489 /// but with all dynamically-allocated buffers duplicated in new buffers.
8490 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { Clone::clone(&orig) }
8492 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
8493 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8494 /// A pointer to the contents in the success state.
8495 /// Reading from this pointer when `result_ok` is not set is undefined.
8496 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
8497 /// A pointer to the contents in the error state.
8498 /// Reading from this pointer when `result_ok` is set is undefined.
8499 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8502 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
8503 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
8504 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8505 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
8506 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
8507 /// `err` or `result` depending on the state of `result_ok`.
8508 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
8509 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
8510 pub result_ok: bool,
8513 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8514 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8515 CResult_CResult_NetAddressu8ZDecodeErrorZ {
8516 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8517 result: Box::into_raw(Box::new(o)),
8523 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8524 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8525 CResult_CResult_NetAddressu8ZDecodeErrorZ {
8526 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8527 err: Box::into_raw(Box::new(e)),
8533 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8534 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
8535 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8536 fn drop(&mut self) {
8538 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8539 let _ = unsafe { Box::from_raw(self.contents.result) };
8542 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8543 let _ = unsafe { Box::from_raw(self.contents.err) };
8548 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8549 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
8550 let contents = if o.result_ok {
8551 let result = unsafe { o.contents.result };
8552 unsafe { o.contents.result = std::ptr::null_mut() };
8553 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
8555 let err = unsafe { o.contents.err };
8556 unsafe { o.contents.err = std::ptr::null_mut(); }
8557 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
8561 result_ok: o.result_ok,
8565 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8566 fn clone(&self) -> Self {
8568 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8569 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
8572 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8573 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8579 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8580 /// but with all dynamically-allocated buffers duplicated in new buffers.
8581 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { Clone::clone(&orig) }
8583 /// The contents of CResult_NetAddressDecodeErrorZ
8584 pub union CResult_NetAddressDecodeErrorZPtr {
8585 /// A pointer to the contents in the success state.
8586 /// Reading from this pointer when `result_ok` is not set is undefined.
8587 pub result: *mut crate::lightning::ln::msgs::NetAddress,
8588 /// A pointer to the contents in the error state.
8589 /// Reading from this pointer when `result_ok` is set is undefined.
8590 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8593 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8594 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8595 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8596 pub struct CResult_NetAddressDecodeErrorZ {
8597 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8598 /// `err` or `result` depending on the state of `result_ok`.
8599 pub contents: CResult_NetAddressDecodeErrorZPtr,
8600 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8601 pub result_ok: bool,
8604 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
8605 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
8606 CResult_NetAddressDecodeErrorZ {
8607 contents: CResult_NetAddressDecodeErrorZPtr {
8608 result: Box::into_raw(Box::new(o)),
8614 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
8615 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
8616 CResult_NetAddressDecodeErrorZ {
8617 contents: CResult_NetAddressDecodeErrorZPtr {
8618 err: Box::into_raw(Box::new(e)),
8624 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
8625 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
8626 impl Drop for CResult_NetAddressDecodeErrorZ {
8627 fn drop(&mut self) {
8629 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8630 let _ = unsafe { Box::from_raw(self.contents.result) };
8633 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8634 let _ = unsafe { Box::from_raw(self.contents.err) };
8639 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
8640 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
8641 let contents = if o.result_ok {
8642 let result = unsafe { o.contents.result };
8643 unsafe { o.contents.result = std::ptr::null_mut() };
8644 CResult_NetAddressDecodeErrorZPtr { result }
8646 let err = unsafe { o.contents.err };
8647 unsafe { o.contents.err = std::ptr::null_mut(); }
8648 CResult_NetAddressDecodeErrorZPtr { err }
8652 result_ok: o.result_ok,
8656 impl Clone for CResult_NetAddressDecodeErrorZ {
8657 fn clone(&self) -> Self {
8659 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
8660 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8663 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
8664 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8670 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
8671 /// but with all dynamically-allocated buffers duplicated in new buffers.
8672 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
8674 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8675 /// This corresponds to std::vector in C++
8676 pub struct CVec_UpdateAddHTLCZ {
8677 /// The elements in the array.
8678 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8679 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
8680 /// The number of elements pointed to by `data`.
8683 impl CVec_UpdateAddHTLCZ {
8684 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
8685 if self.datalen == 0 { return Vec::new(); }
8686 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8687 self.data = std::ptr::null_mut();
8691 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
8692 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8695 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
8696 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
8697 let datalen = v.len();
8698 let data = Box::into_raw(v.into_boxed_slice());
8699 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8703 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8704 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
8705 impl Drop for CVec_UpdateAddHTLCZ {
8706 fn drop(&mut self) {
8707 if self.datalen == 0 { return; }
8708 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8711 impl Clone for CVec_UpdateAddHTLCZ {
8712 fn clone(&self) -> Self {
8713 let mut res = Vec::new();
8714 if self.datalen == 0 { return Self::from(res); }
8715 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8720 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8721 /// This corresponds to std::vector in C++
8722 pub struct CVec_UpdateFulfillHTLCZ {
8723 /// The elements in the array.
8724 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8725 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
8726 /// The number of elements pointed to by `data`.
8729 impl CVec_UpdateFulfillHTLCZ {
8730 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8731 if self.datalen == 0 { return Vec::new(); }
8732 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8733 self.data = std::ptr::null_mut();
8737 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8738 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8741 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8742 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8743 let datalen = v.len();
8744 let data = Box::into_raw(v.into_boxed_slice());
8745 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8749 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8750 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8751 impl Drop for CVec_UpdateFulfillHTLCZ {
8752 fn drop(&mut self) {
8753 if self.datalen == 0 { return; }
8754 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8757 impl Clone for CVec_UpdateFulfillHTLCZ {
8758 fn clone(&self) -> Self {
8759 let mut res = Vec::new();
8760 if self.datalen == 0 { return Self::from(res); }
8761 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8766 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8767 /// This corresponds to std::vector in C++
8768 pub struct CVec_UpdateFailHTLCZ {
8769 /// The elements in the array.
8770 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8771 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8772 /// The number of elements pointed to by `data`.
8775 impl CVec_UpdateFailHTLCZ {
8776 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8777 if self.datalen == 0 { return Vec::new(); }
8778 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8779 self.data = std::ptr::null_mut();
8783 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8784 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8787 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8788 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8789 let datalen = v.len();
8790 let data = Box::into_raw(v.into_boxed_slice());
8791 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8795 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8796 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8797 impl Drop for CVec_UpdateFailHTLCZ {
8798 fn drop(&mut self) {
8799 if self.datalen == 0 { return; }
8800 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8803 impl Clone for CVec_UpdateFailHTLCZ {
8804 fn clone(&self) -> Self {
8805 let mut res = Vec::new();
8806 if self.datalen == 0 { return Self::from(res); }
8807 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8812 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8813 /// This corresponds to std::vector in C++
8814 pub struct CVec_UpdateFailMalformedHTLCZ {
8815 /// The elements in the array.
8816 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8817 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8818 /// The number of elements pointed to by `data`.
8821 impl CVec_UpdateFailMalformedHTLCZ {
8822 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8823 if self.datalen == 0 { return Vec::new(); }
8824 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8825 self.data = std::ptr::null_mut();
8829 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8830 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8833 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8834 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8835 let datalen = v.len();
8836 let data = Box::into_raw(v.into_boxed_slice());
8837 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8841 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8842 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8843 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8844 fn drop(&mut self) {
8845 if self.datalen == 0 { return; }
8846 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8849 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8850 fn clone(&self) -> Self {
8851 let mut res = Vec::new();
8852 if self.datalen == 0 { return Self::from(res); }
8853 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8858 /// The contents of CResult_AcceptChannelDecodeErrorZ
8859 pub union CResult_AcceptChannelDecodeErrorZPtr {
8860 /// A pointer to the contents in the success state.
8861 /// Reading from this pointer when `result_ok` is not set is undefined.
8862 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8863 /// A pointer to the contents in the error state.
8864 /// Reading from this pointer when `result_ok` is set is undefined.
8865 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8868 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8869 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8871 pub struct CResult_AcceptChannelDecodeErrorZ {
8872 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8873 /// `err` or `result` depending on the state of `result_ok`.
8874 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8875 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8876 pub result_ok: bool,
8879 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8880 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8881 CResult_AcceptChannelDecodeErrorZ {
8882 contents: CResult_AcceptChannelDecodeErrorZPtr {
8883 result: Box::into_raw(Box::new(o)),
8889 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8890 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8891 CResult_AcceptChannelDecodeErrorZ {
8892 contents: CResult_AcceptChannelDecodeErrorZPtr {
8893 err: Box::into_raw(Box::new(e)),
8899 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8900 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8901 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8902 fn drop(&mut self) {
8904 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8905 let _ = unsafe { Box::from_raw(self.contents.result) };
8908 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8909 let _ = unsafe { Box::from_raw(self.contents.err) };
8914 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8915 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8916 let contents = if o.result_ok {
8917 let result = unsafe { o.contents.result };
8918 unsafe { o.contents.result = std::ptr::null_mut() };
8919 CResult_AcceptChannelDecodeErrorZPtr { result }
8921 let err = unsafe { o.contents.err };
8922 unsafe { o.contents.err = std::ptr::null_mut(); }
8923 CResult_AcceptChannelDecodeErrorZPtr { err }
8927 result_ok: o.result_ok,
8931 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8932 fn clone(&self) -> Self {
8934 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8935 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8938 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8939 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8945 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8946 /// but with all dynamically-allocated buffers duplicated in new buffers.
8947 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
8949 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8950 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8951 /// A pointer to the contents in the success state.
8952 /// Reading from this pointer when `result_ok` is not set is undefined.
8953 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8954 /// A pointer to the contents in the error state.
8955 /// Reading from this pointer when `result_ok` is set is undefined.
8956 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8959 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8960 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8961 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8962 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8963 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8964 /// `err` or `result` depending on the state of `result_ok`.
8965 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8966 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8967 pub result_ok: bool,
8970 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8971 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8972 CResult_AnnouncementSignaturesDecodeErrorZ {
8973 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8974 result: Box::into_raw(Box::new(o)),
8980 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8981 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8982 CResult_AnnouncementSignaturesDecodeErrorZ {
8983 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8984 err: Box::into_raw(Box::new(e)),
8990 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8991 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
8992 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
8993 fn drop(&mut self) {
8995 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8996 let _ = unsafe { Box::from_raw(self.contents.result) };
8999 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9000 let _ = unsafe { Box::from_raw(self.contents.err) };
9005 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9006 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
9007 let contents = if o.result_ok {
9008 let result = unsafe { o.contents.result };
9009 unsafe { o.contents.result = std::ptr::null_mut() };
9010 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
9012 let err = unsafe { o.contents.err };
9013 unsafe { o.contents.err = std::ptr::null_mut(); }
9014 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9018 result_ok: o.result_ok,
9022 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9023 fn clone(&self) -> Self {
9025 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9026 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9029 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9030 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9036 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9037 /// but with all dynamically-allocated buffers duplicated in new buffers.
9038 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9040 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9041 pub union CResult_ChannelReestablishDecodeErrorZPtr {
9042 /// A pointer to the contents in the success state.
9043 /// Reading from this pointer when `result_ok` is not set is undefined.
9044 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
9045 /// A pointer to the contents in the error state.
9046 /// Reading from this pointer when `result_ok` is set is undefined.
9047 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9050 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9051 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9053 pub struct CResult_ChannelReestablishDecodeErrorZ {
9054 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9055 /// `err` or `result` depending on the state of `result_ok`.
9056 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9057 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9058 pub result_ok: bool,
9061 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9062 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9063 CResult_ChannelReestablishDecodeErrorZ {
9064 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9065 result: Box::into_raw(Box::new(o)),
9071 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9072 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9073 CResult_ChannelReestablishDecodeErrorZ {
9074 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9075 err: Box::into_raw(Box::new(e)),
9081 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
9082 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9083 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
9084 fn drop(&mut self) {
9086 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9087 let _ = unsafe { Box::from_raw(self.contents.result) };
9090 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9091 let _ = unsafe { Box::from_raw(self.contents.err) };
9096 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9097 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
9098 let contents = if o.result_ok {
9099 let result = unsafe { o.contents.result };
9100 unsafe { o.contents.result = std::ptr::null_mut() };
9101 CResult_ChannelReestablishDecodeErrorZPtr { result }
9103 let err = unsafe { o.contents.err };
9104 unsafe { o.contents.err = std::ptr::null_mut(); }
9105 CResult_ChannelReestablishDecodeErrorZPtr { err }
9109 result_ok: o.result_ok,
9113 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9114 fn clone(&self) -> Self {
9116 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9117 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9120 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9121 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9127 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9128 /// but with all dynamically-allocated buffers duplicated in new buffers.
9129 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9131 /// The contents of CResult_ClosingSignedDecodeErrorZ
9132 pub union CResult_ClosingSignedDecodeErrorZPtr {
9133 /// A pointer to the contents in the success state.
9134 /// Reading from this pointer when `result_ok` is not set is undefined.
9135 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
9136 /// A pointer to the contents in the error state.
9137 /// Reading from this pointer when `result_ok` is set is undefined.
9138 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9141 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9142 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9144 pub struct CResult_ClosingSignedDecodeErrorZ {
9145 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9146 /// `err` or `result` depending on the state of `result_ok`.
9147 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9148 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9149 pub result_ok: bool,
9152 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9153 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9154 CResult_ClosingSignedDecodeErrorZ {
9155 contents: CResult_ClosingSignedDecodeErrorZPtr {
9156 result: Box::into_raw(Box::new(o)),
9162 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9163 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
9164 CResult_ClosingSignedDecodeErrorZ {
9165 contents: CResult_ClosingSignedDecodeErrorZPtr {
9166 err: Box::into_raw(Box::new(e)),
9172 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
9173 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
9174 impl Drop for CResult_ClosingSignedDecodeErrorZ {
9175 fn drop(&mut self) {
9177 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9178 let _ = unsafe { Box::from_raw(self.contents.result) };
9181 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9182 let _ = unsafe { Box::from_raw(self.contents.err) };
9187 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
9188 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9189 let contents = if o.result_ok {
9190 let result = unsafe { o.contents.result };
9191 unsafe { o.contents.result = std::ptr::null_mut() };
9192 CResult_ClosingSignedDecodeErrorZPtr { result }
9194 let err = unsafe { o.contents.err };
9195 unsafe { o.contents.err = std::ptr::null_mut(); }
9196 CResult_ClosingSignedDecodeErrorZPtr { err }
9200 result_ok: o.result_ok,
9204 impl Clone for CResult_ClosingSignedDecodeErrorZ {
9205 fn clone(&self) -> Self {
9207 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
9208 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
9211 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
9212 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9218 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
9219 /// but with all dynamically-allocated buffers duplicated in new buffers.
9220 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
9222 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9223 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9224 /// A pointer to the contents in the success state.
9225 /// Reading from this pointer when `result_ok` is not set is undefined.
9226 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
9227 /// A pointer to the contents in the error state.
9228 /// Reading from this pointer when `result_ok` is set is undefined.
9229 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9232 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9233 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9235 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
9236 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9237 /// `err` or `result` depending on the state of `result_ok`.
9238 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
9239 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9240 pub result_ok: bool,
9243 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
9244 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9245 CResult_ClosingSignedFeeRangeDecodeErrorZ {
9246 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9247 result: Box::into_raw(Box::new(o)),
9253 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
9254 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9255 CResult_ClosingSignedFeeRangeDecodeErrorZ {
9256 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9257 err: Box::into_raw(Box::new(e)),
9263 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
9264 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
9265 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9266 fn drop(&mut self) {
9268 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9269 let _ = unsafe { Box::from_raw(self.contents.result) };
9272 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9273 let _ = unsafe { Box::from_raw(self.contents.err) };
9278 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9279 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
9280 let contents = if o.result_ok {
9281 let result = unsafe { o.contents.result };
9282 unsafe { o.contents.result = std::ptr::null_mut() };
9283 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
9285 let err = unsafe { o.contents.err };
9286 unsafe { o.contents.err = std::ptr::null_mut(); }
9287 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
9291 result_ok: o.result_ok,
9295 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9296 fn clone(&self) -> Self {
9298 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9299 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
9302 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9303 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9309 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
9310 /// but with all dynamically-allocated buffers duplicated in new buffers.
9311 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
9313 /// The contents of CResult_CommitmentSignedDecodeErrorZ
9314 pub union CResult_CommitmentSignedDecodeErrorZPtr {
9315 /// A pointer to the contents in the success state.
9316 /// Reading from this pointer when `result_ok` is not set is undefined.
9317 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
9318 /// A pointer to the contents in the error state.
9319 /// Reading from this pointer when `result_ok` is set is undefined.
9320 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9323 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9324 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9326 pub struct CResult_CommitmentSignedDecodeErrorZ {
9327 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9328 /// `err` or `result` depending on the state of `result_ok`.
9329 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
9330 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9331 pub result_ok: bool,
9334 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
9335 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
9336 CResult_CommitmentSignedDecodeErrorZ {
9337 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9338 result: Box::into_raw(Box::new(o)),
9344 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
9345 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
9346 CResult_CommitmentSignedDecodeErrorZ {
9347 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9348 err: Box::into_raw(Box::new(e)),
9354 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
9355 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
9356 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
9357 fn drop(&mut self) {
9359 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9360 let _ = unsafe { Box::from_raw(self.contents.result) };
9363 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9364 let _ = unsafe { Box::from_raw(self.contents.err) };
9369 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
9370 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9371 let contents = if o.result_ok {
9372 let result = unsafe { o.contents.result };
9373 unsafe { o.contents.result = std::ptr::null_mut() };
9374 CResult_CommitmentSignedDecodeErrorZPtr { result }
9376 let err = unsafe { o.contents.err };
9377 unsafe { o.contents.err = std::ptr::null_mut(); }
9378 CResult_CommitmentSignedDecodeErrorZPtr { err }
9382 result_ok: o.result_ok,
9386 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
9387 fn clone(&self) -> Self {
9389 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9390 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
9393 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9394 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9400 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
9401 /// but with all dynamically-allocated buffers duplicated in new buffers.
9402 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
9404 /// The contents of CResult_FundingCreatedDecodeErrorZ
9405 pub union CResult_FundingCreatedDecodeErrorZPtr {
9406 /// A pointer to the contents in the success state.
9407 /// Reading from this pointer when `result_ok` is not set is undefined.
9408 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
9409 /// A pointer to the contents in the error state.
9410 /// Reading from this pointer when `result_ok` is set is undefined.
9411 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9414 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9415 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9417 pub struct CResult_FundingCreatedDecodeErrorZ {
9418 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9419 /// `err` or `result` depending on the state of `result_ok`.
9420 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
9421 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9422 pub result_ok: bool,
9425 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
9426 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
9427 CResult_FundingCreatedDecodeErrorZ {
9428 contents: CResult_FundingCreatedDecodeErrorZPtr {
9429 result: Box::into_raw(Box::new(o)),
9435 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
9436 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
9437 CResult_FundingCreatedDecodeErrorZ {
9438 contents: CResult_FundingCreatedDecodeErrorZPtr {
9439 err: Box::into_raw(Box::new(e)),
9445 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
9446 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
9447 impl Drop for CResult_FundingCreatedDecodeErrorZ {
9448 fn drop(&mut self) {
9450 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9451 let _ = unsafe { Box::from_raw(self.contents.result) };
9454 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9455 let _ = unsafe { Box::from_raw(self.contents.err) };
9460 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
9461 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
9462 let contents = if o.result_ok {
9463 let result = unsafe { o.contents.result };
9464 unsafe { o.contents.result = std::ptr::null_mut() };
9465 CResult_FundingCreatedDecodeErrorZPtr { result }
9467 let err = unsafe { o.contents.err };
9468 unsafe { o.contents.err = std::ptr::null_mut(); }
9469 CResult_FundingCreatedDecodeErrorZPtr { err }
9473 result_ok: o.result_ok,
9477 impl Clone for CResult_FundingCreatedDecodeErrorZ {
9478 fn clone(&self) -> Self {
9480 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
9481 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
9484 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
9485 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9491 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
9492 /// but with all dynamically-allocated buffers duplicated in new buffers.
9493 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
9495 /// The contents of CResult_FundingSignedDecodeErrorZ
9496 pub union CResult_FundingSignedDecodeErrorZPtr {
9497 /// A pointer to the contents in the success state.
9498 /// Reading from this pointer when `result_ok` is not set is undefined.
9499 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
9500 /// A pointer to the contents in the error state.
9501 /// Reading from this pointer when `result_ok` is set is undefined.
9502 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9505 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9506 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9507 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9508 pub struct CResult_FundingSignedDecodeErrorZ {
9509 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9510 /// `err` or `result` depending on the state of `result_ok`.
9511 pub contents: CResult_FundingSignedDecodeErrorZPtr,
9512 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9513 pub result_ok: bool,
9516 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
9517 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
9518 CResult_FundingSignedDecodeErrorZ {
9519 contents: CResult_FundingSignedDecodeErrorZPtr {
9520 result: Box::into_raw(Box::new(o)),
9526 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
9527 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
9528 CResult_FundingSignedDecodeErrorZ {
9529 contents: CResult_FundingSignedDecodeErrorZPtr {
9530 err: Box::into_raw(Box::new(e)),
9536 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
9537 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
9538 impl Drop for CResult_FundingSignedDecodeErrorZ {
9539 fn drop(&mut self) {
9541 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9542 let _ = unsafe { Box::from_raw(self.contents.result) };
9545 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9546 let _ = unsafe { Box::from_raw(self.contents.err) };
9551 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
9552 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9553 let contents = if o.result_ok {
9554 let result = unsafe { o.contents.result };
9555 unsafe { o.contents.result = std::ptr::null_mut() };
9556 CResult_FundingSignedDecodeErrorZPtr { result }
9558 let err = unsafe { o.contents.err };
9559 unsafe { o.contents.err = std::ptr::null_mut(); }
9560 CResult_FundingSignedDecodeErrorZPtr { err }
9564 result_ok: o.result_ok,
9568 impl Clone for CResult_FundingSignedDecodeErrorZ {
9569 fn clone(&self) -> Self {
9571 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
9572 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
9575 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
9576 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9582 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
9583 /// but with all dynamically-allocated buffers duplicated in new buffers.
9584 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
9586 /// The contents of CResult_FundingLockedDecodeErrorZ
9587 pub union CResult_FundingLockedDecodeErrorZPtr {
9588 /// A pointer to the contents in the success state.
9589 /// Reading from this pointer when `result_ok` is not set is undefined.
9590 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
9591 /// A pointer to the contents in the error state.
9592 /// Reading from this pointer when `result_ok` is set is undefined.
9593 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9596 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9597 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9599 pub struct CResult_FundingLockedDecodeErrorZ {
9600 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9601 /// `err` or `result` depending on the state of `result_ok`.
9602 pub contents: CResult_FundingLockedDecodeErrorZPtr,
9603 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9604 pub result_ok: bool,
9607 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
9608 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
9609 CResult_FundingLockedDecodeErrorZ {
9610 contents: CResult_FundingLockedDecodeErrorZPtr {
9611 result: Box::into_raw(Box::new(o)),
9617 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
9618 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
9619 CResult_FundingLockedDecodeErrorZ {
9620 contents: CResult_FundingLockedDecodeErrorZPtr {
9621 err: Box::into_raw(Box::new(e)),
9627 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
9628 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
9629 impl Drop for CResult_FundingLockedDecodeErrorZ {
9630 fn drop(&mut self) {
9632 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9633 let _ = unsafe { Box::from_raw(self.contents.result) };
9636 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9637 let _ = unsafe { Box::from_raw(self.contents.err) };
9642 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
9643 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
9644 let contents = if o.result_ok {
9645 let result = unsafe { o.contents.result };
9646 unsafe { o.contents.result = std::ptr::null_mut() };
9647 CResult_FundingLockedDecodeErrorZPtr { result }
9649 let err = unsafe { o.contents.err };
9650 unsafe { o.contents.err = std::ptr::null_mut(); }
9651 CResult_FundingLockedDecodeErrorZPtr { err }
9655 result_ok: o.result_ok,
9659 impl Clone for CResult_FundingLockedDecodeErrorZ {
9660 fn clone(&self) -> Self {
9662 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
9663 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
9666 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
9667 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9673 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
9674 /// but with all dynamically-allocated buffers duplicated in new buffers.
9675 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
9677 /// The contents of CResult_InitDecodeErrorZ
9678 pub union CResult_InitDecodeErrorZPtr {
9679 /// A pointer to the contents in the success state.
9680 /// Reading from this pointer when `result_ok` is not set is undefined.
9681 pub result: *mut crate::lightning::ln::msgs::Init,
9682 /// A pointer to the contents in the error state.
9683 /// Reading from this pointer when `result_ok` is set is undefined.
9684 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9687 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9688 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9689 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9690 pub struct CResult_InitDecodeErrorZ {
9691 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
9692 /// `err` or `result` depending on the state of `result_ok`.
9693 pub contents: CResult_InitDecodeErrorZPtr,
9694 /// Whether this CResult_InitDecodeErrorZ represents a success state.
9695 pub result_ok: bool,
9698 /// Creates a new CResult_InitDecodeErrorZ in the success state.
9699 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
9700 CResult_InitDecodeErrorZ {
9701 contents: CResult_InitDecodeErrorZPtr {
9702 result: Box::into_raw(Box::new(o)),
9708 /// Creates a new CResult_InitDecodeErrorZ in the error state.
9709 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
9710 CResult_InitDecodeErrorZ {
9711 contents: CResult_InitDecodeErrorZPtr {
9712 err: Box::into_raw(Box::new(e)),
9718 /// Frees any resources used by the CResult_InitDecodeErrorZ.
9719 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
9720 impl Drop for CResult_InitDecodeErrorZ {
9721 fn drop(&mut self) {
9723 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9724 let _ = unsafe { Box::from_raw(self.contents.result) };
9727 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9728 let _ = unsafe { Box::from_raw(self.contents.err) };
9733 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
9734 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
9735 let contents = if o.result_ok {
9736 let result = unsafe { o.contents.result };
9737 unsafe { o.contents.result = std::ptr::null_mut() };
9738 CResult_InitDecodeErrorZPtr { result }
9740 let err = unsafe { o.contents.err };
9741 unsafe { o.contents.err = std::ptr::null_mut(); }
9742 CResult_InitDecodeErrorZPtr { err }
9746 result_ok: o.result_ok,
9750 impl Clone for CResult_InitDecodeErrorZ {
9751 fn clone(&self) -> Self {
9753 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
9754 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
9757 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
9758 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9764 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
9765 /// but with all dynamically-allocated buffers duplicated in new buffers.
9766 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
9768 /// The contents of CResult_OpenChannelDecodeErrorZ
9769 pub union CResult_OpenChannelDecodeErrorZPtr {
9770 /// A pointer to the contents in the success state.
9771 /// Reading from this pointer when `result_ok` is not set is undefined.
9772 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
9773 /// A pointer to the contents in the error state.
9774 /// Reading from this pointer when `result_ok` is set is undefined.
9775 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9778 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9779 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9780 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9781 pub struct CResult_OpenChannelDecodeErrorZ {
9782 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9783 /// `err` or `result` depending on the state of `result_ok`.
9784 pub contents: CResult_OpenChannelDecodeErrorZPtr,
9785 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9786 pub result_ok: bool,
9789 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9790 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
9791 CResult_OpenChannelDecodeErrorZ {
9792 contents: CResult_OpenChannelDecodeErrorZPtr {
9793 result: Box::into_raw(Box::new(o)),
9799 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9800 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
9801 CResult_OpenChannelDecodeErrorZ {
9802 contents: CResult_OpenChannelDecodeErrorZPtr {
9803 err: Box::into_raw(Box::new(e)),
9809 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9810 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
9811 impl Drop for CResult_OpenChannelDecodeErrorZ {
9812 fn drop(&mut self) {
9814 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9815 let _ = unsafe { Box::from_raw(self.contents.result) };
9818 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9819 let _ = unsafe { Box::from_raw(self.contents.err) };
9824 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9825 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9826 let contents = if o.result_ok {
9827 let result = unsafe { o.contents.result };
9828 unsafe { o.contents.result = std::ptr::null_mut() };
9829 CResult_OpenChannelDecodeErrorZPtr { result }
9831 let err = unsafe { o.contents.err };
9832 unsafe { o.contents.err = std::ptr::null_mut(); }
9833 CResult_OpenChannelDecodeErrorZPtr { err }
9837 result_ok: o.result_ok,
9841 impl Clone for CResult_OpenChannelDecodeErrorZ {
9842 fn clone(&self) -> Self {
9844 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9845 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9848 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9849 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9855 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9856 /// but with all dynamically-allocated buffers duplicated in new buffers.
9857 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
9859 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9860 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9861 /// A pointer to the contents in the success state.
9862 /// Reading from this pointer when `result_ok` is not set is undefined.
9863 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9864 /// A pointer to the contents in the error state.
9865 /// Reading from this pointer when `result_ok` is set is undefined.
9866 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9869 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9870 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9872 pub struct CResult_RevokeAndACKDecodeErrorZ {
9873 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9874 /// `err` or `result` depending on the state of `result_ok`.
9875 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9876 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9877 pub result_ok: bool,
9880 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9881 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9882 CResult_RevokeAndACKDecodeErrorZ {
9883 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9884 result: Box::into_raw(Box::new(o)),
9890 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9891 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9892 CResult_RevokeAndACKDecodeErrorZ {
9893 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9894 err: Box::into_raw(Box::new(e)),
9900 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9901 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9902 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9903 fn drop(&mut self) {
9905 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9906 let _ = unsafe { Box::from_raw(self.contents.result) };
9909 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9910 let _ = unsafe { Box::from_raw(self.contents.err) };
9915 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9916 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9917 let contents = if o.result_ok {
9918 let result = unsafe { o.contents.result };
9919 unsafe { o.contents.result = std::ptr::null_mut() };
9920 CResult_RevokeAndACKDecodeErrorZPtr { result }
9922 let err = unsafe { o.contents.err };
9923 unsafe { o.contents.err = std::ptr::null_mut(); }
9924 CResult_RevokeAndACKDecodeErrorZPtr { err }
9928 result_ok: o.result_ok,
9932 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9933 fn clone(&self) -> Self {
9935 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9936 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9939 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9940 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9946 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9947 /// but with all dynamically-allocated buffers duplicated in new buffers.
9948 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
9950 /// The contents of CResult_ShutdownDecodeErrorZ
9951 pub union CResult_ShutdownDecodeErrorZPtr {
9952 /// A pointer to the contents in the success state.
9953 /// Reading from this pointer when `result_ok` is not set is undefined.
9954 pub result: *mut crate::lightning::ln::msgs::Shutdown,
9955 /// A pointer to the contents in the error state.
9956 /// Reading from this pointer when `result_ok` is set is undefined.
9957 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9960 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9961 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9962 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9963 pub struct CResult_ShutdownDecodeErrorZ {
9964 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9965 /// `err` or `result` depending on the state of `result_ok`.
9966 pub contents: CResult_ShutdownDecodeErrorZPtr,
9967 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9968 pub result_ok: bool,
9971 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9972 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9973 CResult_ShutdownDecodeErrorZ {
9974 contents: CResult_ShutdownDecodeErrorZPtr {
9975 result: Box::into_raw(Box::new(o)),
9981 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9982 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
9983 CResult_ShutdownDecodeErrorZ {
9984 contents: CResult_ShutdownDecodeErrorZPtr {
9985 err: Box::into_raw(Box::new(e)),
9991 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9992 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
9993 impl Drop for CResult_ShutdownDecodeErrorZ {
9994 fn drop(&mut self) {
9996 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9997 let _ = unsafe { Box::from_raw(self.contents.result) };
10000 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10001 let _ = unsafe { Box::from_raw(self.contents.err) };
10006 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10007 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
10008 let contents = if o.result_ok {
10009 let result = unsafe { o.contents.result };
10010 unsafe { o.contents.result = std::ptr::null_mut() };
10011 CResult_ShutdownDecodeErrorZPtr { result }
10013 let err = unsafe { o.contents.err };
10014 unsafe { o.contents.err = std::ptr::null_mut(); }
10015 CResult_ShutdownDecodeErrorZPtr { err }
10019 result_ok: o.result_ok,
10023 impl Clone for CResult_ShutdownDecodeErrorZ {
10024 fn clone(&self) -> Self {
10025 if self.result_ok {
10026 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10027 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10030 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
10031 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10037 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10038 /// but with all dynamically-allocated buffers duplicated in new buffers.
10039 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10041 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10042 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
10043 /// A pointer to the contents in the success state.
10044 /// Reading from this pointer when `result_ok` is not set is undefined.
10045 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10046 /// A pointer to the contents in the error state.
10047 /// Reading from this pointer when `result_ok` is set is undefined.
10048 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10051 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10052 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10054 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
10055 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10056 /// `err` or `result` depending on the state of `result_ok`.
10057 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10058 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10059 pub result_ok: bool,
10062 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10063 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10064 CResult_UpdateFailHTLCDecodeErrorZ {
10065 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10066 result: Box::into_raw(Box::new(o)),
10072 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10073 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10074 CResult_UpdateFailHTLCDecodeErrorZ {
10075 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10076 err: Box::into_raw(Box::new(e)),
10082 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10083 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10084 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
10085 fn drop(&mut self) {
10086 if self.result_ok {
10087 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10088 let _ = unsafe { Box::from_raw(self.contents.result) };
10091 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10092 let _ = unsafe { Box::from_raw(self.contents.err) };
10097 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10098 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10099 let contents = if o.result_ok {
10100 let result = unsafe { o.contents.result };
10101 unsafe { o.contents.result = std::ptr::null_mut() };
10102 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
10104 let err = unsafe { o.contents.err };
10105 unsafe { o.contents.err = std::ptr::null_mut(); }
10106 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10110 result_ok: o.result_ok,
10114 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10115 fn clone(&self) -> Self {
10116 if self.result_ok {
10117 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10118 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10121 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10122 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10128 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10129 /// but with all dynamically-allocated buffers duplicated in new buffers.
10130 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10132 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10133 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10134 /// A pointer to the contents in the success state.
10135 /// Reading from this pointer when `result_ok` is not set is undefined.
10136 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10137 /// A pointer to the contents in the error state.
10138 /// Reading from this pointer when `result_ok` is set is undefined.
10139 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10142 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10143 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10145 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10146 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10147 /// `err` or `result` depending on the state of `result_ok`.
10148 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10149 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10150 pub result_ok: bool,
10153 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10154 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10155 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10156 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10157 result: Box::into_raw(Box::new(o)),
10163 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10164 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10165 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10166 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10167 err: Box::into_raw(Box::new(e)),
10173 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10174 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
10175 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10176 fn drop(&mut self) {
10177 if self.result_ok {
10178 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10179 let _ = unsafe { Box::from_raw(self.contents.result) };
10182 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10183 let _ = unsafe { Box::from_raw(self.contents.err) };
10188 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10189 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10190 let contents = if o.result_ok {
10191 let result = unsafe { o.contents.result };
10192 unsafe { o.contents.result = std::ptr::null_mut() };
10193 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
10195 let err = unsafe { o.contents.err };
10196 unsafe { o.contents.err = std::ptr::null_mut(); }
10197 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
10201 result_ok: o.result_ok,
10205 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10206 fn clone(&self) -> Self {
10207 if self.result_ok {
10208 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10209 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
10212 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10213 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10219 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10220 /// but with all dynamically-allocated buffers duplicated in new buffers.
10221 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
10223 /// The contents of CResult_UpdateFeeDecodeErrorZ
10224 pub union CResult_UpdateFeeDecodeErrorZPtr {
10225 /// A pointer to the contents in the success state.
10226 /// Reading from this pointer when `result_ok` is not set is undefined.
10227 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
10228 /// A pointer to the contents in the error state.
10229 /// Reading from this pointer when `result_ok` is set is undefined.
10230 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10233 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10234 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10236 pub struct CResult_UpdateFeeDecodeErrorZ {
10237 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10238 /// `err` or `result` depending on the state of `result_ok`.
10239 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
10240 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10241 pub result_ok: bool,
10244 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10245 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
10246 CResult_UpdateFeeDecodeErrorZ {
10247 contents: CResult_UpdateFeeDecodeErrorZPtr {
10248 result: Box::into_raw(Box::new(o)),
10254 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10255 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
10256 CResult_UpdateFeeDecodeErrorZ {
10257 contents: CResult_UpdateFeeDecodeErrorZPtr {
10258 err: Box::into_raw(Box::new(e)),
10264 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10265 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
10266 impl Drop for CResult_UpdateFeeDecodeErrorZ {
10267 fn drop(&mut self) {
10268 if self.result_ok {
10269 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10270 let _ = unsafe { Box::from_raw(self.contents.result) };
10273 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10274 let _ = unsafe { Box::from_raw(self.contents.err) };
10279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
10280 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
10281 let contents = if o.result_ok {
10282 let result = unsafe { o.contents.result };
10283 unsafe { o.contents.result = std::ptr::null_mut() };
10284 CResult_UpdateFeeDecodeErrorZPtr { result }
10286 let err = unsafe { o.contents.err };
10287 unsafe { o.contents.err = std::ptr::null_mut(); }
10288 CResult_UpdateFeeDecodeErrorZPtr { err }
10292 result_ok: o.result_ok,
10296 impl Clone for CResult_UpdateFeeDecodeErrorZ {
10297 fn clone(&self) -> Self {
10298 if self.result_ok {
10299 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
10300 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
10303 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
10304 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10310 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10311 /// but with all dynamically-allocated buffers duplicated in new buffers.
10312 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
10314 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10315 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10316 /// A pointer to the contents in the success state.
10317 /// Reading from this pointer when `result_ok` is not set is undefined.
10318 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10319 /// A pointer to the contents in the error state.
10320 /// Reading from this pointer when `result_ok` is set is undefined.
10321 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10324 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10325 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10327 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
10328 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10329 /// `err` or `result` depending on the state of `result_ok`.
10330 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
10331 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10332 pub result_ok: bool,
10335 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10336 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10337 CResult_UpdateFulfillHTLCDecodeErrorZ {
10338 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10339 result: Box::into_raw(Box::new(o)),
10345 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10346 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10347 CResult_UpdateFulfillHTLCDecodeErrorZ {
10348 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10349 err: Box::into_raw(Box::new(e)),
10355 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10356 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
10357 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
10358 fn drop(&mut self) {
10359 if self.result_ok {
10360 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10361 let _ = unsafe { Box::from_raw(self.contents.result) };
10364 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10365 let _ = unsafe { Box::from_raw(self.contents.err) };
10370 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
10371 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10372 let contents = if o.result_ok {
10373 let result = unsafe { o.contents.result };
10374 unsafe { o.contents.result = std::ptr::null_mut() };
10375 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
10377 let err = unsafe { o.contents.err };
10378 unsafe { o.contents.err = std::ptr::null_mut(); }
10379 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
10383 result_ok: o.result_ok,
10387 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
10388 fn clone(&self) -> Self {
10389 if self.result_ok {
10390 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10391 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
10394 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10395 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10401 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10402 /// but with all dynamically-allocated buffers duplicated in new buffers.
10403 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
10405 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
10406 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
10407 /// A pointer to the contents in the success state.
10408 /// Reading from this pointer when `result_ok` is not set is undefined.
10409 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10410 /// A pointer to the contents in the error state.
10411 /// Reading from this pointer when `result_ok` is set is undefined.
10412 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10415 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10416 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10417 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10418 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
10419 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10420 /// `err` or `result` depending on the state of `result_ok`.
10421 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
10422 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10423 pub result_ok: bool,
10426 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10427 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
10428 CResult_UpdateAddHTLCDecodeErrorZ {
10429 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10430 result: Box::into_raw(Box::new(o)),
10436 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10437 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
10438 CResult_UpdateAddHTLCDecodeErrorZ {
10439 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10440 err: Box::into_raw(Box::new(e)),
10446 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10447 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
10448 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
10449 fn drop(&mut self) {
10450 if self.result_ok {
10451 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10452 let _ = unsafe { Box::from_raw(self.contents.result) };
10455 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10456 let _ = unsafe { Box::from_raw(self.contents.err) };
10461 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
10462 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10463 let contents = if o.result_ok {
10464 let result = unsafe { o.contents.result };
10465 unsafe { o.contents.result = std::ptr::null_mut() };
10466 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
10468 let err = unsafe { o.contents.err };
10469 unsafe { o.contents.err = std::ptr::null_mut(); }
10470 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
10474 result_ok: o.result_ok,
10478 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
10479 fn clone(&self) -> Self {
10480 if self.result_ok {
10481 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10482 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
10485 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10486 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10492 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10493 /// but with all dynamically-allocated buffers duplicated in new buffers.
10494 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
10496 /// The contents of CResult_PingDecodeErrorZ
10497 pub union CResult_PingDecodeErrorZPtr {
10498 /// A pointer to the contents in the success state.
10499 /// Reading from this pointer when `result_ok` is not set is undefined.
10500 pub result: *mut crate::lightning::ln::msgs::Ping,
10501 /// A pointer to the contents in the error state.
10502 /// Reading from this pointer when `result_ok` is set is undefined.
10503 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10506 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10507 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10508 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10509 pub struct CResult_PingDecodeErrorZ {
10510 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
10511 /// `err` or `result` depending on the state of `result_ok`.
10512 pub contents: CResult_PingDecodeErrorZPtr,
10513 /// Whether this CResult_PingDecodeErrorZ represents a success state.
10514 pub result_ok: bool,
10517 /// Creates a new CResult_PingDecodeErrorZ in the success state.
10518 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
10519 CResult_PingDecodeErrorZ {
10520 contents: CResult_PingDecodeErrorZPtr {
10521 result: Box::into_raw(Box::new(o)),
10527 /// Creates a new CResult_PingDecodeErrorZ in the error state.
10528 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
10529 CResult_PingDecodeErrorZ {
10530 contents: CResult_PingDecodeErrorZPtr {
10531 err: Box::into_raw(Box::new(e)),
10537 /// Frees any resources used by the CResult_PingDecodeErrorZ.
10538 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
10539 impl Drop for CResult_PingDecodeErrorZ {
10540 fn drop(&mut self) {
10541 if self.result_ok {
10542 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10543 let _ = unsafe { Box::from_raw(self.contents.result) };
10546 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10547 let _ = unsafe { Box::from_raw(self.contents.err) };
10552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
10553 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
10554 let contents = if o.result_ok {
10555 let result = unsafe { o.contents.result };
10556 unsafe { o.contents.result = std::ptr::null_mut() };
10557 CResult_PingDecodeErrorZPtr { result }
10559 let err = unsafe { o.contents.err };
10560 unsafe { o.contents.err = std::ptr::null_mut(); }
10561 CResult_PingDecodeErrorZPtr { err }
10565 result_ok: o.result_ok,
10569 impl Clone for CResult_PingDecodeErrorZ {
10570 fn clone(&self) -> Self {
10571 if self.result_ok {
10572 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
10573 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
10576 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
10577 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10583 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10584 /// but with all dynamically-allocated buffers duplicated in new buffers.
10585 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
10587 /// The contents of CResult_PongDecodeErrorZ
10588 pub union CResult_PongDecodeErrorZPtr {
10589 /// A pointer to the contents in the success state.
10590 /// Reading from this pointer when `result_ok` is not set is undefined.
10591 pub result: *mut crate::lightning::ln::msgs::Pong,
10592 /// A pointer to the contents in the error state.
10593 /// Reading from this pointer when `result_ok` is set is undefined.
10594 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10597 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10598 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10600 pub struct CResult_PongDecodeErrorZ {
10601 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
10602 /// `err` or `result` depending on the state of `result_ok`.
10603 pub contents: CResult_PongDecodeErrorZPtr,
10604 /// Whether this CResult_PongDecodeErrorZ represents a success state.
10605 pub result_ok: bool,
10608 /// Creates a new CResult_PongDecodeErrorZ in the success state.
10609 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
10610 CResult_PongDecodeErrorZ {
10611 contents: CResult_PongDecodeErrorZPtr {
10612 result: Box::into_raw(Box::new(o)),
10618 /// Creates a new CResult_PongDecodeErrorZ in the error state.
10619 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
10620 CResult_PongDecodeErrorZ {
10621 contents: CResult_PongDecodeErrorZPtr {
10622 err: Box::into_raw(Box::new(e)),
10628 /// Frees any resources used by the CResult_PongDecodeErrorZ.
10629 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
10630 impl Drop for CResult_PongDecodeErrorZ {
10631 fn drop(&mut self) {
10632 if self.result_ok {
10633 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10634 let _ = unsafe { Box::from_raw(self.contents.result) };
10637 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10638 let _ = unsafe { Box::from_raw(self.contents.err) };
10643 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
10644 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
10645 let contents = if o.result_ok {
10646 let result = unsafe { o.contents.result };
10647 unsafe { o.contents.result = std::ptr::null_mut() };
10648 CResult_PongDecodeErrorZPtr { result }
10650 let err = unsafe { o.contents.err };
10651 unsafe { o.contents.err = std::ptr::null_mut(); }
10652 CResult_PongDecodeErrorZPtr { err }
10656 result_ok: o.result_ok,
10660 impl Clone for CResult_PongDecodeErrorZ {
10661 fn clone(&self) -> Self {
10662 if self.result_ok {
10663 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
10664 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
10667 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
10668 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10674 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10675 /// but with all dynamically-allocated buffers duplicated in new buffers.
10676 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
10678 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10679 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10680 /// A pointer to the contents in the success state.
10681 /// Reading from this pointer when `result_ok` is not set is undefined.
10682 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
10683 /// A pointer to the contents in the error state.
10684 /// Reading from this pointer when `result_ok` is set is undefined.
10685 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10688 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10689 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10691 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10692 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10693 /// `err` or `result` depending on the state of `result_ok`.
10694 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
10695 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10696 pub result_ok: bool,
10699 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10700 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10701 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10702 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10703 result: Box::into_raw(Box::new(o)),
10709 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10710 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10711 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10712 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10713 err: Box::into_raw(Box::new(e)),
10719 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10720 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
10721 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10722 fn drop(&mut self) {
10723 if self.result_ok {
10724 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10725 let _ = unsafe { Box::from_raw(self.contents.result) };
10728 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10729 let _ = unsafe { Box::from_raw(self.contents.err) };
10734 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10735 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10736 let contents = if o.result_ok {
10737 let result = unsafe { o.contents.result };
10738 unsafe { o.contents.result = std::ptr::null_mut() };
10739 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
10741 let err = unsafe { o.contents.err };
10742 unsafe { o.contents.err = std::ptr::null_mut(); }
10743 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
10747 result_ok: o.result_ok,
10751 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10752 fn clone(&self) -> Self {
10753 if self.result_ok {
10754 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10755 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10758 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10759 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10765 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10766 /// but with all dynamically-allocated buffers duplicated in new buffers.
10767 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
10769 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
10770 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
10771 /// A pointer to the contents in the success state.
10772 /// Reading from this pointer when `result_ok` is not set is undefined.
10773 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
10774 /// A pointer to the contents in the error state.
10775 /// Reading from this pointer when `result_ok` is set is undefined.
10776 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10779 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10780 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10782 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
10783 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10784 /// `err` or `result` depending on the state of `result_ok`.
10785 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
10786 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10787 pub result_ok: bool,
10790 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10791 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
10792 CResult_ChannelAnnouncementDecodeErrorZ {
10793 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10794 result: Box::into_raw(Box::new(o)),
10800 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10801 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
10802 CResult_ChannelAnnouncementDecodeErrorZ {
10803 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10804 err: Box::into_raw(Box::new(e)),
10810 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10811 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
10812 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
10813 fn drop(&mut self) {
10814 if self.result_ok {
10815 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10816 let _ = unsafe { Box::from_raw(self.contents.result) };
10819 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10820 let _ = unsafe { Box::from_raw(self.contents.err) };
10825 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10826 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10827 let contents = if o.result_ok {
10828 let result = unsafe { o.contents.result };
10829 unsafe { o.contents.result = std::ptr::null_mut() };
10830 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10832 let err = unsafe { o.contents.err };
10833 unsafe { o.contents.err = std::ptr::null_mut(); }
10834 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10838 result_ok: o.result_ok,
10842 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10843 fn clone(&self) -> Self {
10844 if self.result_ok {
10845 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10846 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10849 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10850 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10856 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10857 /// but with all dynamically-allocated buffers duplicated in new buffers.
10858 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
10860 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10861 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10862 /// A pointer to the contents in the success state.
10863 /// Reading from this pointer when `result_ok` is not set is undefined.
10864 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10865 /// A pointer to the contents in the error state.
10866 /// Reading from this pointer when `result_ok` is set is undefined.
10867 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10870 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10871 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10872 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10873 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10874 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10875 /// `err` or `result` depending on the state of `result_ok`.
10876 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10877 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10878 pub result_ok: bool,
10881 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10882 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10883 CResult_UnsignedChannelUpdateDecodeErrorZ {
10884 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10885 result: Box::into_raw(Box::new(o)),
10891 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10892 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10893 CResult_UnsignedChannelUpdateDecodeErrorZ {
10894 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10895 err: Box::into_raw(Box::new(e)),
10901 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10902 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10903 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10904 fn drop(&mut self) {
10905 if self.result_ok {
10906 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10907 let _ = unsafe { Box::from_raw(self.contents.result) };
10910 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10911 let _ = unsafe { Box::from_raw(self.contents.err) };
10916 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10917 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10918 let contents = if o.result_ok {
10919 let result = unsafe { o.contents.result };
10920 unsafe { o.contents.result = std::ptr::null_mut() };
10921 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10923 let err = unsafe { o.contents.err };
10924 unsafe { o.contents.err = std::ptr::null_mut(); }
10925 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10929 result_ok: o.result_ok,
10933 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10934 fn clone(&self) -> Self {
10935 if self.result_ok {
10936 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10937 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10940 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10941 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10947 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10948 /// but with all dynamically-allocated buffers duplicated in new buffers.
10949 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
10951 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10952 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10953 /// A pointer to the contents in the success state.
10954 /// Reading from this pointer when `result_ok` is not set is undefined.
10955 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10956 /// A pointer to the contents in the error state.
10957 /// Reading from this pointer when `result_ok` is set is undefined.
10958 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10961 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10962 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10964 pub struct CResult_ChannelUpdateDecodeErrorZ {
10965 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10966 /// `err` or `result` depending on the state of `result_ok`.
10967 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10968 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10969 pub result_ok: bool,
10972 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10973 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10974 CResult_ChannelUpdateDecodeErrorZ {
10975 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10976 result: Box::into_raw(Box::new(o)),
10982 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10983 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
10984 CResult_ChannelUpdateDecodeErrorZ {
10985 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10986 err: Box::into_raw(Box::new(e)),
10992 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10993 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
10994 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
10995 fn drop(&mut self) {
10996 if self.result_ok {
10997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10998 let _ = unsafe { Box::from_raw(self.contents.result) };
11001 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11002 let _ = unsafe { Box::from_raw(self.contents.err) };
11007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11008 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11009 let contents = if o.result_ok {
11010 let result = unsafe { o.contents.result };
11011 unsafe { o.contents.result = std::ptr::null_mut() };
11012 CResult_ChannelUpdateDecodeErrorZPtr { result }
11014 let err = unsafe { o.contents.err };
11015 unsafe { o.contents.err = std::ptr::null_mut(); }
11016 CResult_ChannelUpdateDecodeErrorZPtr { err }
11020 result_ok: o.result_ok,
11024 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11025 fn clone(&self) -> Self {
11026 if self.result_ok {
11027 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11028 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11031 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11032 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11038 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11039 /// but with all dynamically-allocated buffers duplicated in new buffers.
11040 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11042 /// The contents of CResult_ErrorMessageDecodeErrorZ
11043 pub union CResult_ErrorMessageDecodeErrorZPtr {
11044 /// A pointer to the contents in the success state.
11045 /// Reading from this pointer when `result_ok` is not set is undefined.
11046 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11047 /// A pointer to the contents in the error state.
11048 /// Reading from this pointer when `result_ok` is set is undefined.
11049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11052 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11053 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11055 pub struct CResult_ErrorMessageDecodeErrorZ {
11056 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11057 /// `err` or `result` depending on the state of `result_ok`.
11058 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11059 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11060 pub result_ok: bool,
11063 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11064 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11065 CResult_ErrorMessageDecodeErrorZ {
11066 contents: CResult_ErrorMessageDecodeErrorZPtr {
11067 result: Box::into_raw(Box::new(o)),
11073 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11074 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11075 CResult_ErrorMessageDecodeErrorZ {
11076 contents: CResult_ErrorMessageDecodeErrorZPtr {
11077 err: Box::into_raw(Box::new(e)),
11083 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11084 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11085 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11086 fn drop(&mut self) {
11087 if self.result_ok {
11088 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11089 let _ = unsafe { Box::from_raw(self.contents.result) };
11092 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11093 let _ = unsafe { Box::from_raw(self.contents.err) };
11098 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11099 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11100 let contents = if o.result_ok {
11101 let result = unsafe { o.contents.result };
11102 unsafe { o.contents.result = std::ptr::null_mut() };
11103 CResult_ErrorMessageDecodeErrorZPtr { result }
11105 let err = unsafe { o.contents.err };
11106 unsafe { o.contents.err = std::ptr::null_mut(); }
11107 CResult_ErrorMessageDecodeErrorZPtr { err }
11111 result_ok: o.result_ok,
11115 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11116 fn clone(&self) -> Self {
11117 if self.result_ok {
11118 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11119 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11122 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11123 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11129 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11130 /// but with all dynamically-allocated buffers duplicated in new buffers.
11131 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11133 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11134 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11135 /// A pointer to the contents in the success state.
11136 /// Reading from this pointer when `result_ok` is not set is undefined.
11137 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11138 /// A pointer to the contents in the error state.
11139 /// Reading from this pointer when `result_ok` is set is undefined.
11140 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11143 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11144 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11146 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11147 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11148 /// `err` or `result` depending on the state of `result_ok`.
11149 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11150 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11151 pub result_ok: bool,
11154 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11155 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11156 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11157 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11158 result: Box::into_raw(Box::new(o)),
11164 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11165 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11166 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11167 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11168 err: Box::into_raw(Box::new(e)),
11174 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11175 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
11176 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11177 fn drop(&mut self) {
11178 if self.result_ok {
11179 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11180 let _ = unsafe { Box::from_raw(self.contents.result) };
11183 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11184 let _ = unsafe { Box::from_raw(self.contents.err) };
11189 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11190 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11191 let contents = if o.result_ok {
11192 let result = unsafe { o.contents.result };
11193 unsafe { o.contents.result = std::ptr::null_mut() };
11194 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
11196 let err = unsafe { o.contents.err };
11197 unsafe { o.contents.err = std::ptr::null_mut(); }
11198 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
11202 result_ok: o.result_ok,
11206 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11207 fn clone(&self) -> Self {
11208 if self.result_ok {
11209 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11210 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11213 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11214 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11220 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11221 /// but with all dynamically-allocated buffers duplicated in new buffers.
11222 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11224 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
11225 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
11226 /// A pointer to the contents in the success state.
11227 /// Reading from this pointer when `result_ok` is not set is undefined.
11228 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
11229 /// A pointer to the contents in the error state.
11230 /// Reading from this pointer when `result_ok` is set is undefined.
11231 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11234 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11235 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11237 pub struct CResult_NodeAnnouncementDecodeErrorZ {
11238 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11239 /// `err` or `result` depending on the state of `result_ok`.
11240 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
11241 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11242 pub result_ok: bool,
11245 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11246 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
11247 CResult_NodeAnnouncementDecodeErrorZ {
11248 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11249 result: Box::into_raw(Box::new(o)),
11255 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11256 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
11257 CResult_NodeAnnouncementDecodeErrorZ {
11258 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11259 err: Box::into_raw(Box::new(e)),
11265 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11266 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
11267 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
11268 fn drop(&mut self) {
11269 if self.result_ok {
11270 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11271 let _ = unsafe { Box::from_raw(self.contents.result) };
11274 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11275 let _ = unsafe { Box::from_raw(self.contents.err) };
11280 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
11281 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11282 let contents = if o.result_ok {
11283 let result = unsafe { o.contents.result };
11284 unsafe { o.contents.result = std::ptr::null_mut() };
11285 CResult_NodeAnnouncementDecodeErrorZPtr { result }
11287 let err = unsafe { o.contents.err };
11288 unsafe { o.contents.err = std::ptr::null_mut(); }
11289 CResult_NodeAnnouncementDecodeErrorZPtr { err }
11293 result_ok: o.result_ok,
11297 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
11298 fn clone(&self) -> Self {
11299 if self.result_ok {
11300 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11301 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11304 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11305 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11311 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11312 /// but with all dynamically-allocated buffers duplicated in new buffers.
11313 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11315 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
11316 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
11317 /// A pointer to the contents in the success state.
11318 /// Reading from this pointer when `result_ok` is not set is undefined.
11319 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
11320 /// A pointer to the contents in the error state.
11321 /// Reading from this pointer when `result_ok` is set is undefined.
11322 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11325 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
11326 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
11327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11328 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
11329 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
11330 /// `err` or `result` depending on the state of `result_ok`.
11331 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
11332 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
11333 pub result_ok: bool,
11336 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11337 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11338 CResult_QueryShortChannelIdsDecodeErrorZ {
11339 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11340 result: Box::into_raw(Box::new(o)),
11346 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11347 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11348 CResult_QueryShortChannelIdsDecodeErrorZ {
11349 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11350 err: Box::into_raw(Box::new(e)),
11356 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11357 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
11358 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
11359 fn drop(&mut self) {
11360 if self.result_ok {
11361 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11362 let _ = unsafe { Box::from_raw(self.contents.result) };
11365 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11366 let _ = unsafe { Box::from_raw(self.contents.err) };
11371 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
11372 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
11373 let contents = if o.result_ok {
11374 let result = unsafe { o.contents.result };
11375 unsafe { o.contents.result = std::ptr::null_mut() };
11376 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
11378 let err = unsafe { o.contents.err };
11379 unsafe { o.contents.err = std::ptr::null_mut(); }
11380 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
11384 result_ok: o.result_ok,
11388 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
11389 fn clone(&self) -> Self {
11390 if self.result_ok {
11391 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11392 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
11395 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11396 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11402 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11403 /// but with all dynamically-allocated buffers duplicated in new buffers.
11404 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
11406 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
11407 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11408 /// A pointer to the contents in the success state.
11409 /// Reading from this pointer when `result_ok` is not set is undefined.
11410 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
11411 /// A pointer to the contents in the error state.
11412 /// Reading from this pointer when `result_ok` is set is undefined.
11413 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11416 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
11417 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
11418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11419 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11420 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
11421 /// `err` or `result` depending on the state of `result_ok`.
11422 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
11423 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
11424 pub result_ok: bool,
11427 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11428 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11429 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11430 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11431 result: Box::into_raw(Box::new(o)),
11437 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11438 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11439 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11440 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11441 err: Box::into_raw(Box::new(e)),
11447 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11448 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
11449 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11450 fn drop(&mut self) {
11451 if self.result_ok {
11452 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11453 let _ = unsafe { Box::from_raw(self.contents.result) };
11456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11457 let _ = unsafe { Box::from_raw(self.contents.err) };
11462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11463 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
11464 let contents = if o.result_ok {
11465 let result = unsafe { o.contents.result };
11466 unsafe { o.contents.result = std::ptr::null_mut() };
11467 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
11469 let err = unsafe { o.contents.err };
11470 unsafe { o.contents.err = std::ptr::null_mut(); }
11471 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
11475 result_ok: o.result_ok,
11479 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11480 fn clone(&self) -> Self {
11481 if self.result_ok {
11482 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11483 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
11486 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11487 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11493 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11494 /// but with all dynamically-allocated buffers duplicated in new buffers.
11495 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
11497 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
11498 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
11499 /// A pointer to the contents in the success state.
11500 /// Reading from this pointer when `result_ok` is not set is undefined.
11501 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
11502 /// A pointer to the contents in the error state.
11503 /// Reading from this pointer when `result_ok` is set is undefined.
11504 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11507 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11508 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11510 pub struct CResult_QueryChannelRangeDecodeErrorZ {
11511 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11512 /// `err` or `result` depending on the state of `result_ok`.
11513 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
11514 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11515 pub result_ok: bool,
11518 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11519 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
11520 CResult_QueryChannelRangeDecodeErrorZ {
11521 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11522 result: Box::into_raw(Box::new(o)),
11528 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11529 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
11530 CResult_QueryChannelRangeDecodeErrorZ {
11531 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11532 err: Box::into_raw(Box::new(e)),
11538 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11539 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
11540 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
11541 fn drop(&mut self) {
11542 if self.result_ok {
11543 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11544 let _ = unsafe { Box::from_raw(self.contents.result) };
11547 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11548 let _ = unsafe { Box::from_raw(self.contents.err) };
11553 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
11554 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11555 let contents = if o.result_ok {
11556 let result = unsafe { o.contents.result };
11557 unsafe { o.contents.result = std::ptr::null_mut() };
11558 CResult_QueryChannelRangeDecodeErrorZPtr { result }
11560 let err = unsafe { o.contents.err };
11561 unsafe { o.contents.err = std::ptr::null_mut(); }
11562 CResult_QueryChannelRangeDecodeErrorZPtr { err }
11566 result_ok: o.result_ok,
11570 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
11571 fn clone(&self) -> Self {
11572 if self.result_ok {
11573 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11574 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
11577 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11578 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11584 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11585 /// but with all dynamically-allocated buffers duplicated in new buffers.
11586 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
11588 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
11589 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
11590 /// A pointer to the contents in the success state.
11591 /// Reading from this pointer when `result_ok` is not set is undefined.
11592 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
11593 /// A pointer to the contents in the error state.
11594 /// Reading from this pointer when `result_ok` is set is undefined.
11595 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11598 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
11599 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11601 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
11602 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
11603 /// `err` or `result` depending on the state of `result_ok`.
11604 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
11605 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
11606 pub result_ok: bool,
11609 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11610 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
11611 CResult_ReplyChannelRangeDecodeErrorZ {
11612 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11613 result: Box::into_raw(Box::new(o)),
11619 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11620 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
11621 CResult_ReplyChannelRangeDecodeErrorZ {
11622 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11623 err: Box::into_raw(Box::new(e)),
11629 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11630 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
11631 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
11632 fn drop(&mut self) {
11633 if self.result_ok {
11634 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11635 let _ = unsafe { Box::from_raw(self.contents.result) };
11638 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11639 let _ = unsafe { Box::from_raw(self.contents.err) };
11644 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
11645 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11646 let contents = if o.result_ok {
11647 let result = unsafe { o.contents.result };
11648 unsafe { o.contents.result = std::ptr::null_mut() };
11649 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
11651 let err = unsafe { o.contents.err };
11652 unsafe { o.contents.err = std::ptr::null_mut(); }
11653 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
11657 result_ok: o.result_ok,
11661 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
11662 fn clone(&self) -> Self {
11663 if self.result_ok {
11664 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11665 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
11668 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11669 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11675 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11676 /// but with all dynamically-allocated buffers duplicated in new buffers.
11677 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
11679 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
11680 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
11681 /// A pointer to the contents in the success state.
11682 /// Reading from this pointer when `result_ok` is not set is undefined.
11683 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
11684 /// A pointer to the contents in the error state.
11685 /// Reading from this pointer when `result_ok` is set is undefined.
11686 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11689 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
11690 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
11691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11692 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
11693 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
11694 /// `err` or `result` depending on the state of `result_ok`.
11695 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
11696 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
11697 pub result_ok: bool,
11700 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11701 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
11702 CResult_GossipTimestampFilterDecodeErrorZ {
11703 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11704 result: Box::into_raw(Box::new(o)),
11710 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11711 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
11712 CResult_GossipTimestampFilterDecodeErrorZ {
11713 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11714 err: Box::into_raw(Box::new(e)),
11720 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11721 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
11722 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
11723 fn drop(&mut self) {
11724 if self.result_ok {
11725 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11726 let _ = unsafe { Box::from_raw(self.contents.result) };
11729 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11730 let _ = unsafe { Box::from_raw(self.contents.err) };
11735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
11736 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
11737 let contents = if o.result_ok {
11738 let result = unsafe { o.contents.result };
11739 unsafe { o.contents.result = std::ptr::null_mut() };
11740 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
11742 let err = unsafe { o.contents.err };
11743 unsafe { o.contents.err = std::ptr::null_mut(); }
11744 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
11748 result_ok: o.result_ok,
11752 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
11753 fn clone(&self) -> Self {
11754 if self.result_ok {
11755 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11756 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
11759 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11760 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11766 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11767 /// but with all dynamically-allocated buffers duplicated in new buffers.
11768 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
11770 /// The contents of CResult_InvoiceSignOrCreationErrorZ
11771 pub union CResult_InvoiceSignOrCreationErrorZPtr {
11772 /// A pointer to the contents in the success state.
11773 /// Reading from this pointer when `result_ok` is not set is undefined.
11774 pub result: *mut crate::lightning_invoice::Invoice,
11775 /// A pointer to the contents in the error state.
11776 /// Reading from this pointer when `result_ok` is set is undefined.
11777 pub err: *mut crate::lightning_invoice::SignOrCreationError,
11780 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11781 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11783 pub struct CResult_InvoiceSignOrCreationErrorZ {
11784 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11785 /// `err` or `result` depending on the state of `result_ok`.
11786 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
11787 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11788 pub result_ok: bool,
11791 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11792 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
11793 CResult_InvoiceSignOrCreationErrorZ {
11794 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11795 result: Box::into_raw(Box::new(o)),
11801 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11802 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
11803 CResult_InvoiceSignOrCreationErrorZ {
11804 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11805 err: Box::into_raw(Box::new(e)),
11811 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11812 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
11813 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
11814 fn drop(&mut self) {
11815 if self.result_ok {
11816 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11817 let _ = unsafe { Box::from_raw(self.contents.result) };
11820 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11821 let _ = unsafe { Box::from_raw(self.contents.err) };
11826 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11827 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11828 let contents = if o.result_ok {
11829 let result = unsafe { o.contents.result };
11830 unsafe { o.contents.result = std::ptr::null_mut() };
11831 CResult_InvoiceSignOrCreationErrorZPtr { result }
11833 let err = unsafe { o.contents.err };
11834 unsafe { o.contents.err = std::ptr::null_mut(); }
11835 CResult_InvoiceSignOrCreationErrorZPtr { err }
11839 result_ok: o.result_ok,
11843 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11844 fn clone(&self) -> Self {
11845 if self.result_ok {
11846 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11847 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11850 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11851 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11857 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11858 /// but with all dynamically-allocated buffers duplicated in new buffers.
11859 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
11861 /// An enum which can either contain a crate::lightning::chain::Filter or not
11862 pub enum COption_FilterZ {
11863 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
11864 Some(crate::lightning::chain::Filter),
11865 /// When we're in this state, this COption_FilterZ contains nothing
11868 impl COption_FilterZ {
11869 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11870 if let Self::Some(_) = self { true } else { false }
11872 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11875 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
11876 if let Self::Some(v) = self { v } else { unreachable!() }
11880 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
11881 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
11882 COption_FilterZ::Some(o)
11885 /// Constructs a new COption_FilterZ containing nothing
11886 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
11887 COption_FilterZ::None
11890 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
11891 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }