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) }
1822 /// The contents of CResult_RouteParametersDecodeErrorZ
1823 pub union CResult_RouteParametersDecodeErrorZPtr {
1824 /// A pointer to the contents in the success state.
1825 /// Reading from this pointer when `result_ok` is not set is undefined.
1826 pub result: *mut crate::lightning::routing::router::RouteParameters,
1827 /// A pointer to the contents in the error state.
1828 /// Reading from this pointer when `result_ok` is set is undefined.
1829 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1832 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1833 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1835 pub struct CResult_RouteParametersDecodeErrorZ {
1836 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1837 /// `err` or `result` depending on the state of `result_ok`.
1838 pub contents: CResult_RouteParametersDecodeErrorZPtr,
1839 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1840 pub result_ok: bool,
1843 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1844 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1845 CResult_RouteParametersDecodeErrorZ {
1846 contents: CResult_RouteParametersDecodeErrorZPtr {
1847 result: Box::into_raw(Box::new(o)),
1853 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
1854 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
1855 CResult_RouteParametersDecodeErrorZ {
1856 contents: CResult_RouteParametersDecodeErrorZPtr {
1857 err: Box::into_raw(Box::new(e)),
1863 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
1864 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
1865 impl Drop for CResult_RouteParametersDecodeErrorZ {
1866 fn drop(&mut self) {
1868 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1869 let _ = unsafe { Box::from_raw(self.contents.result) };
1872 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1873 let _ = unsafe { Box::from_raw(self.contents.err) };
1878 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
1879 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1880 let contents = if o.result_ok {
1881 let result = unsafe { o.contents.result };
1882 unsafe { o.contents.result = std::ptr::null_mut() };
1883 CResult_RouteParametersDecodeErrorZPtr { result }
1885 let err = unsafe { o.contents.err };
1886 unsafe { o.contents.err = std::ptr::null_mut(); }
1887 CResult_RouteParametersDecodeErrorZPtr { err }
1891 result_ok: o.result_ok,
1895 impl Clone for CResult_RouteParametersDecodeErrorZ {
1896 fn clone(&self) -> Self {
1898 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
1899 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
1902 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
1903 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1909 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
1910 /// but with all dynamically-allocated buffers duplicated in new buffers.
1911 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
1913 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1914 /// This corresponds to std::vector in C++
1915 pub struct CVec_RouteHintZ {
1916 /// The elements in the array.
1917 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1918 pub data: *mut crate::lightning::routing::router::RouteHint,
1919 /// The number of elements pointed to by `data`.
1922 impl CVec_RouteHintZ {
1923 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1924 if self.datalen == 0 { return Vec::new(); }
1925 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1926 self.data = std::ptr::null_mut();
1930 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1931 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1934 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1935 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1936 let datalen = v.len();
1937 let data = Box::into_raw(v.into_boxed_slice());
1938 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1942 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1943 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1944 impl Drop for CVec_RouteHintZ {
1945 fn drop(&mut self) {
1946 if self.datalen == 0 { return; }
1947 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1950 impl Clone for CVec_RouteHintZ {
1951 fn clone(&self) -> Self {
1952 let mut res = Vec::new();
1953 if self.datalen == 0 { return Self::from(res); }
1954 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1960 /// An enum which can either contain a u64 or not
1961 pub enum COption_u64Z {
1962 /// When we're in this state, this COption_u64Z contains a u64
1964 /// When we're in this state, this COption_u64Z contains nothing
1968 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1969 if let Self::Some(_) = self { true } else { false }
1971 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1974 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1975 if let Self::Some(v) = self { v } else { unreachable!() }
1979 /// Constructs a new COption_u64Z containing a u64
1980 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1981 COption_u64Z::Some(o)
1984 /// Constructs a new COption_u64Z containing nothing
1985 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1989 /// Frees any resources associated with the u64, if we are in the Some state
1990 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1992 /// Creates a new COption_u64Z which has the same data as `orig`
1993 /// but with all dynamically-allocated buffers duplicated in new buffers.
1994 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
1996 /// The contents of CResult_PayeeDecodeErrorZ
1997 pub union CResult_PayeeDecodeErrorZPtr {
1998 /// A pointer to the contents in the success state.
1999 /// Reading from this pointer when `result_ok` is not set is undefined.
2000 pub result: *mut crate::lightning::routing::router::Payee,
2001 /// A pointer to the contents in the error state.
2002 /// Reading from this pointer when `result_ok` is set is undefined.
2003 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2006 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2007 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2008 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2009 pub struct CResult_PayeeDecodeErrorZ {
2010 /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2011 /// `err` or `result` depending on the state of `result_ok`.
2012 pub contents: CResult_PayeeDecodeErrorZPtr,
2013 /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2014 pub result_ok: bool,
2017 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2018 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2019 CResult_PayeeDecodeErrorZ {
2020 contents: CResult_PayeeDecodeErrorZPtr {
2021 result: Box::into_raw(Box::new(o)),
2027 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2028 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2029 CResult_PayeeDecodeErrorZ {
2030 contents: CResult_PayeeDecodeErrorZPtr {
2031 err: Box::into_raw(Box::new(e)),
2037 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2038 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2039 impl Drop for CResult_PayeeDecodeErrorZ {
2040 fn drop(&mut self) {
2042 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2043 let _ = unsafe { Box::from_raw(self.contents.result) };
2046 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2047 let _ = unsafe { Box::from_raw(self.contents.err) };
2052 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2053 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2054 let contents = if o.result_ok {
2055 let result = unsafe { o.contents.result };
2056 unsafe { o.contents.result = std::ptr::null_mut() };
2057 CResult_PayeeDecodeErrorZPtr { result }
2059 let err = unsafe { o.contents.err };
2060 unsafe { o.contents.err = std::ptr::null_mut(); }
2061 CResult_PayeeDecodeErrorZPtr { err }
2065 result_ok: o.result_ok,
2069 impl Clone for CResult_PayeeDecodeErrorZ {
2070 fn clone(&self) -> Self {
2072 Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2073 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2076 Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2077 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2083 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2084 /// but with all dynamically-allocated buffers duplicated in new buffers.
2085 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2087 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2088 /// This corresponds to std::vector in C++
2089 pub struct CVec_RouteHintHopZ {
2090 /// The elements in the array.
2091 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2092 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2093 /// The number of elements pointed to by `data`.
2096 impl CVec_RouteHintHopZ {
2097 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2098 if self.datalen == 0 { return Vec::new(); }
2099 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2100 self.data = std::ptr::null_mut();
2104 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2105 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2108 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2109 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2110 let datalen = v.len();
2111 let data = Box::into_raw(v.into_boxed_slice());
2112 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2116 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2117 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2118 impl Drop for CVec_RouteHintHopZ {
2119 fn drop(&mut self) {
2120 if self.datalen == 0 { return; }
2121 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2124 impl Clone for CVec_RouteHintHopZ {
2125 fn clone(&self) -> Self {
2126 let mut res = Vec::new();
2127 if self.datalen == 0 { return Self::from(res); }
2128 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2133 /// The contents of CResult_RouteHintDecodeErrorZ
2134 pub union CResult_RouteHintDecodeErrorZPtr {
2135 /// A pointer to the contents in the success state.
2136 /// Reading from this pointer when `result_ok` is not set is undefined.
2137 pub result: *mut crate::lightning::routing::router::RouteHint,
2138 /// A pointer to the contents in the error state.
2139 /// Reading from this pointer when `result_ok` is set is undefined.
2140 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2143 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2144 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2146 pub struct CResult_RouteHintDecodeErrorZ {
2147 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2148 /// `err` or `result` depending on the state of `result_ok`.
2149 pub contents: CResult_RouteHintDecodeErrorZPtr,
2150 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2151 pub result_ok: bool,
2154 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2155 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2156 CResult_RouteHintDecodeErrorZ {
2157 contents: CResult_RouteHintDecodeErrorZPtr {
2158 result: Box::into_raw(Box::new(o)),
2164 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2165 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2166 CResult_RouteHintDecodeErrorZ {
2167 contents: CResult_RouteHintDecodeErrorZPtr {
2168 err: Box::into_raw(Box::new(e)),
2174 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2175 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2176 impl Drop for CResult_RouteHintDecodeErrorZ {
2177 fn drop(&mut self) {
2179 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2180 let _ = unsafe { Box::from_raw(self.contents.result) };
2183 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2184 let _ = unsafe { Box::from_raw(self.contents.err) };
2189 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2190 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2191 let contents = if o.result_ok {
2192 let result = unsafe { o.contents.result };
2193 unsafe { o.contents.result = std::ptr::null_mut() };
2194 CResult_RouteHintDecodeErrorZPtr { result }
2196 let err = unsafe { o.contents.err };
2197 unsafe { o.contents.err = std::ptr::null_mut(); }
2198 CResult_RouteHintDecodeErrorZPtr { err }
2202 result_ok: o.result_ok,
2206 impl Clone for CResult_RouteHintDecodeErrorZ {
2207 fn clone(&self) -> Self {
2209 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2210 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2213 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2214 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2220 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2221 /// but with all dynamically-allocated buffers duplicated in new buffers.
2222 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2224 /// The contents of CResult_RouteHintHopDecodeErrorZ
2225 pub union CResult_RouteHintHopDecodeErrorZPtr {
2226 /// A pointer to the contents in the success state.
2227 /// Reading from this pointer when `result_ok` is not set is undefined.
2228 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2229 /// A pointer to the contents in the error state.
2230 /// Reading from this pointer when `result_ok` is set is undefined.
2231 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2234 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2235 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2237 pub struct CResult_RouteHintHopDecodeErrorZ {
2238 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2239 /// `err` or `result` depending on the state of `result_ok`.
2240 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2241 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2242 pub result_ok: bool,
2245 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2246 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2247 CResult_RouteHintHopDecodeErrorZ {
2248 contents: CResult_RouteHintHopDecodeErrorZPtr {
2249 result: Box::into_raw(Box::new(o)),
2255 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2256 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2257 CResult_RouteHintHopDecodeErrorZ {
2258 contents: CResult_RouteHintHopDecodeErrorZPtr {
2259 err: Box::into_raw(Box::new(e)),
2265 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2266 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2267 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2268 fn drop(&mut self) {
2270 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2271 let _ = unsafe { Box::from_raw(self.contents.result) };
2274 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2275 let _ = unsafe { Box::from_raw(self.contents.err) };
2280 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2281 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2282 let contents = if o.result_ok {
2283 let result = unsafe { o.contents.result };
2284 unsafe { o.contents.result = std::ptr::null_mut() };
2285 CResult_RouteHintHopDecodeErrorZPtr { result }
2287 let err = unsafe { o.contents.err };
2288 unsafe { o.contents.err = std::ptr::null_mut(); }
2289 CResult_RouteHintHopDecodeErrorZPtr { err }
2293 result_ok: o.result_ok,
2297 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2298 fn clone(&self) -> Self {
2300 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2301 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2304 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2305 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2311 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2312 /// but with all dynamically-allocated buffers duplicated in new buffers.
2313 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2315 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2316 /// This corresponds to std::vector in C++
2317 pub struct CVec_ChannelDetailsZ {
2318 /// The elements in the array.
2319 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2320 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2321 /// The number of elements pointed to by `data`.
2324 impl CVec_ChannelDetailsZ {
2325 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2326 if self.datalen == 0 { return Vec::new(); }
2327 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2328 self.data = std::ptr::null_mut();
2332 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2333 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2336 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2337 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2338 let datalen = v.len();
2339 let data = Box::into_raw(v.into_boxed_slice());
2340 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2344 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2345 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2346 impl Drop for CVec_ChannelDetailsZ {
2347 fn drop(&mut self) {
2348 if self.datalen == 0 { return; }
2349 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2352 impl Clone for CVec_ChannelDetailsZ {
2353 fn clone(&self) -> Self {
2354 let mut res = Vec::new();
2355 if self.datalen == 0 { return Self::from(res); }
2356 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2361 /// The contents of CResult_RouteLightningErrorZ
2362 pub union CResult_RouteLightningErrorZPtr {
2363 /// A pointer to the contents in the success state.
2364 /// Reading from this pointer when `result_ok` is not set is undefined.
2365 pub result: *mut crate::lightning::routing::router::Route,
2366 /// A pointer to the contents in the error state.
2367 /// Reading from this pointer when `result_ok` is set is undefined.
2368 pub err: *mut crate::lightning::ln::msgs::LightningError,
2371 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2372 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2374 pub struct CResult_RouteLightningErrorZ {
2375 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2376 /// `err` or `result` depending on the state of `result_ok`.
2377 pub contents: CResult_RouteLightningErrorZPtr,
2378 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2379 pub result_ok: bool,
2382 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2383 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2384 CResult_RouteLightningErrorZ {
2385 contents: CResult_RouteLightningErrorZPtr {
2386 result: Box::into_raw(Box::new(o)),
2392 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2393 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2394 CResult_RouteLightningErrorZ {
2395 contents: CResult_RouteLightningErrorZPtr {
2396 err: Box::into_raw(Box::new(e)),
2402 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2403 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2404 impl Drop for CResult_RouteLightningErrorZ {
2405 fn drop(&mut self) {
2407 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2408 let _ = unsafe { Box::from_raw(self.contents.result) };
2411 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2412 let _ = unsafe { Box::from_raw(self.contents.err) };
2417 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2418 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2419 let contents = if o.result_ok {
2420 let result = unsafe { o.contents.result };
2421 unsafe { o.contents.result = std::ptr::null_mut() };
2422 CResult_RouteLightningErrorZPtr { result }
2424 let err = unsafe { o.contents.err };
2425 unsafe { o.contents.err = std::ptr::null_mut(); }
2426 CResult_RouteLightningErrorZPtr { err }
2430 result_ok: o.result_ok,
2434 impl Clone for CResult_RouteLightningErrorZ {
2435 fn clone(&self) -> Self {
2437 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2438 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2441 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2442 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2448 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2449 /// but with all dynamically-allocated buffers duplicated in new buffers.
2450 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2452 /// The contents of CResult_TxOutAccessErrorZ
2453 pub union CResult_TxOutAccessErrorZPtr {
2454 /// A pointer to the contents in the success state.
2455 /// Reading from this pointer when `result_ok` is not set is undefined.
2456 pub result: *mut crate::c_types::TxOut,
2457 /// A pointer to the contents in the error state.
2458 /// Reading from this pointer when `result_ok` is set is undefined.
2459 pub err: *mut crate::lightning::chain::AccessError,
2462 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2463 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2465 pub struct CResult_TxOutAccessErrorZ {
2466 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2467 /// `err` or `result` depending on the state of `result_ok`.
2468 pub contents: CResult_TxOutAccessErrorZPtr,
2469 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2470 pub result_ok: bool,
2473 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2474 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2475 CResult_TxOutAccessErrorZ {
2476 contents: CResult_TxOutAccessErrorZPtr {
2477 result: Box::into_raw(Box::new(o)),
2483 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2484 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2485 CResult_TxOutAccessErrorZ {
2486 contents: CResult_TxOutAccessErrorZPtr {
2487 err: Box::into_raw(Box::new(e)),
2493 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2494 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2495 impl Drop for CResult_TxOutAccessErrorZ {
2496 fn drop(&mut self) {
2498 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2499 let _ = unsafe { Box::from_raw(self.contents.result) };
2502 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2503 let _ = unsafe { Box::from_raw(self.contents.err) };
2508 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2509 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2510 let contents = if o.result_ok {
2511 let result = unsafe { o.contents.result };
2512 unsafe { o.contents.result = std::ptr::null_mut() };
2513 CResult_TxOutAccessErrorZPtr { result }
2515 let err = unsafe { o.contents.err };
2516 unsafe { o.contents.err = std::ptr::null_mut(); }
2517 CResult_TxOutAccessErrorZPtr { err }
2521 result_ok: o.result_ok,
2525 impl Clone for CResult_TxOutAccessErrorZ {
2526 fn clone(&self) -> Self {
2528 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2529 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2532 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2533 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2539 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2540 /// but with all dynamically-allocated buffers duplicated in new buffers.
2541 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2543 /// A tuple of 2 elements. See the individual fields for the types contained.
2544 pub struct C2Tuple_usizeTransactionZ {
2545 /// The element at position 0
2547 /// The element at position 1
2548 pub b: crate::c_types::Transaction,
2550 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2551 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2558 impl C2Tuple_usizeTransactionZ {
2559 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2563 impl Clone for C2Tuple_usizeTransactionZ {
2564 fn clone(&self) -> Self {
2566 a: Clone::clone(&self.a),
2567 b: Clone::clone(&self.b),
2572 /// Creates a new tuple which has the same data as `orig`
2573 /// but with all dynamically-allocated buffers duplicated in new buffers.
2574 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2575 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2577 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2578 C2Tuple_usizeTransactionZ { a, b, }
2582 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2583 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2585 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2586 /// This corresponds to std::vector in C++
2587 pub struct CVec_C2Tuple_usizeTransactionZZ {
2588 /// The elements in the array.
2589 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2590 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2591 /// The number of elements pointed to by `data`.
2594 impl CVec_C2Tuple_usizeTransactionZZ {
2595 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2596 if self.datalen == 0 { return Vec::new(); }
2597 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2598 self.data = std::ptr::null_mut();
2602 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2603 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2606 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2607 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2608 let datalen = v.len();
2609 let data = Box::into_raw(v.into_boxed_slice());
2610 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2614 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2615 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2616 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2617 fn drop(&mut self) {
2618 if self.datalen == 0 { return; }
2619 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2622 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2623 fn clone(&self) -> Self {
2624 let mut res = Vec::new();
2625 if self.datalen == 0 { return Self::from(res); }
2626 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2631 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2632 /// This corresponds to std::vector in C++
2633 pub struct CVec_TxidZ {
2634 /// The elements in the array.
2635 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2636 pub data: *mut crate::c_types::ThirtyTwoBytes,
2637 /// The number of elements pointed to by `data`.
2641 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2642 if self.datalen == 0 { return Vec::new(); }
2643 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2644 self.data = std::ptr::null_mut();
2648 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2649 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2652 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2653 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2654 let datalen = v.len();
2655 let data = Box::into_raw(v.into_boxed_slice());
2656 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2660 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2661 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2662 impl Drop for CVec_TxidZ {
2663 fn drop(&mut self) {
2664 if self.datalen == 0 { return; }
2665 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2668 impl Clone for CVec_TxidZ {
2669 fn clone(&self) -> Self {
2670 let mut res = Vec::new();
2671 if self.datalen == 0 { return Self::from(res); }
2672 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2677 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2678 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2679 /// Note that this value is always NULL, as there are no contents in the OK variant
2680 pub result: *mut std::ffi::c_void,
2681 /// A pointer to the contents in the error state.
2682 /// Reading from this pointer when `result_ok` is set is undefined.
2683 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2686 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2687 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2689 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2690 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2691 /// `err` or `result` depending on the state of `result_ok`.
2692 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2693 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2694 pub result_ok: bool,
2697 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2698 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2699 CResult_NoneChannelMonitorUpdateErrZ {
2700 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2701 result: std::ptr::null_mut(),
2707 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2708 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2709 CResult_NoneChannelMonitorUpdateErrZ {
2710 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2711 err: Box::into_raw(Box::new(e)),
2717 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2718 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2719 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2720 fn drop(&mut self) {
2723 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2724 let _ = unsafe { Box::from_raw(self.contents.err) };
2729 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2730 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2731 let contents = if o.result_ok {
2732 let _ = unsafe { Box::from_raw(o.contents.result) };
2733 o.contents.result = std::ptr::null_mut();
2734 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2736 let err = unsafe { o.contents.err };
2737 unsafe { o.contents.err = std::ptr::null_mut(); }
2738 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2742 result_ok: o.result_ok,
2746 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2747 fn clone(&self) -> Self {
2749 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2750 result: std::ptr::null_mut()
2753 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2754 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2760 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2761 /// but with all dynamically-allocated buffers duplicated in new buffers.
2762 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2764 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2765 /// This corresponds to std::vector in C++
2766 pub struct CVec_MonitorEventZ {
2767 /// The elements in the array.
2768 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2769 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2770 /// The number of elements pointed to by `data`.
2773 impl CVec_MonitorEventZ {
2774 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2775 if self.datalen == 0 { return Vec::new(); }
2776 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2777 self.data = std::ptr::null_mut();
2781 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2782 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2785 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2786 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2787 let datalen = v.len();
2788 let data = Box::into_raw(v.into_boxed_slice());
2789 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2793 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2794 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2795 impl Drop for CVec_MonitorEventZ {
2796 fn drop(&mut self) {
2797 if self.datalen == 0 { return; }
2798 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2801 impl Clone for CVec_MonitorEventZ {
2802 fn clone(&self) -> Self {
2803 let mut res = Vec::new();
2804 if self.datalen == 0 { return Self::from(res); }
2805 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2811 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2812 pub enum COption_C2Tuple_usizeTransactionZZ {
2813 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2814 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2815 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2818 impl COption_C2Tuple_usizeTransactionZZ {
2819 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2820 if let Self::Some(_) = self { true } else { false }
2822 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2825 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2826 if let Self::Some(v) = self { v } else { unreachable!() }
2830 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2831 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2832 COption_C2Tuple_usizeTransactionZZ::Some(o)
2835 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2836 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2837 COption_C2Tuple_usizeTransactionZZ::None
2840 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2841 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2843 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2844 /// but with all dynamically-allocated buffers duplicated in new buffers.
2845 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
2848 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2849 pub enum COption_NetworkUpdateZ {
2850 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2851 Some(crate::lightning::routing::network_graph::NetworkUpdate),
2852 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
2855 impl COption_NetworkUpdateZ {
2856 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2857 if let Self::Some(_) = self { true } else { false }
2859 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2862 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
2863 if let Self::Some(v) = self { v } else { unreachable!() }
2867 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
2868 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
2869 COption_NetworkUpdateZ::Some(o)
2872 /// Constructs a new COption_NetworkUpdateZ containing nothing
2873 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
2874 COption_NetworkUpdateZ::None
2877 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
2878 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
2880 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
2881 /// but with all dynamically-allocated buffers duplicated in new buffers.
2882 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
2884 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2885 /// This corresponds to std::vector in C++
2886 pub struct CVec_SpendableOutputDescriptorZ {
2887 /// The elements in the array.
2888 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2889 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2890 /// The number of elements pointed to by `data`.
2893 impl CVec_SpendableOutputDescriptorZ {
2894 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2895 if self.datalen == 0 { return Vec::new(); }
2896 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2897 self.data = std::ptr::null_mut();
2901 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2902 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2905 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2906 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2907 let datalen = v.len();
2908 let data = Box::into_raw(v.into_boxed_slice());
2909 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2913 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2914 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2915 impl Drop for CVec_SpendableOutputDescriptorZ {
2916 fn drop(&mut self) {
2917 if self.datalen == 0 { return; }
2918 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2921 impl Clone for CVec_SpendableOutputDescriptorZ {
2922 fn clone(&self) -> Self {
2923 let mut res = Vec::new();
2924 if self.datalen == 0 { return Self::from(res); }
2925 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2930 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2931 /// This corresponds to std::vector in C++
2932 pub struct CVec_MessageSendEventZ {
2933 /// The elements in the array.
2934 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2935 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2936 /// The number of elements pointed to by `data`.
2939 impl CVec_MessageSendEventZ {
2940 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2941 if self.datalen == 0 { return Vec::new(); }
2942 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2943 self.data = std::ptr::null_mut();
2947 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2948 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2951 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2952 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2953 let datalen = v.len();
2954 let data = Box::into_raw(v.into_boxed_slice());
2955 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2959 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2960 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2961 impl Drop for CVec_MessageSendEventZ {
2962 fn drop(&mut self) {
2963 if self.datalen == 0 { return; }
2964 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2967 impl Clone for CVec_MessageSendEventZ {
2968 fn clone(&self) -> Self {
2969 let mut res = Vec::new();
2970 if self.datalen == 0 { return Self::from(res); }
2971 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2976 /// The contents of CResult_InitFeaturesDecodeErrorZ
2977 pub union CResult_InitFeaturesDecodeErrorZPtr {
2978 /// A pointer to the contents in the success state.
2979 /// Reading from this pointer when `result_ok` is not set is undefined.
2980 pub result: *mut crate::lightning::ln::features::InitFeatures,
2981 /// A pointer to the contents in the error state.
2982 /// Reading from this pointer when `result_ok` is set is undefined.
2983 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2986 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2987 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2988 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2989 pub struct CResult_InitFeaturesDecodeErrorZ {
2990 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2991 /// `err` or `result` depending on the state of `result_ok`.
2992 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2993 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2994 pub result_ok: bool,
2997 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2998 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2999 CResult_InitFeaturesDecodeErrorZ {
3000 contents: CResult_InitFeaturesDecodeErrorZPtr {
3001 result: Box::into_raw(Box::new(o)),
3007 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3008 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3009 CResult_InitFeaturesDecodeErrorZ {
3010 contents: CResult_InitFeaturesDecodeErrorZPtr {
3011 err: Box::into_raw(Box::new(e)),
3017 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3018 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3019 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3020 fn drop(&mut self) {
3022 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3023 let _ = unsafe { Box::from_raw(self.contents.result) };
3026 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3027 let _ = unsafe { Box::from_raw(self.contents.err) };
3032 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3033 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3034 let contents = if o.result_ok {
3035 let result = unsafe { o.contents.result };
3036 unsafe { o.contents.result = std::ptr::null_mut() };
3037 CResult_InitFeaturesDecodeErrorZPtr { result }
3039 let err = unsafe { o.contents.err };
3040 unsafe { o.contents.err = std::ptr::null_mut(); }
3041 CResult_InitFeaturesDecodeErrorZPtr { err }
3045 result_ok: o.result_ok,
3050 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3051 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3052 /// A pointer to the contents in the success state.
3053 /// Reading from this pointer when `result_ok` is not set is undefined.
3054 pub result: *mut crate::lightning::ln::features::NodeFeatures,
3055 /// A pointer to the contents in the error state.
3056 /// Reading from this pointer when `result_ok` is set is undefined.
3057 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3060 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3061 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3062 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3063 pub struct CResult_NodeFeaturesDecodeErrorZ {
3064 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3065 /// `err` or `result` depending on the state of `result_ok`.
3066 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3067 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3068 pub result_ok: bool,
3071 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3072 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3073 CResult_NodeFeaturesDecodeErrorZ {
3074 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3075 result: Box::into_raw(Box::new(o)),
3081 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3082 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3083 CResult_NodeFeaturesDecodeErrorZ {
3084 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3085 err: Box::into_raw(Box::new(e)),
3091 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3092 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3093 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3094 fn drop(&mut self) {
3096 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3097 let _ = unsafe { Box::from_raw(self.contents.result) };
3100 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3101 let _ = unsafe { Box::from_raw(self.contents.err) };
3106 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3107 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3108 let contents = if o.result_ok {
3109 let result = unsafe { o.contents.result };
3110 unsafe { o.contents.result = std::ptr::null_mut() };
3111 CResult_NodeFeaturesDecodeErrorZPtr { result }
3113 let err = unsafe { o.contents.err };
3114 unsafe { o.contents.err = std::ptr::null_mut(); }
3115 CResult_NodeFeaturesDecodeErrorZPtr { err }
3119 result_ok: o.result_ok,
3124 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3125 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3126 /// A pointer to the contents in the success state.
3127 /// Reading from this pointer when `result_ok` is not set is undefined.
3128 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3129 /// A pointer to the contents in the error state.
3130 /// Reading from this pointer when `result_ok` is set is undefined.
3131 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3134 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3135 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3137 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3138 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3139 /// `err` or `result` depending on the state of `result_ok`.
3140 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3141 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3142 pub result_ok: bool,
3145 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3146 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3147 CResult_ChannelFeaturesDecodeErrorZ {
3148 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3149 result: Box::into_raw(Box::new(o)),
3155 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3156 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3157 CResult_ChannelFeaturesDecodeErrorZ {
3158 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3159 err: Box::into_raw(Box::new(e)),
3165 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3166 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3167 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3168 fn drop(&mut self) {
3170 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3171 let _ = unsafe { Box::from_raw(self.contents.result) };
3174 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3175 let _ = unsafe { Box::from_raw(self.contents.err) };
3180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3181 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3182 let contents = if o.result_ok {
3183 let result = unsafe { o.contents.result };
3184 unsafe { o.contents.result = std::ptr::null_mut() };
3185 CResult_ChannelFeaturesDecodeErrorZPtr { result }
3187 let err = unsafe { o.contents.err };
3188 unsafe { o.contents.err = std::ptr::null_mut(); }
3189 CResult_ChannelFeaturesDecodeErrorZPtr { err }
3193 result_ok: o.result_ok,
3198 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3199 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3200 /// A pointer to the contents in the success state.
3201 /// Reading from this pointer when `result_ok` is not set is undefined.
3202 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3203 /// A pointer to the contents in the error state.
3204 /// Reading from this pointer when `result_ok` is set is undefined.
3205 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3208 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3209 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3211 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3212 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3213 /// `err` or `result` depending on the state of `result_ok`.
3214 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3215 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3216 pub result_ok: bool,
3219 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3220 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3221 CResult_InvoiceFeaturesDecodeErrorZ {
3222 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3223 result: Box::into_raw(Box::new(o)),
3229 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3230 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3231 CResult_InvoiceFeaturesDecodeErrorZ {
3232 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3233 err: Box::into_raw(Box::new(e)),
3239 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3240 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3241 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3242 fn drop(&mut self) {
3244 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3245 let _ = unsafe { Box::from_raw(self.contents.result) };
3248 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3249 let _ = unsafe { Box::from_raw(self.contents.err) };
3254 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3255 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3256 let contents = if o.result_ok {
3257 let result = unsafe { o.contents.result };
3258 unsafe { o.contents.result = std::ptr::null_mut() };
3259 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3261 let err = unsafe { o.contents.err };
3262 unsafe { o.contents.err = std::ptr::null_mut(); }
3263 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3267 result_ok: o.result_ok,
3272 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3273 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3274 /// A pointer to the contents in the success state.
3275 /// Reading from this pointer when `result_ok` is not set is undefined.
3276 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3277 /// A pointer to the contents in the error state.
3278 /// Reading from this pointer when `result_ok` is set is undefined.
3279 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3282 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3283 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3285 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3286 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3287 /// `err` or `result` depending on the state of `result_ok`.
3288 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3289 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3290 pub result_ok: bool,
3293 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
3294 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3295 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3296 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3297 result: Box::into_raw(Box::new(o)),
3303 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
3304 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3305 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3306 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3307 err: Box::into_raw(Box::new(e)),
3313 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
3314 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
3315 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3316 fn drop(&mut self) {
3318 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3319 let _ = unsafe { Box::from_raw(self.contents.result) };
3322 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3323 let _ = unsafe { Box::from_raw(self.contents.err) };
3328 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3329 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3330 let contents = if o.result_ok {
3331 let result = unsafe { o.contents.result };
3332 unsafe { o.contents.result = std::ptr::null_mut() };
3333 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
3335 let err = unsafe { o.contents.err };
3336 unsafe { o.contents.err = std::ptr::null_mut(); }
3337 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
3341 result_ok: o.result_ok,
3345 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3346 fn clone(&self) -> Self {
3348 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3349 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3352 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3353 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3359 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3360 /// but with all dynamically-allocated buffers duplicated in new buffers.
3361 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3363 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3364 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3365 /// A pointer to the contents in the success state.
3366 /// Reading from this pointer when `result_ok` is not set is undefined.
3367 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
3368 /// A pointer to the contents in the error state.
3369 /// Reading from this pointer when `result_ok` is set is undefined.
3370 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3373 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3374 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3375 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3376 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3377 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3378 /// `err` or `result` depending on the state of `result_ok`.
3379 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
3380 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3381 pub result_ok: bool,
3384 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
3385 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3386 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3387 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3388 result: Box::into_raw(Box::new(o)),
3394 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
3395 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3396 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3397 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3398 err: Box::into_raw(Box::new(e)),
3404 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
3405 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
3406 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3407 fn drop(&mut self) {
3409 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3410 let _ = unsafe { Box::from_raw(self.contents.result) };
3413 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3414 let _ = unsafe { Box::from_raw(self.contents.err) };
3419 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3420 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3421 let contents = if o.result_ok {
3422 let result = unsafe { o.contents.result };
3423 unsafe { o.contents.result = std::ptr::null_mut() };
3424 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
3426 let err = unsafe { o.contents.err };
3427 unsafe { o.contents.err = std::ptr::null_mut(); }
3428 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
3432 result_ok: o.result_ok,
3436 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3437 fn clone(&self) -> Self {
3439 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3440 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3443 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3444 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3450 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3451 /// but with all dynamically-allocated buffers duplicated in new buffers.
3452 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3454 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3455 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3456 /// A pointer to the contents in the success state.
3457 /// Reading from this pointer when `result_ok` is not set is undefined.
3458 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3459 /// A pointer to the contents in the error state.
3460 /// Reading from this pointer when `result_ok` is set is undefined.
3461 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3464 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3465 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3467 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3468 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3469 /// `err` or `result` depending on the state of `result_ok`.
3470 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3471 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3472 pub result_ok: bool,
3475 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
3476 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3477 CResult_SpendableOutputDescriptorDecodeErrorZ {
3478 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3479 result: Box::into_raw(Box::new(o)),
3485 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
3486 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3487 CResult_SpendableOutputDescriptorDecodeErrorZ {
3488 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3489 err: Box::into_raw(Box::new(e)),
3495 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
3496 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3497 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3498 fn drop(&mut self) {
3500 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3501 let _ = unsafe { Box::from_raw(self.contents.result) };
3504 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3505 let _ = unsafe { Box::from_raw(self.contents.err) };
3510 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3511 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3512 let contents = if o.result_ok {
3513 let result = unsafe { o.contents.result };
3514 unsafe { o.contents.result = std::ptr::null_mut() };
3515 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3517 let err = unsafe { o.contents.err };
3518 unsafe { o.contents.err = std::ptr::null_mut(); }
3519 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3523 result_ok: o.result_ok,
3527 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3528 fn clone(&self) -> Self {
3530 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3531 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3534 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3535 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3541 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3542 /// but with all dynamically-allocated buffers duplicated in new buffers.
3543 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3545 /// The contents of CResult_NoneNoneZ
3546 pub union CResult_NoneNoneZPtr {
3547 /// Note that this value is always NULL, as there are no contents in the OK variant
3548 pub result: *mut std::ffi::c_void,
3549 /// Note that this value is always NULL, as there are no contents in the Err variant
3550 pub err: *mut std::ffi::c_void,
3553 /// A CResult_NoneNoneZ represents the result of a fallible operation,
3554 /// containing a () on success and a () on failure.
3555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3556 pub struct CResult_NoneNoneZ {
3557 /// The contents of this CResult_NoneNoneZ, accessible via either
3558 /// `err` or `result` depending on the state of `result_ok`.
3559 pub contents: CResult_NoneNoneZPtr,
3560 /// Whether this CResult_NoneNoneZ represents a success state.
3561 pub result_ok: bool,
3564 /// Creates a new CResult_NoneNoneZ in the success state.
3565 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
3567 contents: CResult_NoneNoneZPtr {
3568 result: std::ptr::null_mut(),
3574 /// Creates a new CResult_NoneNoneZ in the error state.
3575 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
3577 contents: CResult_NoneNoneZPtr {
3578 err: std::ptr::null_mut(),
3584 /// Frees any resources used by the CResult_NoneNoneZ.
3585 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
3586 impl Drop for CResult_NoneNoneZ {
3587 fn drop(&mut self) {
3593 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
3594 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
3595 let contents = if o.result_ok {
3596 let _ = unsafe { Box::from_raw(o.contents.result) };
3597 o.contents.result = std::ptr::null_mut();
3598 CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
3600 let _ = unsafe { Box::from_raw(o.contents.err) };
3601 o.contents.err = std::ptr::null_mut();
3602 CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
3606 result_ok: o.result_ok,
3610 impl Clone for CResult_NoneNoneZ {
3611 fn clone(&self) -> Self {
3613 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
3614 result: std::ptr::null_mut()
3617 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
3618 err: std::ptr::null_mut()
3624 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
3625 /// but with all dynamically-allocated buffers duplicated in new buffers.
3626 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
3628 /// A tuple of 2 elements. See the individual fields for the types contained.
3629 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3630 /// The element at position 0
3631 pub a: crate::c_types::Signature,
3632 /// The element at position 1
3633 pub b: crate::c_types::derived::CVec_SignatureZ,
3635 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3636 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3643 impl C2Tuple_SignatureCVec_SignatureZZ {
3644 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3648 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3649 fn clone(&self) -> Self {
3651 a: Clone::clone(&self.a),
3652 b: Clone::clone(&self.b),
3657 /// Creates a new tuple which has the same data as `orig`
3658 /// but with all dynamically-allocated buffers duplicated in new buffers.
3659 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
3660 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3662 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3663 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3667 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3668 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3670 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3671 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3672 /// A pointer to the contents in the success state.
3673 /// Reading from this pointer when `result_ok` is not set is undefined.
3674 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3675 /// Note that this value is always NULL, as there are no contents in the Err variant
3676 pub err: *mut std::ffi::c_void,
3679 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3680 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3682 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3683 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3684 /// `err` or `result` depending on the state of `result_ok`.
3685 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3686 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3687 pub result_ok: bool,
3690 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3691 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3692 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3693 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3694 result: Box::into_raw(Box::new(o)),
3700 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3701 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3702 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3703 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3704 err: std::ptr::null_mut(),
3710 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3711 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3712 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3713 fn drop(&mut self) {
3715 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3716 let _ = unsafe { Box::from_raw(self.contents.result) };
3722 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3723 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3724 let contents = if o.result_ok {
3725 let result = unsafe { o.contents.result };
3726 unsafe { o.contents.result = std::ptr::null_mut() };
3727 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3729 let _ = unsafe { Box::from_raw(o.contents.err) };
3730 o.contents.err = std::ptr::null_mut();
3731 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3735 result_ok: o.result_ok,
3739 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3740 fn clone(&self) -> Self {
3742 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3743 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3746 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3747 err: std::ptr::null_mut()
3753 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3754 /// but with all dynamically-allocated buffers duplicated in new buffers.
3755 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
3757 /// The contents of CResult_SignatureNoneZ
3758 pub union CResult_SignatureNoneZPtr {
3759 /// A pointer to the contents in the success state.
3760 /// Reading from this pointer when `result_ok` is not set is undefined.
3761 pub result: *mut crate::c_types::Signature,
3762 /// Note that this value is always NULL, as there are no contents in the Err variant
3763 pub err: *mut std::ffi::c_void,
3766 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3767 /// containing a crate::c_types::Signature on success and a () on failure.
3768 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3769 pub struct CResult_SignatureNoneZ {
3770 /// The contents of this CResult_SignatureNoneZ, accessible via either
3771 /// `err` or `result` depending on the state of `result_ok`.
3772 pub contents: CResult_SignatureNoneZPtr,
3773 /// Whether this CResult_SignatureNoneZ represents a success state.
3774 pub result_ok: bool,
3777 /// Creates a new CResult_SignatureNoneZ in the success state.
3778 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3779 CResult_SignatureNoneZ {
3780 contents: CResult_SignatureNoneZPtr {
3781 result: Box::into_raw(Box::new(o)),
3787 /// Creates a new CResult_SignatureNoneZ in the error state.
3788 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3789 CResult_SignatureNoneZ {
3790 contents: CResult_SignatureNoneZPtr {
3791 err: std::ptr::null_mut(),
3797 /// Frees any resources used by the CResult_SignatureNoneZ.
3798 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3799 impl Drop for CResult_SignatureNoneZ {
3800 fn drop(&mut self) {
3802 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3803 let _ = unsafe { Box::from_raw(self.contents.result) };
3809 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3810 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3811 let contents = if o.result_ok {
3812 let result = unsafe { o.contents.result };
3813 unsafe { o.contents.result = std::ptr::null_mut() };
3814 CResult_SignatureNoneZPtr { result }
3816 let _ = unsafe { Box::from_raw(o.contents.err) };
3817 o.contents.err = std::ptr::null_mut();
3818 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3822 result_ok: o.result_ok,
3826 impl Clone for CResult_SignatureNoneZ {
3827 fn clone(&self) -> Self {
3829 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3830 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3833 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3834 err: std::ptr::null_mut()
3840 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3841 /// but with all dynamically-allocated buffers duplicated in new buffers.
3842 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
3844 /// The contents of CResult_SignDecodeErrorZ
3845 pub union CResult_SignDecodeErrorZPtr {
3846 /// A pointer to the contents in the success state.
3847 /// Reading from this pointer when `result_ok` is not set is undefined.
3848 pub result: *mut crate::lightning::chain::keysinterface::Sign,
3849 /// A pointer to the contents in the error state.
3850 /// Reading from this pointer when `result_ok` is set is undefined.
3851 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3854 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3855 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3856 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3857 pub struct CResult_SignDecodeErrorZ {
3858 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3859 /// `err` or `result` depending on the state of `result_ok`.
3860 pub contents: CResult_SignDecodeErrorZPtr,
3861 /// Whether this CResult_SignDecodeErrorZ represents a success state.
3862 pub result_ok: bool,
3865 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3866 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3867 CResult_SignDecodeErrorZ {
3868 contents: CResult_SignDecodeErrorZPtr {
3869 result: Box::into_raw(Box::new(o)),
3875 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3876 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3877 CResult_SignDecodeErrorZ {
3878 contents: CResult_SignDecodeErrorZPtr {
3879 err: Box::into_raw(Box::new(e)),
3885 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3886 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3887 impl Drop for CResult_SignDecodeErrorZ {
3888 fn drop(&mut self) {
3890 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3891 let _ = unsafe { Box::from_raw(self.contents.result) };
3894 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3895 let _ = unsafe { Box::from_raw(self.contents.err) };
3900 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3901 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3902 let contents = if o.result_ok {
3903 let result = unsafe { o.contents.result };
3904 unsafe { o.contents.result = std::ptr::null_mut() };
3905 CResult_SignDecodeErrorZPtr { result }
3907 let err = unsafe { o.contents.err };
3908 unsafe { o.contents.err = std::ptr::null_mut(); }
3909 CResult_SignDecodeErrorZPtr { err }
3913 result_ok: o.result_ok,
3917 impl Clone for CResult_SignDecodeErrorZ {
3918 fn clone(&self) -> Self {
3920 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3921 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3924 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3925 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3931 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3932 /// but with all dynamically-allocated buffers duplicated in new buffers.
3933 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
3935 /// A dynamically-allocated array of u8s of arbitrary size.
3936 /// This corresponds to std::vector in C++
3937 pub struct CVec_u8Z {
3938 /// The elements in the array.
3939 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3941 /// The number of elements pointed to by `data`.
3945 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3946 if self.datalen == 0 { return Vec::new(); }
3947 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3948 self.data = std::ptr::null_mut();
3952 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3953 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3956 impl From<Vec<u8>> for CVec_u8Z {
3957 fn from(v: Vec<u8>) -> Self {
3958 let datalen = v.len();
3959 let data = Box::into_raw(v.into_boxed_slice());
3960 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3964 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3965 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3966 impl Drop for CVec_u8Z {
3967 fn drop(&mut self) {
3968 if self.datalen == 0 { return; }
3969 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3972 impl Clone for CVec_u8Z {
3973 fn clone(&self) -> Self {
3974 let mut res = Vec::new();
3975 if self.datalen == 0 { return Self::from(res); }
3976 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3981 /// The contents of CResult_RecoverableSignatureNoneZ
3982 pub union CResult_RecoverableSignatureNoneZPtr {
3983 /// A pointer to the contents in the success state.
3984 /// Reading from this pointer when `result_ok` is not set is undefined.
3985 pub result: *mut crate::c_types::RecoverableSignature,
3986 /// Note that this value is always NULL, as there are no contents in the Err variant
3987 pub err: *mut std::ffi::c_void,
3990 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3991 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3993 pub struct CResult_RecoverableSignatureNoneZ {
3994 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3995 /// `err` or `result` depending on the state of `result_ok`.
3996 pub contents: CResult_RecoverableSignatureNoneZPtr,
3997 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3998 pub result_ok: bool,
4001 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4002 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4003 CResult_RecoverableSignatureNoneZ {
4004 contents: CResult_RecoverableSignatureNoneZPtr {
4005 result: Box::into_raw(Box::new(o)),
4011 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4012 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4013 CResult_RecoverableSignatureNoneZ {
4014 contents: CResult_RecoverableSignatureNoneZPtr {
4015 err: std::ptr::null_mut(),
4021 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4022 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4023 impl Drop for CResult_RecoverableSignatureNoneZ {
4024 fn drop(&mut self) {
4026 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4027 let _ = unsafe { Box::from_raw(self.contents.result) };
4033 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4034 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4035 let contents = if o.result_ok {
4036 let result = unsafe { o.contents.result };
4037 unsafe { o.contents.result = std::ptr::null_mut() };
4038 CResult_RecoverableSignatureNoneZPtr { result }
4040 let _ = unsafe { Box::from_raw(o.contents.err) };
4041 o.contents.err = std::ptr::null_mut();
4042 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
4046 result_ok: o.result_ok,
4050 impl Clone for CResult_RecoverableSignatureNoneZ {
4051 fn clone(&self) -> Self {
4053 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4054 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4057 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4058 err: std::ptr::null_mut()
4064 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4065 /// but with all dynamically-allocated buffers duplicated in new buffers.
4066 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4068 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4069 /// This corresponds to std::vector in C++
4070 pub struct CVec_CVec_u8ZZ {
4071 /// The elements in the array.
4072 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4073 pub data: *mut crate::c_types::derived::CVec_u8Z,
4074 /// The number of elements pointed to by `data`.
4077 impl CVec_CVec_u8ZZ {
4078 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4079 if self.datalen == 0 { return Vec::new(); }
4080 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4081 self.data = std::ptr::null_mut();
4085 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4086 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4089 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4090 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4091 let datalen = v.len();
4092 let data = Box::into_raw(v.into_boxed_slice());
4093 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4097 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4098 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4099 impl Drop for CVec_CVec_u8ZZ {
4100 fn drop(&mut self) {
4101 if self.datalen == 0 { return; }
4102 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4105 impl Clone for CVec_CVec_u8ZZ {
4106 fn clone(&self) -> Self {
4107 let mut res = Vec::new();
4108 if self.datalen == 0 { return Self::from(res); }
4109 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4114 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4115 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4116 /// A pointer to the contents in the success state.
4117 /// Reading from this pointer when `result_ok` is not set is undefined.
4118 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4119 /// Note that this value is always NULL, as there are no contents in the Err variant
4120 pub err: *mut std::ffi::c_void,
4123 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4124 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4126 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4127 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4128 /// `err` or `result` depending on the state of `result_ok`.
4129 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4130 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4131 pub result_ok: bool,
4134 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4135 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4136 CResult_CVec_CVec_u8ZZNoneZ {
4137 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4138 result: Box::into_raw(Box::new(o)),
4144 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4145 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4146 CResult_CVec_CVec_u8ZZNoneZ {
4147 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4148 err: std::ptr::null_mut(),
4154 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4155 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4156 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4157 fn drop(&mut self) {
4159 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4160 let _ = unsafe { Box::from_raw(self.contents.result) };
4166 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4167 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4168 let contents = if o.result_ok {
4169 let result = unsafe { o.contents.result };
4170 unsafe { o.contents.result = std::ptr::null_mut() };
4171 CResult_CVec_CVec_u8ZZNoneZPtr { result }
4173 let _ = unsafe { Box::from_raw(o.contents.err) };
4174 o.contents.err = std::ptr::null_mut();
4175 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4179 result_ok: o.result_ok,
4183 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4184 fn clone(&self) -> Self {
4186 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4187 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4190 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4191 err: std::ptr::null_mut()
4197 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4198 /// but with all dynamically-allocated buffers duplicated in new buffers.
4199 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4201 /// The contents of CResult_InMemorySignerDecodeErrorZ
4202 pub union CResult_InMemorySignerDecodeErrorZPtr {
4203 /// A pointer to the contents in the success state.
4204 /// Reading from this pointer when `result_ok` is not set is undefined.
4205 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4206 /// A pointer to the contents in the error state.
4207 /// Reading from this pointer when `result_ok` is set is undefined.
4208 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4211 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4212 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4214 pub struct CResult_InMemorySignerDecodeErrorZ {
4215 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4216 /// `err` or `result` depending on the state of `result_ok`.
4217 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4218 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4219 pub result_ok: bool,
4222 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4223 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4224 CResult_InMemorySignerDecodeErrorZ {
4225 contents: CResult_InMemorySignerDecodeErrorZPtr {
4226 result: Box::into_raw(Box::new(o)),
4232 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4233 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4234 CResult_InMemorySignerDecodeErrorZ {
4235 contents: CResult_InMemorySignerDecodeErrorZPtr {
4236 err: Box::into_raw(Box::new(e)),
4242 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
4243 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4244 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4245 fn drop(&mut self) {
4247 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4248 let _ = unsafe { Box::from_raw(self.contents.result) };
4251 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4252 let _ = unsafe { Box::from_raw(self.contents.err) };
4257 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
4258 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
4259 let contents = if o.result_ok {
4260 let result = unsafe { o.contents.result };
4261 unsafe { o.contents.result = std::ptr::null_mut() };
4262 CResult_InMemorySignerDecodeErrorZPtr { result }
4264 let err = unsafe { o.contents.err };
4265 unsafe { o.contents.err = std::ptr::null_mut(); }
4266 CResult_InMemorySignerDecodeErrorZPtr { err }
4270 result_ok: o.result_ok,
4274 impl Clone for CResult_InMemorySignerDecodeErrorZ {
4275 fn clone(&self) -> Self {
4277 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
4278 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
4281 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
4282 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4288 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
4289 /// but with all dynamically-allocated buffers duplicated in new buffers.
4290 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
4292 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4293 /// This corresponds to std::vector in C++
4294 pub struct CVec_TxOutZ {
4295 /// The elements in the array.
4296 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4297 pub data: *mut crate::c_types::TxOut,
4298 /// The number of elements pointed to by `data`.
4302 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
4303 if self.datalen == 0 { return Vec::new(); }
4304 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4305 self.data = std::ptr::null_mut();
4309 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
4310 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4313 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
4314 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
4315 let datalen = v.len();
4316 let data = Box::into_raw(v.into_boxed_slice());
4317 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4321 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4322 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
4323 impl Drop for CVec_TxOutZ {
4324 fn drop(&mut self) {
4325 if self.datalen == 0 { return; }
4326 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4329 impl Clone for CVec_TxOutZ {
4330 fn clone(&self) -> Self {
4331 let mut res = Vec::new();
4332 if self.datalen == 0 { return Self::from(res); }
4333 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4338 /// The contents of CResult_TransactionNoneZ
4339 pub union CResult_TransactionNoneZPtr {
4340 /// A pointer to the contents in the success state.
4341 /// Reading from this pointer when `result_ok` is not set is undefined.
4342 pub result: *mut crate::c_types::Transaction,
4343 /// Note that this value is always NULL, as there are no contents in the Err variant
4344 pub err: *mut std::ffi::c_void,
4347 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
4348 /// containing a crate::c_types::Transaction on success and a () on failure.
4349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4350 pub struct CResult_TransactionNoneZ {
4351 /// The contents of this CResult_TransactionNoneZ, accessible via either
4352 /// `err` or `result` depending on the state of `result_ok`.
4353 pub contents: CResult_TransactionNoneZPtr,
4354 /// Whether this CResult_TransactionNoneZ represents a success state.
4355 pub result_ok: bool,
4358 /// Creates a new CResult_TransactionNoneZ in the success state.
4359 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
4360 CResult_TransactionNoneZ {
4361 contents: CResult_TransactionNoneZPtr {
4362 result: Box::into_raw(Box::new(o)),
4368 /// Creates a new CResult_TransactionNoneZ in the error state.
4369 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
4370 CResult_TransactionNoneZ {
4371 contents: CResult_TransactionNoneZPtr {
4372 err: std::ptr::null_mut(),
4378 /// Frees any resources used by the CResult_TransactionNoneZ.
4379 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
4380 impl Drop for CResult_TransactionNoneZ {
4381 fn drop(&mut self) {
4383 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4384 let _ = unsafe { Box::from_raw(self.contents.result) };
4390 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
4391 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
4392 let contents = if o.result_ok {
4393 let result = unsafe { o.contents.result };
4394 unsafe { o.contents.result = std::ptr::null_mut() };
4395 CResult_TransactionNoneZPtr { result }
4397 let _ = unsafe { Box::from_raw(o.contents.err) };
4398 o.contents.err = std::ptr::null_mut();
4399 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
4403 result_ok: o.result_ok,
4407 impl Clone for CResult_TransactionNoneZ {
4408 fn clone(&self) -> Self {
4410 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
4411 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
4414 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
4415 err: std::ptr::null_mut()
4421 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
4422 /// but with all dynamically-allocated buffers duplicated in new buffers.
4423 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
4425 /// A tuple of 2 elements. See the individual fields for the types contained.
4426 pub struct C2Tuple_BlockHashChannelMonitorZ {
4427 /// The element at position 0
4428 pub a: crate::c_types::ThirtyTwoBytes,
4429 /// The element at position 1
4430 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
4432 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4433 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
4440 impl C2Tuple_BlockHashChannelMonitorZ {
4441 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
4445 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4447 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4448 C2Tuple_BlockHashChannelMonitorZ { a, b, }
4452 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4453 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4455 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4456 /// This corresponds to std::vector in C++
4457 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
4458 /// The elements in the array.
4459 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4460 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4461 /// The number of elements pointed to by `data`.
4464 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
4465 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
4466 if self.datalen == 0 { return Vec::new(); }
4467 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4468 self.data = std::ptr::null_mut();
4472 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
4473 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4476 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4477 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
4478 let datalen = v.len();
4479 let data = Box::into_raw(v.into_boxed_slice());
4480 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4484 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4485 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
4486 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4487 fn drop(&mut self) {
4488 if self.datalen == 0 { return; }
4489 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4493 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4494 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4495 /// A pointer to the contents in the success state.
4496 /// Reading from this pointer when `result_ok` is not set is undefined.
4497 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
4498 /// A pointer to the contents in the error state.
4499 /// Reading from this pointer when `result_ok` is set is undefined.
4500 pub err: *mut crate::c_types::IOError,
4503 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4504 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4506 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4507 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4508 /// `err` or `result` depending on the state of `result_ok`.
4509 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
4510 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4511 pub result_ok: bool,
4514 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
4515 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4516 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4517 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4518 result: Box::into_raw(Box::new(o)),
4524 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
4525 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4526 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4527 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4528 err: Box::into_raw(Box::new(e)),
4534 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
4535 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
4536 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4537 fn drop(&mut self) {
4539 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4540 let _ = unsafe { Box::from_raw(self.contents.result) };
4543 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4544 let _ = unsafe { Box::from_raw(self.contents.err) };
4549 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4550 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
4551 let contents = if o.result_ok {
4552 let result = unsafe { o.contents.result };
4553 unsafe { o.contents.result = std::ptr::null_mut() };
4554 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
4556 let err = unsafe { o.contents.err };
4557 unsafe { o.contents.err = std::ptr::null_mut(); }
4558 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
4562 result_ok: o.result_ok,
4568 /// An enum which can either contain a u16 or not
4569 pub enum COption_u16Z {
4570 /// When we're in this state, this COption_u16Z contains a u16
4572 /// When we're in this state, this COption_u16Z contains nothing
4576 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4577 if let Self::Some(_) = self { true } else { false }
4579 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4582 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
4583 if let Self::Some(v) = self { v } else { unreachable!() }
4587 /// Constructs a new COption_u16Z containing a u16
4588 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
4589 COption_u16Z::Some(o)
4592 /// Constructs a new COption_u16Z containing nothing
4593 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
4597 /// Frees any resources associated with the u16, if we are in the Some state
4598 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
4600 /// Creates a new COption_u16Z which has the same data as `orig`
4601 /// but with all dynamically-allocated buffers duplicated in new buffers.
4602 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
4604 /// The contents of CResult_NoneAPIErrorZ
4605 pub union CResult_NoneAPIErrorZPtr {
4606 /// Note that this value is always NULL, as there are no contents in the OK variant
4607 pub result: *mut std::ffi::c_void,
4608 /// A pointer to the contents in the error state.
4609 /// Reading from this pointer when `result_ok` is set is undefined.
4610 pub err: *mut crate::lightning::util::errors::APIError,
4613 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4614 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4616 pub struct CResult_NoneAPIErrorZ {
4617 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4618 /// `err` or `result` depending on the state of `result_ok`.
4619 pub contents: CResult_NoneAPIErrorZPtr,
4620 /// Whether this CResult_NoneAPIErrorZ represents a success state.
4621 pub result_ok: bool,
4624 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4625 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4626 CResult_NoneAPIErrorZ {
4627 contents: CResult_NoneAPIErrorZPtr {
4628 result: std::ptr::null_mut(),
4634 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4635 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4636 CResult_NoneAPIErrorZ {
4637 contents: CResult_NoneAPIErrorZPtr {
4638 err: Box::into_raw(Box::new(e)),
4644 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4645 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4646 impl Drop for CResult_NoneAPIErrorZ {
4647 fn drop(&mut self) {
4650 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4651 let _ = unsafe { Box::from_raw(self.contents.err) };
4656 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4657 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4658 let contents = if o.result_ok {
4659 let _ = unsafe { Box::from_raw(o.contents.result) };
4660 o.contents.result = std::ptr::null_mut();
4661 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4663 let err = unsafe { o.contents.err };
4664 unsafe { o.contents.err = std::ptr::null_mut(); }
4665 CResult_NoneAPIErrorZPtr { err }
4669 result_ok: o.result_ok,
4673 impl Clone for CResult_NoneAPIErrorZ {
4674 fn clone(&self) -> Self {
4676 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4677 result: std::ptr::null_mut()
4680 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4681 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4687 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4688 /// but with all dynamically-allocated buffers duplicated in new buffers.
4689 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
4691 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4692 /// This corresponds to std::vector in C++
4693 pub struct CVec_CResult_NoneAPIErrorZZ {
4694 /// The elements in the array.
4695 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4696 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4697 /// The number of elements pointed to by `data`.
4700 impl CVec_CResult_NoneAPIErrorZZ {
4701 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4702 if self.datalen == 0 { return Vec::new(); }
4703 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4704 self.data = std::ptr::null_mut();
4708 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4709 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4712 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4713 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4714 let datalen = v.len();
4715 let data = Box::into_raw(v.into_boxed_slice());
4716 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4720 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4721 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4722 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4723 fn drop(&mut self) {
4724 if self.datalen == 0 { return; }
4725 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4728 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4729 fn clone(&self) -> Self {
4730 let mut res = Vec::new();
4731 if self.datalen == 0 { return Self::from(res); }
4732 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4737 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4738 /// This corresponds to std::vector in C++
4739 pub struct CVec_APIErrorZ {
4740 /// The elements in the array.
4741 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4742 pub data: *mut crate::lightning::util::errors::APIError,
4743 /// The number of elements pointed to by `data`.
4746 impl CVec_APIErrorZ {
4747 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4748 if self.datalen == 0 { return Vec::new(); }
4749 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4750 self.data = std::ptr::null_mut();
4754 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4755 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4758 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4759 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4760 let datalen = v.len();
4761 let data = Box::into_raw(v.into_boxed_slice());
4762 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4766 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4767 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4768 impl Drop for CVec_APIErrorZ {
4769 fn drop(&mut self) {
4770 if self.datalen == 0 { return; }
4771 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4774 impl Clone for CVec_APIErrorZ {
4775 fn clone(&self) -> Self {
4776 let mut res = Vec::new();
4777 if self.datalen == 0 { return Self::from(res); }
4778 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4783 /// The contents of CResult__u832APIErrorZ
4784 pub union CResult__u832APIErrorZPtr {
4785 /// A pointer to the contents in the success state.
4786 /// Reading from this pointer when `result_ok` is not set is undefined.
4787 pub result: *mut crate::c_types::ThirtyTwoBytes,
4788 /// A pointer to the contents in the error state.
4789 /// Reading from this pointer when `result_ok` is set is undefined.
4790 pub err: *mut crate::lightning::util::errors::APIError,
4793 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
4794 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4795 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4796 pub struct CResult__u832APIErrorZ {
4797 /// The contents of this CResult__u832APIErrorZ, accessible via either
4798 /// `err` or `result` depending on the state of `result_ok`.
4799 pub contents: CResult__u832APIErrorZPtr,
4800 /// Whether this CResult__u832APIErrorZ represents a success state.
4801 pub result_ok: bool,
4804 /// Creates a new CResult__u832APIErrorZ in the success state.
4805 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
4806 CResult__u832APIErrorZ {
4807 contents: CResult__u832APIErrorZPtr {
4808 result: Box::into_raw(Box::new(o)),
4814 /// Creates a new CResult__u832APIErrorZ in the error state.
4815 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
4816 CResult__u832APIErrorZ {
4817 contents: CResult__u832APIErrorZPtr {
4818 err: Box::into_raw(Box::new(e)),
4824 /// Frees any resources used by the CResult__u832APIErrorZ.
4825 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
4826 impl Drop for CResult__u832APIErrorZ {
4827 fn drop(&mut self) {
4829 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4830 let _ = unsafe { Box::from_raw(self.contents.result) };
4833 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4834 let _ = unsafe { Box::from_raw(self.contents.err) };
4839 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
4840 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4841 let contents = if o.result_ok {
4842 let result = unsafe { o.contents.result };
4843 unsafe { o.contents.result = std::ptr::null_mut() };
4844 CResult__u832APIErrorZPtr { result }
4846 let err = unsafe { o.contents.err };
4847 unsafe { o.contents.err = std::ptr::null_mut(); }
4848 CResult__u832APIErrorZPtr { err }
4852 result_ok: o.result_ok,
4856 impl Clone for CResult__u832APIErrorZ {
4857 fn clone(&self) -> Self {
4859 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
4860 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4863 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
4864 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4870 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
4871 /// but with all dynamically-allocated buffers duplicated in new buffers.
4872 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
4874 /// The contents of CResult_PaymentIdPaymentSendFailureZ
4875 pub union CResult_PaymentIdPaymentSendFailureZPtr {
4876 /// A pointer to the contents in the success state.
4877 /// Reading from this pointer when `result_ok` is not set is undefined.
4878 pub result: *mut crate::c_types::ThirtyTwoBytes,
4879 /// A pointer to the contents in the error state.
4880 /// Reading from this pointer when `result_ok` is set is undefined.
4881 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4884 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
4885 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4887 pub struct CResult_PaymentIdPaymentSendFailureZ {
4888 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
4889 /// `err` or `result` depending on the state of `result_ok`.
4890 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
4891 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
4892 pub result_ok: bool,
4895 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
4896 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
4897 CResult_PaymentIdPaymentSendFailureZ {
4898 contents: CResult_PaymentIdPaymentSendFailureZPtr {
4899 result: Box::into_raw(Box::new(o)),
4905 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
4906 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
4907 CResult_PaymentIdPaymentSendFailureZ {
4908 contents: CResult_PaymentIdPaymentSendFailureZPtr {
4909 err: Box::into_raw(Box::new(e)),
4915 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
4916 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
4917 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
4918 fn drop(&mut self) {
4920 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4921 let _ = unsafe { Box::from_raw(self.contents.result) };
4924 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4925 let _ = unsafe { Box::from_raw(self.contents.err) };
4930 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
4931 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4932 let contents = if o.result_ok {
4933 let result = unsafe { o.contents.result };
4934 unsafe { o.contents.result = std::ptr::null_mut() };
4935 CResult_PaymentIdPaymentSendFailureZPtr { result }
4937 let err = unsafe { o.contents.err };
4938 unsafe { o.contents.err = std::ptr::null_mut(); }
4939 CResult_PaymentIdPaymentSendFailureZPtr { err }
4943 result_ok: o.result_ok,
4947 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
4948 fn clone(&self) -> Self {
4950 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
4951 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4954 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
4955 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4961 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
4962 /// but with all dynamically-allocated buffers duplicated in new buffers.
4963 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
4965 /// The contents of CResult_NonePaymentSendFailureZ
4966 pub union CResult_NonePaymentSendFailureZPtr {
4967 /// Note that this value is always NULL, as there are no contents in the OK variant
4968 pub result: *mut std::ffi::c_void,
4969 /// A pointer to the contents in the error state.
4970 /// Reading from this pointer when `result_ok` is set is undefined.
4971 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4974 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4975 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4977 pub struct CResult_NonePaymentSendFailureZ {
4978 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4979 /// `err` or `result` depending on the state of `result_ok`.
4980 pub contents: CResult_NonePaymentSendFailureZPtr,
4981 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4982 pub result_ok: bool,
4985 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4986 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4987 CResult_NonePaymentSendFailureZ {
4988 contents: CResult_NonePaymentSendFailureZPtr {
4989 result: std::ptr::null_mut(),
4995 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4996 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4997 CResult_NonePaymentSendFailureZ {
4998 contents: CResult_NonePaymentSendFailureZPtr {
4999 err: Box::into_raw(Box::new(e)),
5005 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5006 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5007 impl Drop for CResult_NonePaymentSendFailureZ {
5008 fn drop(&mut self) {
5011 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5012 let _ = unsafe { Box::from_raw(self.contents.err) };
5017 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5018 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5019 let contents = if o.result_ok {
5020 let _ = unsafe { Box::from_raw(o.contents.result) };
5021 o.contents.result = std::ptr::null_mut();
5022 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
5024 let err = unsafe { o.contents.err };
5025 unsafe { o.contents.err = std::ptr::null_mut(); }
5026 CResult_NonePaymentSendFailureZPtr { err }
5030 result_ok: o.result_ok,
5034 impl Clone for CResult_NonePaymentSendFailureZ {
5035 fn clone(&self) -> Self {
5037 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5038 result: std::ptr::null_mut()
5041 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5042 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5048 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5049 /// but with all dynamically-allocated buffers duplicated in new buffers.
5050 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5052 /// A tuple of 2 elements. See the individual fields for the types contained.
5053 pub struct C2Tuple_PaymentHashPaymentIdZ {
5054 /// The element at position 0
5055 pub a: crate::c_types::ThirtyTwoBytes,
5056 /// The element at position 1
5057 pub b: crate::c_types::ThirtyTwoBytes,
5059 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5060 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5067 impl C2Tuple_PaymentHashPaymentIdZ {
5068 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5072 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5073 fn clone(&self) -> Self {
5075 a: Clone::clone(&self.a),
5076 b: Clone::clone(&self.b),
5081 /// Creates a new tuple which has the same data as `orig`
5082 /// but with all dynamically-allocated buffers duplicated in new buffers.
5083 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5084 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5086 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5087 C2Tuple_PaymentHashPaymentIdZ { a, b, }
5091 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5092 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5094 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5095 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5096 /// A pointer to the contents in the success state.
5097 /// Reading from this pointer when `result_ok` is not set is undefined.
5098 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5099 /// A pointer to the contents in the error state.
5100 /// Reading from this pointer when `result_ok` is set is undefined.
5101 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5104 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5105 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5107 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5108 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5109 /// `err` or `result` depending on the state of `result_ok`.
5110 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5111 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5112 pub result_ok: bool,
5115 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5116 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5117 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5118 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5119 result: Box::into_raw(Box::new(o)),
5125 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5126 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5127 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5128 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5129 err: Box::into_raw(Box::new(e)),
5135 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5136 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5137 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5138 fn drop(&mut self) {
5140 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5141 let _ = unsafe { Box::from_raw(self.contents.result) };
5144 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5145 let _ = unsafe { Box::from_raw(self.contents.err) };
5150 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5151 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5152 let contents = if o.result_ok {
5153 let result = unsafe { o.contents.result };
5154 unsafe { o.contents.result = std::ptr::null_mut() };
5155 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5157 let err = unsafe { o.contents.err };
5158 unsafe { o.contents.err = std::ptr::null_mut(); }
5159 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5163 result_ok: o.result_ok,
5167 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5168 fn clone(&self) -> Self {
5170 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5171 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5174 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5175 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5181 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5182 /// but with all dynamically-allocated buffers duplicated in new buffers.
5183 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5185 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5186 /// This corresponds to std::vector in C++
5187 pub struct CVec_NetAddressZ {
5188 /// The elements in the array.
5189 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5190 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5191 /// The number of elements pointed to by `data`.
5194 impl CVec_NetAddressZ {
5195 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5196 if self.datalen == 0 { return Vec::new(); }
5197 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5198 self.data = std::ptr::null_mut();
5202 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5203 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5206 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5207 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5208 let datalen = v.len();
5209 let data = Box::into_raw(v.into_boxed_slice());
5210 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5214 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5215 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5216 impl Drop for CVec_NetAddressZ {
5217 fn drop(&mut self) {
5218 if self.datalen == 0 { return; }
5219 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5222 impl Clone for CVec_NetAddressZ {
5223 fn clone(&self) -> Self {
5224 let mut res = Vec::new();
5225 if self.datalen == 0 { return Self::from(res); }
5226 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5231 /// A tuple of 2 elements. See the individual fields for the types contained.
5232 pub struct C2Tuple_PaymentHashPaymentSecretZ {
5233 /// The element at position 0
5234 pub a: crate::c_types::ThirtyTwoBytes,
5235 /// The element at position 1
5236 pub b: crate::c_types::ThirtyTwoBytes,
5238 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
5239 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5246 impl C2Tuple_PaymentHashPaymentSecretZ {
5247 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5251 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
5252 fn clone(&self) -> Self {
5254 a: Clone::clone(&self.a),
5255 b: Clone::clone(&self.b),
5260 /// Creates a new tuple which has the same data as `orig`
5261 /// but with all dynamically-allocated buffers duplicated in new buffers.
5262 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
5263 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
5265 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
5266 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
5270 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
5271 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
5273 /// The contents of CResult_PaymentSecretAPIErrorZ
5274 pub union CResult_PaymentSecretAPIErrorZPtr {
5275 /// A pointer to the contents in the success state.
5276 /// Reading from this pointer when `result_ok` is not set is undefined.
5277 pub result: *mut crate::c_types::ThirtyTwoBytes,
5278 /// A pointer to the contents in the error state.
5279 /// Reading from this pointer when `result_ok` is set is undefined.
5280 pub err: *mut crate::lightning::util::errors::APIError,
5283 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
5284 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5286 pub struct CResult_PaymentSecretAPIErrorZ {
5287 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
5288 /// `err` or `result` depending on the state of `result_ok`.
5289 pub contents: CResult_PaymentSecretAPIErrorZPtr,
5290 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
5291 pub result_ok: bool,
5294 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
5295 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
5296 CResult_PaymentSecretAPIErrorZ {
5297 contents: CResult_PaymentSecretAPIErrorZPtr {
5298 result: Box::into_raw(Box::new(o)),
5304 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
5305 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
5306 CResult_PaymentSecretAPIErrorZ {
5307 contents: CResult_PaymentSecretAPIErrorZPtr {
5308 err: Box::into_raw(Box::new(e)),
5314 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
5315 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
5316 impl Drop for CResult_PaymentSecretAPIErrorZ {
5317 fn drop(&mut self) {
5319 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5320 let _ = unsafe { Box::from_raw(self.contents.result) };
5323 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5324 let _ = unsafe { Box::from_raw(self.contents.err) };
5329 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
5330 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5331 let contents = if o.result_ok {
5332 let result = unsafe { o.contents.result };
5333 unsafe { o.contents.result = std::ptr::null_mut() };
5334 CResult_PaymentSecretAPIErrorZPtr { result }
5336 let err = unsafe { o.contents.err };
5337 unsafe { o.contents.err = std::ptr::null_mut(); }
5338 CResult_PaymentSecretAPIErrorZPtr { err }
5342 result_ok: o.result_ok,
5346 impl Clone for CResult_PaymentSecretAPIErrorZ {
5347 fn clone(&self) -> Self {
5349 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
5350 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5353 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
5354 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5360 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
5361 /// but with all dynamically-allocated buffers duplicated in new buffers.
5362 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
5364 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
5365 /// This corresponds to std::vector in C++
5366 pub struct CVec_ChannelMonitorZ {
5367 /// The elements in the array.
5368 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5369 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
5370 /// The number of elements pointed to by `data`.
5373 impl CVec_ChannelMonitorZ {
5374 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
5375 if self.datalen == 0 { return Vec::new(); }
5376 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5377 self.data = std::ptr::null_mut();
5381 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
5382 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5385 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
5386 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
5387 let datalen = v.len();
5388 let data = Box::into_raw(v.into_boxed_slice());
5389 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5393 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5394 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
5395 impl Drop for CVec_ChannelMonitorZ {
5396 fn drop(&mut self) {
5397 if self.datalen == 0 { return; }
5398 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5402 /// A tuple of 2 elements. See the individual fields for the types contained.
5403 pub struct C2Tuple_BlockHashChannelManagerZ {
5404 /// The element at position 0
5405 pub a: crate::c_types::ThirtyTwoBytes,
5406 /// The element at position 1
5407 pub b: crate::lightning::ln::channelmanager::ChannelManager,
5409 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
5410 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
5417 impl C2Tuple_BlockHashChannelManagerZ {
5418 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
5422 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
5424 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
5425 C2Tuple_BlockHashChannelManagerZ { a, b, }
5429 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
5430 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
5432 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5433 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5434 /// A pointer to the contents in the success state.
5435 /// Reading from this pointer when `result_ok` is not set is undefined.
5436 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
5437 /// A pointer to the contents in the error state.
5438 /// Reading from this pointer when `result_ok` is set is undefined.
5439 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5442 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5443 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5445 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5446 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5447 /// `err` or `result` depending on the state of `result_ok`.
5448 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
5449 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5450 pub result_ok: bool,
5453 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
5454 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5455 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5456 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5457 result: Box::into_raw(Box::new(o)),
5463 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
5464 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5465 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5466 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5467 err: Box::into_raw(Box::new(e)),
5473 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
5474 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
5475 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5476 fn drop(&mut self) {
5478 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5479 let _ = unsafe { Box::from_raw(self.contents.result) };
5482 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5483 let _ = unsafe { Box::from_raw(self.contents.err) };
5488 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5489 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5490 let contents = if o.result_ok {
5491 let result = unsafe { o.contents.result };
5492 unsafe { o.contents.result = std::ptr::null_mut() };
5493 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
5495 let err = unsafe { o.contents.err };
5496 unsafe { o.contents.err = std::ptr::null_mut(); }
5497 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
5501 result_ok: o.result_ok,
5506 /// The contents of CResult_ChannelConfigDecodeErrorZ
5507 pub union CResult_ChannelConfigDecodeErrorZPtr {
5508 /// A pointer to the contents in the success state.
5509 /// Reading from this pointer when `result_ok` is not set is undefined.
5510 pub result: *mut crate::lightning::util::config::ChannelConfig,
5511 /// A pointer to the contents in the error state.
5512 /// Reading from this pointer when `result_ok` is set is undefined.
5513 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5516 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5517 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5518 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5519 pub struct CResult_ChannelConfigDecodeErrorZ {
5520 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5521 /// `err` or `result` depending on the state of `result_ok`.
5522 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
5523 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5524 pub result_ok: bool,
5527 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
5528 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
5529 CResult_ChannelConfigDecodeErrorZ {
5530 contents: CResult_ChannelConfigDecodeErrorZPtr {
5531 result: Box::into_raw(Box::new(o)),
5537 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
5538 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
5539 CResult_ChannelConfigDecodeErrorZ {
5540 contents: CResult_ChannelConfigDecodeErrorZPtr {
5541 err: Box::into_raw(Box::new(e)),
5547 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
5548 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
5549 impl Drop for CResult_ChannelConfigDecodeErrorZ {
5550 fn drop(&mut self) {
5552 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5553 let _ = unsafe { Box::from_raw(self.contents.result) };
5556 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5557 let _ = unsafe { Box::from_raw(self.contents.err) };
5562 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
5563 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
5564 let contents = if o.result_ok {
5565 let result = unsafe { o.contents.result };
5566 unsafe { o.contents.result = std::ptr::null_mut() };
5567 CResult_ChannelConfigDecodeErrorZPtr { result }
5569 let err = unsafe { o.contents.err };
5570 unsafe { o.contents.err = std::ptr::null_mut(); }
5571 CResult_ChannelConfigDecodeErrorZPtr { err }
5575 result_ok: o.result_ok,
5579 impl Clone for CResult_ChannelConfigDecodeErrorZ {
5580 fn clone(&self) -> Self {
5582 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
5583 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
5586 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
5587 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5593 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
5594 /// but with all dynamically-allocated buffers duplicated in new buffers.
5595 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
5597 /// The contents of CResult_OutPointDecodeErrorZ
5598 pub union CResult_OutPointDecodeErrorZPtr {
5599 /// A pointer to the contents in the success state.
5600 /// Reading from this pointer when `result_ok` is not set is undefined.
5601 pub result: *mut crate::lightning::chain::transaction::OutPoint,
5602 /// A pointer to the contents in the error state.
5603 /// Reading from this pointer when `result_ok` is set is undefined.
5604 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5607 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5608 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5609 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5610 pub struct CResult_OutPointDecodeErrorZ {
5611 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5612 /// `err` or `result` depending on the state of `result_ok`.
5613 pub contents: CResult_OutPointDecodeErrorZPtr,
5614 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
5615 pub result_ok: bool,
5618 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
5619 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
5620 CResult_OutPointDecodeErrorZ {
5621 contents: CResult_OutPointDecodeErrorZPtr {
5622 result: Box::into_raw(Box::new(o)),
5628 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
5629 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
5630 CResult_OutPointDecodeErrorZ {
5631 contents: CResult_OutPointDecodeErrorZPtr {
5632 err: Box::into_raw(Box::new(e)),
5638 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
5639 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
5640 impl Drop for CResult_OutPointDecodeErrorZ {
5641 fn drop(&mut self) {
5643 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5644 let _ = unsafe { Box::from_raw(self.contents.result) };
5647 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5648 let _ = unsafe { Box::from_raw(self.contents.err) };
5653 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
5654 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5655 let contents = if o.result_ok {
5656 let result = unsafe { o.contents.result };
5657 unsafe { o.contents.result = std::ptr::null_mut() };
5658 CResult_OutPointDecodeErrorZPtr { result }
5660 let err = unsafe { o.contents.err };
5661 unsafe { o.contents.err = std::ptr::null_mut(); }
5662 CResult_OutPointDecodeErrorZPtr { err }
5666 result_ok: o.result_ok,
5670 impl Clone for CResult_OutPointDecodeErrorZ {
5671 fn clone(&self) -> Self {
5673 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
5674 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
5677 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
5678 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5684 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
5685 /// but with all dynamically-allocated buffers duplicated in new buffers.
5686 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
5688 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
5689 pub enum COption_TypeZ {
5690 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5691 Some(crate::lightning::ln::wire::Type),
5692 /// When we're in this state, this COption_TypeZ contains nothing
5695 impl COption_TypeZ {
5696 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5697 if let Self::Some(_) = self { true } else { false }
5699 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5702 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
5703 if let Self::Some(v) = self { v } else { unreachable!() }
5707 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
5708 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
5709 COption_TypeZ::Some(o)
5712 /// Constructs a new COption_TypeZ containing nothing
5713 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
5717 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
5718 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
5720 /// The contents of CResult_COption_TypeZDecodeErrorZ
5721 pub union CResult_COption_TypeZDecodeErrorZPtr {
5722 /// A pointer to the contents in the success state.
5723 /// Reading from this pointer when `result_ok` is not set is undefined.
5724 pub result: *mut crate::c_types::derived::COption_TypeZ,
5725 /// A pointer to the contents in the error state.
5726 /// Reading from this pointer when `result_ok` is set is undefined.
5727 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5730 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5731 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5732 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5733 pub struct CResult_COption_TypeZDecodeErrorZ {
5734 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5735 /// `err` or `result` depending on the state of `result_ok`.
5736 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
5737 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5738 pub result_ok: bool,
5741 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
5742 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
5743 CResult_COption_TypeZDecodeErrorZ {
5744 contents: CResult_COption_TypeZDecodeErrorZPtr {
5745 result: Box::into_raw(Box::new(o)),
5751 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
5752 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
5753 CResult_COption_TypeZDecodeErrorZ {
5754 contents: CResult_COption_TypeZDecodeErrorZPtr {
5755 err: Box::into_raw(Box::new(e)),
5761 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
5762 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
5763 impl Drop for CResult_COption_TypeZDecodeErrorZ {
5764 fn drop(&mut self) {
5766 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5767 let _ = unsafe { Box::from_raw(self.contents.result) };
5770 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5771 let _ = unsafe { Box::from_raw(self.contents.err) };
5776 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
5777 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5778 let contents = if o.result_ok {
5779 let result = unsafe { o.contents.result };
5780 unsafe { o.contents.result = std::ptr::null_mut() };
5781 CResult_COption_TypeZDecodeErrorZPtr { result }
5783 let err = unsafe { o.contents.err };
5784 unsafe { o.contents.err = std::ptr::null_mut(); }
5785 CResult_COption_TypeZDecodeErrorZPtr { err }
5789 result_ok: o.result_ok,
5794 /// The contents of CResult_PaymentIdPaymentErrorZ
5795 pub union CResult_PaymentIdPaymentErrorZPtr {
5796 /// A pointer to the contents in the success state.
5797 /// Reading from this pointer when `result_ok` is not set is undefined.
5798 pub result: *mut crate::c_types::ThirtyTwoBytes,
5799 /// A pointer to the contents in the error state.
5800 /// Reading from this pointer when `result_ok` is set is undefined.
5801 pub err: *mut crate::lightning_invoice::payment::PaymentError,
5804 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
5805 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
5806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5807 pub struct CResult_PaymentIdPaymentErrorZ {
5808 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
5809 /// `err` or `result` depending on the state of `result_ok`.
5810 pub contents: CResult_PaymentIdPaymentErrorZPtr,
5811 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
5812 pub result_ok: bool,
5815 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
5816 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
5817 CResult_PaymentIdPaymentErrorZ {
5818 contents: CResult_PaymentIdPaymentErrorZPtr {
5819 result: Box::into_raw(Box::new(o)),
5825 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
5826 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
5827 CResult_PaymentIdPaymentErrorZ {
5828 contents: CResult_PaymentIdPaymentErrorZPtr {
5829 err: Box::into_raw(Box::new(e)),
5835 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
5836 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
5837 impl Drop for CResult_PaymentIdPaymentErrorZ {
5838 fn drop(&mut self) {
5840 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5841 let _ = unsafe { Box::from_raw(self.contents.result) };
5844 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5845 let _ = unsafe { Box::from_raw(self.contents.err) };
5850 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
5851 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
5852 let contents = if o.result_ok {
5853 let result = unsafe { o.contents.result };
5854 unsafe { o.contents.result = std::ptr::null_mut() };
5855 CResult_PaymentIdPaymentErrorZPtr { result }
5857 let err = unsafe { o.contents.err };
5858 unsafe { o.contents.err = std::ptr::null_mut(); }
5859 CResult_PaymentIdPaymentErrorZPtr { err }
5863 result_ok: o.result_ok,
5867 impl Clone for CResult_PaymentIdPaymentErrorZ {
5868 fn clone(&self) -> Self {
5870 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
5871 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5874 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
5875 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
5881 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
5882 /// but with all dynamically-allocated buffers duplicated in new buffers.
5883 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
5885 /// The contents of CResult_SiPrefixNoneZ
5886 pub union CResult_SiPrefixNoneZPtr {
5887 /// A pointer to the contents in the success state.
5888 /// Reading from this pointer when `result_ok` is not set is undefined.
5889 pub result: *mut crate::lightning_invoice::SiPrefix,
5890 /// Note that this value is always NULL, as there are no contents in the Err variant
5891 pub err: *mut std::ffi::c_void,
5894 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5895 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5897 pub struct CResult_SiPrefixNoneZ {
5898 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
5899 /// `err` or `result` depending on the state of `result_ok`.
5900 pub contents: CResult_SiPrefixNoneZPtr,
5901 /// Whether this CResult_SiPrefixNoneZ represents a success state.
5902 pub result_ok: bool,
5905 /// Creates a new CResult_SiPrefixNoneZ in the success state.
5906 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
5907 CResult_SiPrefixNoneZ {
5908 contents: CResult_SiPrefixNoneZPtr {
5909 result: Box::into_raw(Box::new(o)),
5915 /// Creates a new CResult_SiPrefixNoneZ in the error state.
5916 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
5917 CResult_SiPrefixNoneZ {
5918 contents: CResult_SiPrefixNoneZPtr {
5919 err: std::ptr::null_mut(),
5925 /// Frees any resources used by the CResult_SiPrefixNoneZ.
5926 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
5927 impl Drop for CResult_SiPrefixNoneZ {
5928 fn drop(&mut self) {
5930 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5931 let _ = unsafe { Box::from_raw(self.contents.result) };
5937 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
5938 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
5939 let contents = if o.result_ok {
5940 let result = unsafe { o.contents.result };
5941 unsafe { o.contents.result = std::ptr::null_mut() };
5942 CResult_SiPrefixNoneZPtr { result }
5944 let _ = unsafe { Box::from_raw(o.contents.err) };
5945 o.contents.err = std::ptr::null_mut();
5946 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
5950 result_ok: o.result_ok,
5954 impl Clone for CResult_SiPrefixNoneZ {
5955 fn clone(&self) -> Self {
5957 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
5958 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
5961 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
5962 err: std::ptr::null_mut()
5968 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
5969 /// but with all dynamically-allocated buffers duplicated in new buffers.
5970 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
5972 /// The contents of CResult_InvoiceNoneZ
5973 pub union CResult_InvoiceNoneZPtr {
5974 /// A pointer to the contents in the success state.
5975 /// Reading from this pointer when `result_ok` is not set is undefined.
5976 pub result: *mut crate::lightning_invoice::Invoice,
5977 /// Note that this value is always NULL, as there are no contents in the Err variant
5978 pub err: *mut std::ffi::c_void,
5981 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
5982 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
5983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5984 pub struct CResult_InvoiceNoneZ {
5985 /// The contents of this CResult_InvoiceNoneZ, accessible via either
5986 /// `err` or `result` depending on the state of `result_ok`.
5987 pub contents: CResult_InvoiceNoneZPtr,
5988 /// Whether this CResult_InvoiceNoneZ represents a success state.
5989 pub result_ok: bool,
5992 /// Creates a new CResult_InvoiceNoneZ in the success state.
5993 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
5994 CResult_InvoiceNoneZ {
5995 contents: CResult_InvoiceNoneZPtr {
5996 result: Box::into_raw(Box::new(o)),
6002 /// Creates a new CResult_InvoiceNoneZ in the error state.
6003 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
6004 CResult_InvoiceNoneZ {
6005 contents: CResult_InvoiceNoneZPtr {
6006 err: std::ptr::null_mut(),
6012 /// Frees any resources used by the CResult_InvoiceNoneZ.
6013 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
6014 impl Drop for CResult_InvoiceNoneZ {
6015 fn drop(&mut self) {
6017 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6018 let _ = unsafe { Box::from_raw(self.contents.result) };
6024 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
6025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
6026 let contents = if o.result_ok {
6027 let result = unsafe { o.contents.result };
6028 unsafe { o.contents.result = std::ptr::null_mut() };
6029 CResult_InvoiceNoneZPtr { result }
6031 let _ = unsafe { Box::from_raw(o.contents.err) };
6032 o.contents.err = std::ptr::null_mut();
6033 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
6037 result_ok: o.result_ok,
6041 impl Clone for CResult_InvoiceNoneZ {
6042 fn clone(&self) -> Self {
6044 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
6045 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6048 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
6049 err: std::ptr::null_mut()
6055 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
6056 /// but with all dynamically-allocated buffers duplicated in new buffers.
6057 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
6059 /// The contents of CResult_SignedRawInvoiceNoneZ
6060 pub union CResult_SignedRawInvoiceNoneZPtr {
6061 /// A pointer to the contents in the success state.
6062 /// Reading from this pointer when `result_ok` is not set is undefined.
6063 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
6064 /// Note that this value is always NULL, as there are no contents in the Err variant
6065 pub err: *mut std::ffi::c_void,
6068 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
6069 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
6070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6071 pub struct CResult_SignedRawInvoiceNoneZ {
6072 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
6073 /// `err` or `result` depending on the state of `result_ok`.
6074 pub contents: CResult_SignedRawInvoiceNoneZPtr,
6075 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
6076 pub result_ok: bool,
6079 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
6080 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
6081 CResult_SignedRawInvoiceNoneZ {
6082 contents: CResult_SignedRawInvoiceNoneZPtr {
6083 result: Box::into_raw(Box::new(o)),
6089 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
6090 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
6091 CResult_SignedRawInvoiceNoneZ {
6092 contents: CResult_SignedRawInvoiceNoneZPtr {
6093 err: std::ptr::null_mut(),
6099 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
6100 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
6101 impl Drop for CResult_SignedRawInvoiceNoneZ {
6102 fn drop(&mut self) {
6104 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6105 let _ = unsafe { Box::from_raw(self.contents.result) };
6111 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
6112 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> 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_SignedRawInvoiceNoneZPtr { result }
6118 let _ = unsafe { Box::from_raw(o.contents.err) };
6119 o.contents.err = std::ptr::null_mut();
6120 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
6124 result_ok: o.result_ok,
6128 impl Clone for CResult_SignedRawInvoiceNoneZ {
6129 fn clone(&self) -> Self {
6131 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
6132 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
6135 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
6136 err: std::ptr::null_mut()
6142 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
6143 /// but with all dynamically-allocated buffers duplicated in new buffers.
6144 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
6146 /// A tuple of 3 elements. See the individual fields for the types contained.
6147 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6148 /// The element at position 0
6149 pub a: crate::lightning_invoice::RawInvoice,
6150 /// The element at position 1
6151 pub b: crate::c_types::ThirtyTwoBytes,
6152 /// The element at position 2
6153 pub c: crate::lightning_invoice::InvoiceSignature,
6155 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6156 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
6164 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6165 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
6166 (self.a, self.b, self.c)
6169 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6170 fn clone(&self) -> Self {
6172 a: Clone::clone(&self.a),
6173 b: Clone::clone(&self.b),
6174 c: Clone::clone(&self.c),
6179 /// Creates a new tuple which has the same data as `orig`
6180 /// but with all dynamically-allocated buffers duplicated in new buffers.
6181 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
6182 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
6184 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 {
6185 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
6189 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
6190 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
6192 /// The contents of CResult_PayeePubKeyErrorZ
6193 pub union CResult_PayeePubKeyErrorZPtr {
6194 /// A pointer to the contents in the success state.
6195 /// Reading from this pointer when `result_ok` is not set is undefined.
6196 pub result: *mut crate::lightning_invoice::PayeePubKey,
6197 /// A pointer to the contents in the error state.
6198 /// Reading from this pointer when `result_ok` is set is undefined.
6199 pub err: *mut crate::c_types::Secp256k1Error,
6202 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
6203 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
6204 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6205 pub struct CResult_PayeePubKeyErrorZ {
6206 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
6207 /// `err` or `result` depending on the state of `result_ok`.
6208 pub contents: CResult_PayeePubKeyErrorZPtr,
6209 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
6210 pub result_ok: bool,
6213 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
6214 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
6215 CResult_PayeePubKeyErrorZ {
6216 contents: CResult_PayeePubKeyErrorZPtr {
6217 result: Box::into_raw(Box::new(o)),
6223 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
6224 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
6225 CResult_PayeePubKeyErrorZ {
6226 contents: CResult_PayeePubKeyErrorZPtr {
6227 err: Box::into_raw(Box::new(e)),
6233 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
6234 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
6235 impl Drop for CResult_PayeePubKeyErrorZ {
6236 fn drop(&mut self) {
6238 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6239 let _ = unsafe { Box::from_raw(self.contents.result) };
6242 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6243 let _ = unsafe { Box::from_raw(self.contents.err) };
6248 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
6249 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
6250 let contents = if o.result_ok {
6251 let result = unsafe { o.contents.result };
6252 unsafe { o.contents.result = std::ptr::null_mut() };
6253 CResult_PayeePubKeyErrorZPtr { result }
6255 let err = unsafe { o.contents.err };
6256 unsafe { o.contents.err = std::ptr::null_mut(); }
6257 CResult_PayeePubKeyErrorZPtr { err }
6261 result_ok: o.result_ok,
6265 impl Clone for CResult_PayeePubKeyErrorZ {
6266 fn clone(&self) -> Self {
6268 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
6269 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
6272 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
6273 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6279 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
6280 /// but with all dynamically-allocated buffers duplicated in new buffers.
6281 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
6283 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
6284 /// This corresponds to std::vector in C++
6285 pub struct CVec_PrivateRouteZ {
6286 /// The elements in the array.
6287 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6288 pub data: *mut crate::lightning_invoice::PrivateRoute,
6289 /// The number of elements pointed to by `data`.
6292 impl CVec_PrivateRouteZ {
6293 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
6294 if self.datalen == 0 { return Vec::new(); }
6295 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6296 self.data = std::ptr::null_mut();
6300 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
6301 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6304 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
6305 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
6306 let datalen = v.len();
6307 let data = Box::into_raw(v.into_boxed_slice());
6308 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6312 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6313 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
6314 impl Drop for CVec_PrivateRouteZ {
6315 fn drop(&mut self) {
6316 if self.datalen == 0 { return; }
6317 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6320 impl Clone for CVec_PrivateRouteZ {
6321 fn clone(&self) -> Self {
6322 let mut res = Vec::new();
6323 if self.datalen == 0 { return Self::from(res); }
6324 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6329 /// The contents of CResult_PositiveTimestampCreationErrorZ
6330 pub union CResult_PositiveTimestampCreationErrorZPtr {
6331 /// A pointer to the contents in the success state.
6332 /// Reading from this pointer when `result_ok` is not set is undefined.
6333 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
6334 /// A pointer to the contents in the error state.
6335 /// Reading from this pointer when `result_ok` is set is undefined.
6336 pub err: *mut crate::lightning_invoice::CreationError,
6339 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
6340 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
6341 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6342 pub struct CResult_PositiveTimestampCreationErrorZ {
6343 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
6344 /// `err` or `result` depending on the state of `result_ok`.
6345 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
6346 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
6347 pub result_ok: bool,
6350 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
6351 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
6352 CResult_PositiveTimestampCreationErrorZ {
6353 contents: CResult_PositiveTimestampCreationErrorZPtr {
6354 result: Box::into_raw(Box::new(o)),
6360 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
6361 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
6362 CResult_PositiveTimestampCreationErrorZ {
6363 contents: CResult_PositiveTimestampCreationErrorZPtr {
6364 err: Box::into_raw(Box::new(e)),
6370 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
6371 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
6372 impl Drop for CResult_PositiveTimestampCreationErrorZ {
6373 fn drop(&mut self) {
6375 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6376 let _ = unsafe { Box::from_raw(self.contents.result) };
6379 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6380 let _ = unsafe { Box::from_raw(self.contents.err) };
6385 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
6386 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
6387 let contents = if o.result_ok {
6388 let result = unsafe { o.contents.result };
6389 unsafe { o.contents.result = std::ptr::null_mut() };
6390 CResult_PositiveTimestampCreationErrorZPtr { result }
6392 let err = unsafe { o.contents.err };
6393 unsafe { o.contents.err = std::ptr::null_mut(); }
6394 CResult_PositiveTimestampCreationErrorZPtr { err }
6398 result_ok: o.result_ok,
6402 impl Clone for CResult_PositiveTimestampCreationErrorZ {
6403 fn clone(&self) -> Self {
6405 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
6406 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
6409 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
6410 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6416 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
6417 /// but with all dynamically-allocated buffers duplicated in new buffers.
6418 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
6420 /// The contents of CResult_NoneSemanticErrorZ
6421 pub union CResult_NoneSemanticErrorZPtr {
6422 /// Note that this value is always NULL, as there are no contents in the OK variant
6423 pub result: *mut std::ffi::c_void,
6424 /// A pointer to the contents in the error state.
6425 /// Reading from this pointer when `result_ok` is set is undefined.
6426 pub err: *mut crate::lightning_invoice::SemanticError,
6429 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
6430 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
6431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6432 pub struct CResult_NoneSemanticErrorZ {
6433 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
6434 /// `err` or `result` depending on the state of `result_ok`.
6435 pub contents: CResult_NoneSemanticErrorZPtr,
6436 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
6437 pub result_ok: bool,
6440 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
6441 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
6442 CResult_NoneSemanticErrorZ {
6443 contents: CResult_NoneSemanticErrorZPtr {
6444 result: std::ptr::null_mut(),
6450 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
6451 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
6452 CResult_NoneSemanticErrorZ {
6453 contents: CResult_NoneSemanticErrorZPtr {
6454 err: Box::into_raw(Box::new(e)),
6460 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
6461 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
6462 impl Drop for CResult_NoneSemanticErrorZ {
6463 fn drop(&mut self) {
6466 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6467 let _ = unsafe { Box::from_raw(self.contents.err) };
6472 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
6473 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
6474 let contents = if o.result_ok {
6475 let _ = unsafe { Box::from_raw(o.contents.result) };
6476 o.contents.result = std::ptr::null_mut();
6477 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
6479 let err = unsafe { o.contents.err };
6480 unsafe { o.contents.err = std::ptr::null_mut(); }
6481 CResult_NoneSemanticErrorZPtr { err }
6485 result_ok: o.result_ok,
6489 impl Clone for CResult_NoneSemanticErrorZ {
6490 fn clone(&self) -> Self {
6492 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
6493 result: std::ptr::null_mut()
6496 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
6497 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6503 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
6504 /// but with all dynamically-allocated buffers duplicated in new buffers.
6505 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
6507 /// The contents of CResult_InvoiceSemanticErrorZ
6508 pub union CResult_InvoiceSemanticErrorZPtr {
6509 /// A pointer to the contents in the success state.
6510 /// Reading from this pointer when `result_ok` is not set is undefined.
6511 pub result: *mut crate::lightning_invoice::Invoice,
6512 /// A pointer to the contents in the error state.
6513 /// Reading from this pointer when `result_ok` is set is undefined.
6514 pub err: *mut crate::lightning_invoice::SemanticError,
6517 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
6518 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
6519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6520 pub struct CResult_InvoiceSemanticErrorZ {
6521 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
6522 /// `err` or `result` depending on the state of `result_ok`.
6523 pub contents: CResult_InvoiceSemanticErrorZPtr,
6524 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
6525 pub result_ok: bool,
6528 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
6529 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
6530 CResult_InvoiceSemanticErrorZ {
6531 contents: CResult_InvoiceSemanticErrorZPtr {
6532 result: Box::into_raw(Box::new(o)),
6538 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
6539 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
6540 CResult_InvoiceSemanticErrorZ {
6541 contents: CResult_InvoiceSemanticErrorZPtr {
6542 err: Box::into_raw(Box::new(e)),
6548 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
6549 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
6550 impl Drop for CResult_InvoiceSemanticErrorZ {
6551 fn drop(&mut self) {
6553 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6554 let _ = unsafe { Box::from_raw(self.contents.result) };
6557 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6558 let _ = unsafe { Box::from_raw(self.contents.err) };
6563 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
6564 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
6565 let contents = if o.result_ok {
6566 let result = unsafe { o.contents.result };
6567 unsafe { o.contents.result = std::ptr::null_mut() };
6568 CResult_InvoiceSemanticErrorZPtr { result }
6570 let err = unsafe { o.contents.err };
6571 unsafe { o.contents.err = std::ptr::null_mut(); }
6572 CResult_InvoiceSemanticErrorZPtr { err }
6576 result_ok: o.result_ok,
6580 impl Clone for CResult_InvoiceSemanticErrorZ {
6581 fn clone(&self) -> Self {
6583 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
6584 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6587 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
6588 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6594 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
6595 /// but with all dynamically-allocated buffers duplicated in new buffers.
6596 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
6598 /// The contents of CResult_DescriptionCreationErrorZ
6599 pub union CResult_DescriptionCreationErrorZPtr {
6600 /// A pointer to the contents in the success state.
6601 /// Reading from this pointer when `result_ok` is not set is undefined.
6602 pub result: *mut crate::lightning_invoice::Description,
6603 /// A pointer to the contents in the error state.
6604 /// Reading from this pointer when `result_ok` is set is undefined.
6605 pub err: *mut crate::lightning_invoice::CreationError,
6608 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
6609 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
6610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6611 pub struct CResult_DescriptionCreationErrorZ {
6612 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
6613 /// `err` or `result` depending on the state of `result_ok`.
6614 pub contents: CResult_DescriptionCreationErrorZPtr,
6615 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
6616 pub result_ok: bool,
6619 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
6620 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
6621 CResult_DescriptionCreationErrorZ {
6622 contents: CResult_DescriptionCreationErrorZPtr {
6623 result: Box::into_raw(Box::new(o)),
6629 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
6630 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
6631 CResult_DescriptionCreationErrorZ {
6632 contents: CResult_DescriptionCreationErrorZPtr {
6633 err: Box::into_raw(Box::new(e)),
6639 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
6640 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
6641 impl Drop for CResult_DescriptionCreationErrorZ {
6642 fn drop(&mut self) {
6644 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6645 let _ = unsafe { Box::from_raw(self.contents.result) };
6648 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6649 let _ = unsafe { Box::from_raw(self.contents.err) };
6654 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
6655 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
6656 let contents = if o.result_ok {
6657 let result = unsafe { o.contents.result };
6658 unsafe { o.contents.result = std::ptr::null_mut() };
6659 CResult_DescriptionCreationErrorZPtr { result }
6661 let err = unsafe { o.contents.err };
6662 unsafe { o.contents.err = std::ptr::null_mut(); }
6663 CResult_DescriptionCreationErrorZPtr { err }
6667 result_ok: o.result_ok,
6671 impl Clone for CResult_DescriptionCreationErrorZ {
6672 fn clone(&self) -> Self {
6674 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
6675 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
6678 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
6679 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6685 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
6686 /// but with all dynamically-allocated buffers duplicated in new buffers.
6687 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
6689 /// The contents of CResult_ExpiryTimeCreationErrorZ
6690 pub union CResult_ExpiryTimeCreationErrorZPtr {
6691 /// A pointer to the contents in the success state.
6692 /// Reading from this pointer when `result_ok` is not set is undefined.
6693 pub result: *mut crate::lightning_invoice::ExpiryTime,
6694 /// A pointer to the contents in the error state.
6695 /// Reading from this pointer when `result_ok` is set is undefined.
6696 pub err: *mut crate::lightning_invoice::CreationError,
6699 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6700 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6702 pub struct CResult_ExpiryTimeCreationErrorZ {
6703 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6704 /// `err` or `result` depending on the state of `result_ok`.
6705 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
6706 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6707 pub result_ok: bool,
6710 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
6711 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
6712 CResult_ExpiryTimeCreationErrorZ {
6713 contents: CResult_ExpiryTimeCreationErrorZPtr {
6714 result: Box::into_raw(Box::new(o)),
6720 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
6721 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
6722 CResult_ExpiryTimeCreationErrorZ {
6723 contents: CResult_ExpiryTimeCreationErrorZPtr {
6724 err: Box::into_raw(Box::new(e)),
6730 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
6731 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
6732 impl Drop for CResult_ExpiryTimeCreationErrorZ {
6733 fn drop(&mut self) {
6735 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6736 let _ = unsafe { Box::from_raw(self.contents.result) };
6739 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6740 let _ = unsafe { Box::from_raw(self.contents.err) };
6745 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
6746 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
6747 let contents = if o.result_ok {
6748 let result = unsafe { o.contents.result };
6749 unsafe { o.contents.result = std::ptr::null_mut() };
6750 CResult_ExpiryTimeCreationErrorZPtr { result }
6752 let err = unsafe { o.contents.err };
6753 unsafe { o.contents.err = std::ptr::null_mut(); }
6754 CResult_ExpiryTimeCreationErrorZPtr { err }
6758 result_ok: o.result_ok,
6762 impl Clone for CResult_ExpiryTimeCreationErrorZ {
6763 fn clone(&self) -> Self {
6765 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
6766 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
6769 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
6770 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6776 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
6777 /// but with all dynamically-allocated buffers duplicated in new buffers.
6778 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
6780 /// The contents of CResult_PrivateRouteCreationErrorZ
6781 pub union CResult_PrivateRouteCreationErrorZPtr {
6782 /// A pointer to the contents in the success state.
6783 /// Reading from this pointer when `result_ok` is not set is undefined.
6784 pub result: *mut crate::lightning_invoice::PrivateRoute,
6785 /// A pointer to the contents in the error state.
6786 /// Reading from this pointer when `result_ok` is set is undefined.
6787 pub err: *mut crate::lightning_invoice::CreationError,
6790 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6791 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6793 pub struct CResult_PrivateRouteCreationErrorZ {
6794 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6795 /// `err` or `result` depending on the state of `result_ok`.
6796 pub contents: CResult_PrivateRouteCreationErrorZPtr,
6797 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6798 pub result_ok: bool,
6801 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
6802 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
6803 CResult_PrivateRouteCreationErrorZ {
6804 contents: CResult_PrivateRouteCreationErrorZPtr {
6805 result: Box::into_raw(Box::new(o)),
6811 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
6812 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
6813 CResult_PrivateRouteCreationErrorZ {
6814 contents: CResult_PrivateRouteCreationErrorZPtr {
6815 err: Box::into_raw(Box::new(e)),
6821 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
6822 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
6823 impl Drop for CResult_PrivateRouteCreationErrorZ {
6824 fn drop(&mut self) {
6826 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6827 let _ = unsafe { Box::from_raw(self.contents.result) };
6830 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6831 let _ = unsafe { Box::from_raw(self.contents.err) };
6836 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
6837 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
6838 let contents = if o.result_ok {
6839 let result = unsafe { o.contents.result };
6840 unsafe { o.contents.result = std::ptr::null_mut() };
6841 CResult_PrivateRouteCreationErrorZPtr { result }
6843 let err = unsafe { o.contents.err };
6844 unsafe { o.contents.err = std::ptr::null_mut(); }
6845 CResult_PrivateRouteCreationErrorZPtr { err }
6849 result_ok: o.result_ok,
6853 impl Clone for CResult_PrivateRouteCreationErrorZ {
6854 fn clone(&self) -> Self {
6856 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
6857 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
6860 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
6861 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6867 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
6868 /// but with all dynamically-allocated buffers duplicated in new buffers.
6869 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
6871 /// The contents of CResult_StringErrorZ
6872 pub union CResult_StringErrorZPtr {
6873 /// A pointer to the contents in the success state.
6874 /// Reading from this pointer when `result_ok` is not set is undefined.
6875 pub result: *mut crate::c_types::Str,
6876 /// A pointer to the contents in the error state.
6877 /// Reading from this pointer when `result_ok` is set is undefined.
6878 pub err: *mut crate::c_types::Secp256k1Error,
6881 /// A CResult_StringErrorZ represents the result of a fallible operation,
6882 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6883 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6884 pub struct CResult_StringErrorZ {
6885 /// The contents of this CResult_StringErrorZ, accessible via either
6886 /// `err` or `result` depending on the state of `result_ok`.
6887 pub contents: CResult_StringErrorZPtr,
6888 /// Whether this CResult_StringErrorZ represents a success state.
6889 pub result_ok: bool,
6892 /// Creates a new CResult_StringErrorZ in the success state.
6893 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
6894 CResult_StringErrorZ {
6895 contents: CResult_StringErrorZPtr {
6896 result: Box::into_raw(Box::new(o)),
6902 /// Creates a new CResult_StringErrorZ in the error state.
6903 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
6904 CResult_StringErrorZ {
6905 contents: CResult_StringErrorZPtr {
6906 err: Box::into_raw(Box::new(e)),
6912 /// Frees any resources used by the CResult_StringErrorZ.
6913 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
6914 impl Drop for CResult_StringErrorZ {
6915 fn drop(&mut self) {
6917 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6918 let _ = unsafe { Box::from_raw(self.contents.result) };
6921 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6922 let _ = unsafe { Box::from_raw(self.contents.err) };
6927 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
6928 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
6929 let contents = if o.result_ok {
6930 let result = unsafe { o.contents.result };
6931 unsafe { o.contents.result = std::ptr::null_mut() };
6932 CResult_StringErrorZPtr { result }
6934 let err = unsafe { o.contents.err };
6935 unsafe { o.contents.err = std::ptr::null_mut(); }
6936 CResult_StringErrorZPtr { err }
6940 result_ok: o.result_ok,
6945 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6946 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6947 /// A pointer to the contents in the success state.
6948 /// Reading from this pointer when `result_ok` is not set is undefined.
6949 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
6950 /// A pointer to the contents in the error state.
6951 /// Reading from this pointer when `result_ok` is set is undefined.
6952 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6955 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6956 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6957 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6958 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
6959 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6960 /// `err` or `result` depending on the state of `result_ok`.
6961 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
6962 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6963 pub result_ok: bool,
6966 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
6967 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6968 CResult_ChannelMonitorUpdateDecodeErrorZ {
6969 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6970 result: Box::into_raw(Box::new(o)),
6976 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
6977 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6978 CResult_ChannelMonitorUpdateDecodeErrorZ {
6979 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6980 err: Box::into_raw(Box::new(e)),
6986 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
6987 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
6988 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
6989 fn drop(&mut self) {
6991 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6992 let _ = unsafe { Box::from_raw(self.contents.result) };
6995 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6996 let _ = unsafe { Box::from_raw(self.contents.err) };
7001 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
7002 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7003 let contents = if o.result_ok {
7004 let result = unsafe { o.contents.result };
7005 unsafe { o.contents.result = std::ptr::null_mut() };
7006 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
7008 let err = unsafe { o.contents.err };
7009 unsafe { o.contents.err = std::ptr::null_mut(); }
7010 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
7014 result_ok: o.result_ok,
7018 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
7019 fn clone(&self) -> Self {
7021 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7022 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
7025 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7026 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7032 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
7033 /// but with all dynamically-allocated buffers duplicated in new buffers.
7034 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
7036 /// The contents of CResult_HTLCUpdateDecodeErrorZ
7037 pub union CResult_HTLCUpdateDecodeErrorZPtr {
7038 /// A pointer to the contents in the success state.
7039 /// Reading from this pointer when `result_ok` is not set is undefined.
7040 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
7041 /// A pointer to the contents in the error state.
7042 /// Reading from this pointer when `result_ok` is set is undefined.
7043 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7046 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7047 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7048 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7049 pub struct CResult_HTLCUpdateDecodeErrorZ {
7050 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7051 /// `err` or `result` depending on the state of `result_ok`.
7052 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
7053 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7054 pub result_ok: bool,
7057 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
7058 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
7059 CResult_HTLCUpdateDecodeErrorZ {
7060 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7061 result: Box::into_raw(Box::new(o)),
7067 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
7068 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
7069 CResult_HTLCUpdateDecodeErrorZ {
7070 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7071 err: Box::into_raw(Box::new(e)),
7077 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
7078 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
7079 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
7080 fn drop(&mut self) {
7082 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7083 let _ = unsafe { Box::from_raw(self.contents.result) };
7086 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7087 let _ = unsafe { Box::from_raw(self.contents.err) };
7092 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
7093 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7094 let contents = if o.result_ok {
7095 let result = unsafe { o.contents.result };
7096 unsafe { o.contents.result = std::ptr::null_mut() };
7097 CResult_HTLCUpdateDecodeErrorZPtr { result }
7099 let err = unsafe { o.contents.err };
7100 unsafe { o.contents.err = std::ptr::null_mut(); }
7101 CResult_HTLCUpdateDecodeErrorZPtr { err }
7105 result_ok: o.result_ok,
7109 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
7110 fn clone(&self) -> Self {
7112 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
7113 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
7116 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
7117 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7123 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
7124 /// but with all dynamically-allocated buffers duplicated in new buffers.
7125 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
7127 /// The contents of CResult_NoneMonitorUpdateErrorZ
7128 pub union CResult_NoneMonitorUpdateErrorZPtr {
7129 /// Note that this value is always NULL, as there are no contents in the OK variant
7130 pub result: *mut std::ffi::c_void,
7131 /// A pointer to the contents in the error state.
7132 /// Reading from this pointer when `result_ok` is set is undefined.
7133 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
7136 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
7137 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
7138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7139 pub struct CResult_NoneMonitorUpdateErrorZ {
7140 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
7141 /// `err` or `result` depending on the state of `result_ok`.
7142 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
7143 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
7144 pub result_ok: bool,
7147 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
7148 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
7149 CResult_NoneMonitorUpdateErrorZ {
7150 contents: CResult_NoneMonitorUpdateErrorZPtr {
7151 result: std::ptr::null_mut(),
7157 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
7158 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
7159 CResult_NoneMonitorUpdateErrorZ {
7160 contents: CResult_NoneMonitorUpdateErrorZPtr {
7161 err: Box::into_raw(Box::new(e)),
7167 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
7168 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
7169 impl Drop for CResult_NoneMonitorUpdateErrorZ {
7170 fn drop(&mut self) {
7173 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7174 let _ = unsafe { Box::from_raw(self.contents.err) };
7179 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
7180 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
7181 let contents = if o.result_ok {
7182 let _ = unsafe { Box::from_raw(o.contents.result) };
7183 o.contents.result = std::ptr::null_mut();
7184 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
7186 let err = unsafe { o.contents.err };
7187 unsafe { o.contents.err = std::ptr::null_mut(); }
7188 CResult_NoneMonitorUpdateErrorZPtr { err }
7192 result_ok: o.result_ok,
7196 impl Clone for CResult_NoneMonitorUpdateErrorZ {
7197 fn clone(&self) -> Self {
7199 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
7200 result: std::ptr::null_mut()
7203 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
7204 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
7210 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
7211 /// but with all dynamically-allocated buffers duplicated in new buffers.
7212 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
7214 /// A tuple of 2 elements. See the individual fields for the types contained.
7215 pub struct C2Tuple_OutPointScriptZ {
7216 /// The element at position 0
7217 pub a: crate::lightning::chain::transaction::OutPoint,
7218 /// The element at position 1
7219 pub b: crate::c_types::derived::CVec_u8Z,
7221 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
7222 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
7229 impl C2Tuple_OutPointScriptZ {
7230 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
7234 impl Clone for C2Tuple_OutPointScriptZ {
7235 fn clone(&self) -> Self {
7237 a: Clone::clone(&self.a),
7238 b: Clone::clone(&self.b),
7243 /// Creates a new tuple which has the same data as `orig`
7244 /// but with all dynamically-allocated buffers duplicated in new buffers.
7245 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
7246 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
7248 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
7249 C2Tuple_OutPointScriptZ { a, b, }
7253 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
7254 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
7256 /// A tuple of 2 elements. See the individual fields for the types contained.
7257 pub struct C2Tuple_u32ScriptZ {
7258 /// The element at position 0
7260 /// The element at position 1
7261 pub b: crate::c_types::derived::CVec_u8Z,
7263 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
7264 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
7271 impl C2Tuple_u32ScriptZ {
7272 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
7276 impl Clone for C2Tuple_u32ScriptZ {
7277 fn clone(&self) -> Self {
7279 a: Clone::clone(&self.a),
7280 b: Clone::clone(&self.b),
7285 /// Creates a new tuple which has the same data as `orig`
7286 /// but with all dynamically-allocated buffers duplicated in new buffers.
7287 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
7288 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
7290 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
7291 C2Tuple_u32ScriptZ { a, b, }
7295 /// Frees any resources used by the C2Tuple_u32ScriptZ.
7296 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
7298 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7299 /// This corresponds to std::vector in C++
7300 pub struct CVec_C2Tuple_u32ScriptZZ {
7301 /// The elements in the array.
7302 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7303 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
7304 /// The number of elements pointed to by `data`.
7307 impl CVec_C2Tuple_u32ScriptZZ {
7308 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
7309 if self.datalen == 0 { return Vec::new(); }
7310 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7311 self.data = std::ptr::null_mut();
7315 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
7316 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7319 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
7320 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
7321 let datalen = v.len();
7322 let data = Box::into_raw(v.into_boxed_slice());
7323 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7327 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7328 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
7329 impl Drop for CVec_C2Tuple_u32ScriptZZ {
7330 fn drop(&mut self) {
7331 if self.datalen == 0 { return; }
7332 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7335 impl Clone for CVec_C2Tuple_u32ScriptZZ {
7336 fn clone(&self) -> Self {
7337 let mut res = Vec::new();
7338 if self.datalen == 0 { return Self::from(res); }
7339 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7344 /// A tuple of 2 elements. See the individual fields for the types contained.
7345 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7346 /// The element at position 0
7347 pub a: crate::c_types::ThirtyTwoBytes,
7348 /// The element at position 1
7349 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
7351 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7352 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
7359 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7360 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
7364 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7365 fn clone(&self) -> Self {
7367 a: Clone::clone(&self.a),
7368 b: Clone::clone(&self.b),
7373 /// Creates a new tuple which has the same data as `orig`
7374 /// but with all dynamically-allocated buffers duplicated in new buffers.
7375 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
7376 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
7378 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 {
7379 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
7383 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
7384 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
7386 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
7387 /// This corresponds to std::vector in C++
7388 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7389 /// The elements in the array.
7390 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7391 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
7392 /// The number of elements pointed to by `data`.
7395 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7396 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
7397 if self.datalen == 0 { return Vec::new(); }
7398 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7399 self.data = std::ptr::null_mut();
7403 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
7404 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7407 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7408 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
7409 let datalen = v.len();
7410 let data = Box::into_raw(v.into_boxed_slice());
7411 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7415 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7416 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
7417 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7418 fn drop(&mut self) {
7419 if self.datalen == 0 { return; }
7420 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7423 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7424 fn clone(&self) -> Self {
7425 let mut res = Vec::new();
7426 if self.datalen == 0 { return Self::from(res); }
7427 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7432 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7433 /// This corresponds to std::vector in C++
7434 pub struct CVec_EventZ {
7435 /// The elements in the array.
7436 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7437 pub data: *mut crate::lightning::util::events::Event,
7438 /// The number of elements pointed to by `data`.
7442 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
7443 if self.datalen == 0 { return Vec::new(); }
7444 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7445 self.data = std::ptr::null_mut();
7449 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
7450 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7453 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
7454 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
7455 let datalen = v.len();
7456 let data = Box::into_raw(v.into_boxed_slice());
7457 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7461 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7462 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
7463 impl Drop for CVec_EventZ {
7464 fn drop(&mut self) {
7465 if self.datalen == 0 { return; }
7466 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7469 impl Clone for CVec_EventZ {
7470 fn clone(&self) -> Self {
7471 let mut res = Vec::new();
7472 if self.datalen == 0 { return Self::from(res); }
7473 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7478 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7479 /// This corresponds to std::vector in C++
7480 pub struct CVec_TransactionZ {
7481 /// The elements in the array.
7482 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7483 pub data: *mut crate::c_types::Transaction,
7484 /// The number of elements pointed to by `data`.
7487 impl CVec_TransactionZ {
7488 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
7489 if self.datalen == 0 { return Vec::new(); }
7490 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7491 self.data = std::ptr::null_mut();
7495 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
7496 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7499 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
7500 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
7501 let datalen = v.len();
7502 let data = Box::into_raw(v.into_boxed_slice());
7503 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7507 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7508 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
7509 impl Drop for CVec_TransactionZ {
7510 fn drop(&mut self) {
7511 if self.datalen == 0 { return; }
7512 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7515 impl Clone for CVec_TransactionZ {
7516 fn clone(&self) -> Self {
7517 let mut res = Vec::new();
7518 if self.datalen == 0 { return Self::from(res); }
7519 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7524 /// A tuple of 2 elements. See the individual fields for the types contained.
7525 pub struct C2Tuple_u32TxOutZ {
7526 /// The element at position 0
7528 /// The element at position 1
7529 pub b: crate::c_types::TxOut,
7531 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
7532 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
7539 impl C2Tuple_u32TxOutZ {
7540 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
7544 impl Clone for C2Tuple_u32TxOutZ {
7545 fn clone(&self) -> Self {
7547 a: Clone::clone(&self.a),
7548 b: Clone::clone(&self.b),
7553 /// Creates a new tuple which has the same data as `orig`
7554 /// but with all dynamically-allocated buffers duplicated in new buffers.
7555 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
7556 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
7558 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
7559 C2Tuple_u32TxOutZ { a, b, }
7563 /// Frees any resources used by the C2Tuple_u32TxOutZ.
7564 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
7566 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7567 /// This corresponds to std::vector in C++
7568 pub struct CVec_C2Tuple_u32TxOutZZ {
7569 /// The elements in the array.
7570 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7571 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
7572 /// The number of elements pointed to by `data`.
7575 impl CVec_C2Tuple_u32TxOutZZ {
7576 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
7577 if self.datalen == 0 { return Vec::new(); }
7578 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7579 self.data = std::ptr::null_mut();
7583 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
7584 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7587 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
7588 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
7589 let datalen = v.len();
7590 let data = Box::into_raw(v.into_boxed_slice());
7591 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7595 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7596 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
7597 impl Drop for CVec_C2Tuple_u32TxOutZZ {
7598 fn drop(&mut self) {
7599 if self.datalen == 0 { return; }
7600 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7603 impl Clone for CVec_C2Tuple_u32TxOutZZ {
7604 fn clone(&self) -> Self {
7605 let mut res = Vec::new();
7606 if self.datalen == 0 { return Self::from(res); }
7607 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7612 /// A tuple of 2 elements. See the individual fields for the types contained.
7613 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7614 /// The element at position 0
7615 pub a: crate::c_types::ThirtyTwoBytes,
7616 /// The element at position 1
7617 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
7619 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7620 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
7627 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7628 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
7632 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7633 fn clone(&self) -> Self {
7635 a: Clone::clone(&self.a),
7636 b: Clone::clone(&self.b),
7641 /// Creates a new tuple which has the same data as `orig`
7642 /// but with all dynamically-allocated buffers duplicated in new buffers.
7643 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
7644 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
7646 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 {
7647 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
7651 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
7652 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
7654 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7655 /// This corresponds to std::vector in C++
7656 pub struct CVec_TransactionOutputsZ {
7657 /// The elements in the array.
7658 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7659 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
7660 /// The number of elements pointed to by `data`.
7663 impl CVec_TransactionOutputsZ {
7664 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
7665 if self.datalen == 0 { return Vec::new(); }
7666 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7667 self.data = std::ptr::null_mut();
7671 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
7672 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7675 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
7676 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
7677 let datalen = v.len();
7678 let data = Box::into_raw(v.into_boxed_slice());
7679 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7683 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7684 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
7685 impl Drop for CVec_TransactionOutputsZ {
7686 fn drop(&mut self) {
7687 if self.datalen == 0 { return; }
7688 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7691 impl Clone for CVec_TransactionOutputsZ {
7692 fn clone(&self) -> Self {
7693 let mut res = Vec::new();
7694 if self.datalen == 0 { return Self::from(res); }
7695 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7700 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7701 /// This corresponds to std::vector in C++
7702 pub struct CVec_BalanceZ {
7703 /// The elements in the array.
7704 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7705 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
7706 /// The number of elements pointed to by `data`.
7709 impl CVec_BalanceZ {
7710 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
7711 if self.datalen == 0 { return Vec::new(); }
7712 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7713 self.data = std::ptr::null_mut();
7717 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
7718 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7721 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
7722 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
7723 let datalen = v.len();
7724 let data = Box::into_raw(v.into_boxed_slice());
7725 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7729 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7730 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
7731 impl Drop for CVec_BalanceZ {
7732 fn drop(&mut self) {
7733 if self.datalen == 0 { return; }
7734 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7737 impl Clone for CVec_BalanceZ {
7738 fn clone(&self) -> Self {
7739 let mut res = Vec::new();
7740 if self.datalen == 0 { return Self::from(res); }
7741 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7746 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7747 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7748 /// A pointer to the contents in the success state.
7749 /// Reading from this pointer when `result_ok` is not set is undefined.
7750 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7751 /// A pointer to the contents in the error state.
7752 /// Reading from this pointer when `result_ok` is set is undefined.
7753 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7756 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7757 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7759 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7760 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7761 /// `err` or `result` depending on the state of `result_ok`.
7762 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
7763 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7764 pub result_ok: bool,
7767 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
7768 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7769 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7770 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7771 result: Box::into_raw(Box::new(o)),
7777 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
7778 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7779 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7780 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7781 err: Box::into_raw(Box::new(e)),
7787 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
7788 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
7789 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7790 fn drop(&mut self) {
7792 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7793 let _ = unsafe { Box::from_raw(self.contents.result) };
7796 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7797 let _ = unsafe { Box::from_raw(self.contents.err) };
7802 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7803 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7804 let contents = if o.result_ok {
7805 let result = unsafe { o.contents.result };
7806 unsafe { o.contents.result = std::ptr::null_mut() };
7807 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
7809 let err = unsafe { o.contents.err };
7810 unsafe { o.contents.err = std::ptr::null_mut(); }
7811 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
7815 result_ok: o.result_ok,
7820 /// The contents of CResult_NoneLightningErrorZ
7821 pub union CResult_NoneLightningErrorZPtr {
7822 /// Note that this value is always NULL, as there are no contents in the OK variant
7823 pub result: *mut std::ffi::c_void,
7824 /// A pointer to the contents in the error state.
7825 /// Reading from this pointer when `result_ok` is set is undefined.
7826 pub err: *mut crate::lightning::ln::msgs::LightningError,
7829 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7830 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7832 pub struct CResult_NoneLightningErrorZ {
7833 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7834 /// `err` or `result` depending on the state of `result_ok`.
7835 pub contents: CResult_NoneLightningErrorZPtr,
7836 /// Whether this CResult_NoneLightningErrorZ represents a success state.
7837 pub result_ok: bool,
7840 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7841 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7842 CResult_NoneLightningErrorZ {
7843 contents: CResult_NoneLightningErrorZPtr {
7844 result: std::ptr::null_mut(),
7850 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7851 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7852 CResult_NoneLightningErrorZ {
7853 contents: CResult_NoneLightningErrorZPtr {
7854 err: Box::into_raw(Box::new(e)),
7860 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7861 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7862 impl Drop for CResult_NoneLightningErrorZ {
7863 fn drop(&mut self) {
7866 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7867 let _ = unsafe { Box::from_raw(self.contents.err) };
7872 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7873 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7874 let contents = if o.result_ok {
7875 let _ = unsafe { Box::from_raw(o.contents.result) };
7876 o.contents.result = std::ptr::null_mut();
7877 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
7879 let err = unsafe { o.contents.err };
7880 unsafe { o.contents.err = std::ptr::null_mut(); }
7881 CResult_NoneLightningErrorZPtr { err }
7885 result_ok: o.result_ok,
7889 impl Clone for CResult_NoneLightningErrorZ {
7890 fn clone(&self) -> Self {
7892 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7893 result: std::ptr::null_mut()
7896 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7897 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7903 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7904 /// but with all dynamically-allocated buffers duplicated in new buffers.
7905 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7907 /// A tuple of 2 elements. See the individual fields for the types contained.
7908 pub struct C2Tuple_PublicKeyTypeZ {
7909 /// The element at position 0
7910 pub a: crate::c_types::PublicKey,
7911 /// The element at position 1
7912 pub b: crate::lightning::ln::wire::Type,
7914 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
7915 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
7922 impl C2Tuple_PublicKeyTypeZ {
7923 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
7927 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
7929 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
7930 C2Tuple_PublicKeyTypeZ { a, b, }
7934 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
7935 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
7937 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7938 /// This corresponds to std::vector in C++
7939 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
7940 /// The elements in the array.
7941 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7942 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
7943 /// The number of elements pointed to by `data`.
7946 impl CVec_C2Tuple_PublicKeyTypeZZ {
7947 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
7948 if self.datalen == 0 { return Vec::new(); }
7949 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7950 self.data = std::ptr::null_mut();
7954 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
7955 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7958 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
7959 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
7960 let datalen = v.len();
7961 let data = Box::into_raw(v.into_boxed_slice());
7962 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7966 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7967 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
7968 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
7969 fn drop(&mut self) {
7970 if self.datalen == 0 { return; }
7971 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7975 /// The contents of CResult_boolLightningErrorZ
7976 pub union CResult_boolLightningErrorZPtr {
7977 /// A pointer to the contents in the success state.
7978 /// Reading from this pointer when `result_ok` is not set is undefined.
7979 pub result: *mut bool,
7980 /// A pointer to the contents in the error state.
7981 /// Reading from this pointer when `result_ok` is set is undefined.
7982 pub err: *mut crate::lightning::ln::msgs::LightningError,
7985 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7986 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7988 pub struct CResult_boolLightningErrorZ {
7989 /// The contents of this CResult_boolLightningErrorZ, accessible via either
7990 /// `err` or `result` depending on the state of `result_ok`.
7991 pub contents: CResult_boolLightningErrorZPtr,
7992 /// Whether this CResult_boolLightningErrorZ represents a success state.
7993 pub result_ok: bool,
7996 /// Creates a new CResult_boolLightningErrorZ in the success state.
7997 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7998 CResult_boolLightningErrorZ {
7999 contents: CResult_boolLightningErrorZPtr {
8000 result: Box::into_raw(Box::new(o)),
8006 /// Creates a new CResult_boolLightningErrorZ in the error state.
8007 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
8008 CResult_boolLightningErrorZ {
8009 contents: CResult_boolLightningErrorZPtr {
8010 err: Box::into_raw(Box::new(e)),
8016 /// Frees any resources used by the CResult_boolLightningErrorZ.
8017 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
8018 impl Drop for CResult_boolLightningErrorZ {
8019 fn drop(&mut self) {
8021 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8022 let _ = unsafe { Box::from_raw(self.contents.result) };
8025 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8026 let _ = unsafe { Box::from_raw(self.contents.err) };
8031 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
8032 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
8033 let contents = if o.result_ok {
8034 let result = unsafe { o.contents.result };
8035 unsafe { o.contents.result = std::ptr::null_mut() };
8036 CResult_boolLightningErrorZPtr { result }
8038 let err = unsafe { o.contents.err };
8039 unsafe { o.contents.err = std::ptr::null_mut(); }
8040 CResult_boolLightningErrorZPtr { err }
8044 result_ok: o.result_ok,
8048 impl Clone for CResult_boolLightningErrorZ {
8049 fn clone(&self) -> Self {
8051 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
8052 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8055 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
8056 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8062 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8063 /// but with all dynamically-allocated buffers duplicated in new buffers.
8064 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
8066 /// A tuple of 3 elements. See the individual fields for the types contained.
8067 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8068 /// The element at position 0
8069 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
8070 /// The element at position 1
8071 pub b: crate::lightning::ln::msgs::ChannelUpdate,
8072 /// The element at position 2
8073 pub c: crate::lightning::ln::msgs::ChannelUpdate,
8075 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8076 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
8084 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8085 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
8086 (self.a, self.b, self.c)
8089 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8090 fn clone(&self) -> Self {
8092 a: Clone::clone(&self.a),
8093 b: Clone::clone(&self.b),
8094 c: Clone::clone(&self.c),
8099 /// Creates a new tuple which has the same data as `orig`
8100 /// but with all dynamically-allocated buffers duplicated in new buffers.
8101 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
8102 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8104 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 {
8105 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
8109 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8110 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
8112 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
8113 /// This corresponds to std::vector in C++
8114 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8115 /// The elements in the array.
8116 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8117 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
8118 /// The number of elements pointed to by `data`.
8121 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8122 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
8123 if self.datalen == 0 { return Vec::new(); }
8124 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8125 self.data = std::ptr::null_mut();
8129 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
8130 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8133 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8134 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
8135 let datalen = v.len();
8136 let data = Box::into_raw(v.into_boxed_slice());
8137 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8141 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8142 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
8143 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8144 fn drop(&mut self) {
8145 if self.datalen == 0 { return; }
8146 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8149 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8150 fn clone(&self) -> Self {
8151 let mut res = Vec::new();
8152 if self.datalen == 0 { return Self::from(res); }
8153 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8158 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
8159 /// This corresponds to std::vector in C++
8160 pub struct CVec_NodeAnnouncementZ {
8161 /// The elements in the array.
8162 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8163 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
8164 /// The number of elements pointed to by `data`.
8167 impl CVec_NodeAnnouncementZ {
8168 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
8169 if self.datalen == 0 { return Vec::new(); }
8170 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8171 self.data = std::ptr::null_mut();
8175 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
8176 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8179 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
8180 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
8181 let datalen = v.len();
8182 let data = Box::into_raw(v.into_boxed_slice());
8183 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8187 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8188 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
8189 impl Drop for CVec_NodeAnnouncementZ {
8190 fn drop(&mut self) {
8191 if self.datalen == 0 { return; }
8192 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8195 impl Clone for CVec_NodeAnnouncementZ {
8196 fn clone(&self) -> Self {
8197 let mut res = Vec::new();
8198 if self.datalen == 0 { return Self::from(res); }
8199 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8204 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
8205 /// This corresponds to std::vector in C++
8206 pub struct CVec_PublicKeyZ {
8207 /// The elements in the array.
8208 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8209 pub data: *mut crate::c_types::PublicKey,
8210 /// The number of elements pointed to by `data`.
8213 impl CVec_PublicKeyZ {
8214 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
8215 if self.datalen == 0 { return Vec::new(); }
8216 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8217 self.data = std::ptr::null_mut();
8221 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
8222 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8225 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
8226 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
8227 let datalen = v.len();
8228 let data = Box::into_raw(v.into_boxed_slice());
8229 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8233 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8234 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
8235 impl Drop for CVec_PublicKeyZ {
8236 fn drop(&mut self) {
8237 if self.datalen == 0 { return; }
8238 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8241 impl Clone for CVec_PublicKeyZ {
8242 fn clone(&self) -> Self {
8243 let mut res = Vec::new();
8244 if self.datalen == 0 { return Self::from(res); }
8245 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8250 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
8251 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
8252 /// A pointer to the contents in the success state.
8253 /// Reading from this pointer when `result_ok` is not set is undefined.
8254 pub result: *mut crate::c_types::derived::CVec_u8Z,
8255 /// A pointer to the contents in the error state.
8256 /// Reading from this pointer when `result_ok` is set is undefined.
8257 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8260 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
8261 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8263 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
8264 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
8265 /// `err` or `result` depending on the state of `result_ok`.
8266 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
8267 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
8268 pub result_ok: bool,
8271 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
8272 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
8273 CResult_CVec_u8ZPeerHandleErrorZ {
8274 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8275 result: Box::into_raw(Box::new(o)),
8281 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
8282 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
8283 CResult_CVec_u8ZPeerHandleErrorZ {
8284 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8285 err: Box::into_raw(Box::new(e)),
8291 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
8292 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
8293 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
8294 fn drop(&mut self) {
8296 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8297 let _ = unsafe { Box::from_raw(self.contents.result) };
8300 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8301 let _ = unsafe { Box::from_raw(self.contents.err) };
8306 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
8307 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8308 let contents = if o.result_ok {
8309 let result = unsafe { o.contents.result };
8310 unsafe { o.contents.result = std::ptr::null_mut() };
8311 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
8313 let err = unsafe { o.contents.err };
8314 unsafe { o.contents.err = std::ptr::null_mut(); }
8315 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
8319 result_ok: o.result_ok,
8323 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
8324 fn clone(&self) -> Self {
8326 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8327 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
8330 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8331 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8337 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
8338 /// but with all dynamically-allocated buffers duplicated in new buffers.
8339 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
8341 /// The contents of CResult_NonePeerHandleErrorZ
8342 pub union CResult_NonePeerHandleErrorZPtr {
8343 /// Note that this value is always NULL, as there are no contents in the OK variant
8344 pub result: *mut std::ffi::c_void,
8345 /// A pointer to the contents in the error state.
8346 /// Reading from this pointer when `result_ok` is set is undefined.
8347 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8350 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
8351 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8352 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8353 pub struct CResult_NonePeerHandleErrorZ {
8354 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
8355 /// `err` or `result` depending on the state of `result_ok`.
8356 pub contents: CResult_NonePeerHandleErrorZPtr,
8357 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
8358 pub result_ok: bool,
8361 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
8362 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
8363 CResult_NonePeerHandleErrorZ {
8364 contents: CResult_NonePeerHandleErrorZPtr {
8365 result: std::ptr::null_mut(),
8371 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
8372 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
8373 CResult_NonePeerHandleErrorZ {
8374 contents: CResult_NonePeerHandleErrorZPtr {
8375 err: Box::into_raw(Box::new(e)),
8381 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
8382 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
8383 impl Drop for CResult_NonePeerHandleErrorZ {
8384 fn drop(&mut self) {
8387 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8388 let _ = unsafe { Box::from_raw(self.contents.err) };
8393 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
8394 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8395 let contents = if o.result_ok {
8396 let _ = unsafe { Box::from_raw(o.contents.result) };
8397 o.contents.result = std::ptr::null_mut();
8398 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
8400 let err = unsafe { o.contents.err };
8401 unsafe { o.contents.err = std::ptr::null_mut(); }
8402 CResult_NonePeerHandleErrorZPtr { err }
8406 result_ok: o.result_ok,
8410 impl Clone for CResult_NonePeerHandleErrorZ {
8411 fn clone(&self) -> Self {
8413 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
8414 result: std::ptr::null_mut()
8417 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
8418 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8424 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8425 /// but with all dynamically-allocated buffers duplicated in new buffers.
8426 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
8428 /// The contents of CResult_boolPeerHandleErrorZ
8429 pub union CResult_boolPeerHandleErrorZPtr {
8430 /// A pointer to the contents in the success state.
8431 /// Reading from this pointer when `result_ok` is not set is undefined.
8432 pub result: *mut bool,
8433 /// A pointer to the contents in the error state.
8434 /// Reading from this pointer when `result_ok` is set is undefined.
8435 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8438 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8439 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8441 pub struct CResult_boolPeerHandleErrorZ {
8442 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8443 /// `err` or `result` depending on the state of `result_ok`.
8444 pub contents: CResult_boolPeerHandleErrorZPtr,
8445 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
8446 pub result_ok: bool,
8449 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
8450 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
8451 CResult_boolPeerHandleErrorZ {
8452 contents: CResult_boolPeerHandleErrorZPtr {
8453 result: Box::into_raw(Box::new(o)),
8459 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
8460 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
8461 CResult_boolPeerHandleErrorZ {
8462 contents: CResult_boolPeerHandleErrorZPtr {
8463 err: Box::into_raw(Box::new(e)),
8469 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
8470 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
8471 impl Drop for CResult_boolPeerHandleErrorZ {
8472 fn drop(&mut self) {
8474 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8475 let _ = unsafe { Box::from_raw(self.contents.result) };
8478 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8479 let _ = unsafe { Box::from_raw(self.contents.err) };
8484 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
8485 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8486 let contents = if o.result_ok {
8487 let result = unsafe { o.contents.result };
8488 unsafe { o.contents.result = std::ptr::null_mut() };
8489 CResult_boolPeerHandleErrorZPtr { result }
8491 let err = unsafe { o.contents.err };
8492 unsafe { o.contents.err = std::ptr::null_mut(); }
8493 CResult_boolPeerHandleErrorZPtr { err }
8497 result_ok: o.result_ok,
8501 impl Clone for CResult_boolPeerHandleErrorZ {
8502 fn clone(&self) -> Self {
8504 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
8505 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8508 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
8509 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8515 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8516 /// but with all dynamically-allocated buffers duplicated in new buffers.
8517 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
8519 /// The contents of CResult_NodeIdDecodeErrorZ
8520 pub union CResult_NodeIdDecodeErrorZPtr {
8521 /// A pointer to the contents in the success state.
8522 /// Reading from this pointer when `result_ok` is not set is undefined.
8523 pub result: *mut crate::lightning::routing::network_graph::NodeId,
8524 /// A pointer to the contents in the error state.
8525 /// Reading from this pointer when `result_ok` is set is undefined.
8526 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8529 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8530 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8532 pub struct CResult_NodeIdDecodeErrorZ {
8533 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8534 /// `err` or `result` depending on the state of `result_ok`.
8535 pub contents: CResult_NodeIdDecodeErrorZPtr,
8536 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8537 pub result_ok: bool,
8540 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
8541 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
8542 CResult_NodeIdDecodeErrorZ {
8543 contents: CResult_NodeIdDecodeErrorZPtr {
8544 result: Box::into_raw(Box::new(o)),
8550 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
8551 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
8552 CResult_NodeIdDecodeErrorZ {
8553 contents: CResult_NodeIdDecodeErrorZPtr {
8554 err: Box::into_raw(Box::new(e)),
8560 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
8561 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
8562 impl Drop for CResult_NodeIdDecodeErrorZ {
8563 fn drop(&mut self) {
8565 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8566 let _ = unsafe { Box::from_raw(self.contents.result) };
8569 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8570 let _ = unsafe { Box::from_raw(self.contents.err) };
8575 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
8576 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
8577 let contents = if o.result_ok {
8578 let result = unsafe { o.contents.result };
8579 unsafe { o.contents.result = std::ptr::null_mut() };
8580 CResult_NodeIdDecodeErrorZPtr { result }
8582 let err = unsafe { o.contents.err };
8583 unsafe { o.contents.err = std::ptr::null_mut(); }
8584 CResult_NodeIdDecodeErrorZPtr { err }
8588 result_ok: o.result_ok,
8592 impl Clone for CResult_NodeIdDecodeErrorZ {
8593 fn clone(&self) -> Self {
8595 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
8596 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
8599 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
8600 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8606 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
8607 /// but with all dynamically-allocated buffers duplicated in new buffers.
8608 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
8610 /// An enum which can either contain a crate::lightning::chain::Access or not
8611 pub enum COption_AccessZ {
8612 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8613 Some(crate::lightning::chain::Access),
8614 /// When we're in this state, this COption_AccessZ contains nothing
8617 impl COption_AccessZ {
8618 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8619 if let Self::Some(_) = self { true } else { false }
8621 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8624 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
8625 if let Self::Some(v) = self { v } else { unreachable!() }
8629 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
8630 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
8631 COption_AccessZ::Some(o)
8634 /// Constructs a new COption_AccessZ containing nothing
8635 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
8636 COption_AccessZ::None
8639 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
8640 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
8642 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
8643 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
8644 /// A pointer to the contents in the success state.
8645 /// Reading from this pointer when `result_ok` is not set is undefined.
8646 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
8647 /// A pointer to the contents in the error state.
8648 /// Reading from this pointer when `result_ok` is set is undefined.
8649 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8652 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
8653 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8655 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
8656 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
8657 /// `err` or `result` depending on the state of `result_ok`.
8658 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
8659 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
8660 pub result_ok: bool,
8663 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8664 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8665 CResult_DirectionalChannelInfoDecodeErrorZ {
8666 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8667 result: Box::into_raw(Box::new(o)),
8673 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8674 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8675 CResult_DirectionalChannelInfoDecodeErrorZ {
8676 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8677 err: Box::into_raw(Box::new(e)),
8683 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8684 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
8685 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
8686 fn drop(&mut self) {
8688 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8689 let _ = unsafe { Box::from_raw(self.contents.result) };
8692 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8693 let _ = unsafe { Box::from_raw(self.contents.err) };
8698 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
8699 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8700 let contents = if o.result_ok {
8701 let result = unsafe { o.contents.result };
8702 unsafe { o.contents.result = std::ptr::null_mut() };
8703 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
8705 let err = unsafe { o.contents.err };
8706 unsafe { o.contents.err = std::ptr::null_mut(); }
8707 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
8711 result_ok: o.result_ok,
8715 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
8716 fn clone(&self) -> Self {
8718 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8719 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
8722 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8723 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8729 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8730 /// but with all dynamically-allocated buffers duplicated in new buffers.
8731 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8733 /// The contents of CResult_ChannelInfoDecodeErrorZ
8734 pub union CResult_ChannelInfoDecodeErrorZPtr {
8735 /// A pointer to the contents in the success state.
8736 /// Reading from this pointer when `result_ok` is not set is undefined.
8737 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
8738 /// A pointer to the contents in the error state.
8739 /// Reading from this pointer when `result_ok` is set is undefined.
8740 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8743 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8744 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8745 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8746 pub struct CResult_ChannelInfoDecodeErrorZ {
8747 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8748 /// `err` or `result` depending on the state of `result_ok`.
8749 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8750 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8751 pub result_ok: bool,
8754 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8755 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8756 CResult_ChannelInfoDecodeErrorZ {
8757 contents: CResult_ChannelInfoDecodeErrorZPtr {
8758 result: Box::into_raw(Box::new(o)),
8764 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8765 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8766 CResult_ChannelInfoDecodeErrorZ {
8767 contents: CResult_ChannelInfoDecodeErrorZPtr {
8768 err: Box::into_raw(Box::new(e)),
8774 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8775 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8776 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8777 fn drop(&mut self) {
8779 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8780 let _ = unsafe { Box::from_raw(self.contents.result) };
8783 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8784 let _ = unsafe { Box::from_raw(self.contents.err) };
8789 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8790 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8791 let contents = if o.result_ok {
8792 let result = unsafe { o.contents.result };
8793 unsafe { o.contents.result = std::ptr::null_mut() };
8794 CResult_ChannelInfoDecodeErrorZPtr { result }
8796 let err = unsafe { o.contents.err };
8797 unsafe { o.contents.err = std::ptr::null_mut(); }
8798 CResult_ChannelInfoDecodeErrorZPtr { err }
8802 result_ok: o.result_ok,
8806 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8807 fn clone(&self) -> Self {
8809 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8810 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8813 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8814 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8820 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8821 /// but with all dynamically-allocated buffers duplicated in new buffers.
8822 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8824 /// The contents of CResult_RoutingFeesDecodeErrorZ
8825 pub union CResult_RoutingFeesDecodeErrorZPtr {
8826 /// A pointer to the contents in the success state.
8827 /// Reading from this pointer when `result_ok` is not set is undefined.
8828 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
8829 /// A pointer to the contents in the error state.
8830 /// Reading from this pointer when `result_ok` is set is undefined.
8831 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8834 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8835 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8836 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8837 pub struct CResult_RoutingFeesDecodeErrorZ {
8838 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8839 /// `err` or `result` depending on the state of `result_ok`.
8840 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8841 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8842 pub result_ok: bool,
8845 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8846 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8847 CResult_RoutingFeesDecodeErrorZ {
8848 contents: CResult_RoutingFeesDecodeErrorZPtr {
8849 result: Box::into_raw(Box::new(o)),
8855 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8856 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8857 CResult_RoutingFeesDecodeErrorZ {
8858 contents: CResult_RoutingFeesDecodeErrorZPtr {
8859 err: Box::into_raw(Box::new(e)),
8865 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8866 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8867 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8868 fn drop(&mut self) {
8870 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8871 let _ = unsafe { Box::from_raw(self.contents.result) };
8874 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8875 let _ = unsafe { Box::from_raw(self.contents.err) };
8880 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8881 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8882 let contents = if o.result_ok {
8883 let result = unsafe { o.contents.result };
8884 unsafe { o.contents.result = std::ptr::null_mut() };
8885 CResult_RoutingFeesDecodeErrorZPtr { result }
8887 let err = unsafe { o.contents.err };
8888 unsafe { o.contents.err = std::ptr::null_mut(); }
8889 CResult_RoutingFeesDecodeErrorZPtr { err }
8893 result_ok: o.result_ok,
8897 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8898 fn clone(&self) -> Self {
8900 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8901 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
8904 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8905 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8911 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8912 /// but with all dynamically-allocated buffers duplicated in new buffers.
8913 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8915 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8916 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8917 /// A pointer to the contents in the success state.
8918 /// Reading from this pointer when `result_ok` is not set is undefined.
8919 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
8920 /// A pointer to the contents in the error state.
8921 /// Reading from this pointer when `result_ok` is set is undefined.
8922 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8925 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8926 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8928 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8929 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8930 /// `err` or `result` depending on the state of `result_ok`.
8931 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8932 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8933 pub result_ok: bool,
8936 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8937 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8938 CResult_NodeAnnouncementInfoDecodeErrorZ {
8939 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8940 result: Box::into_raw(Box::new(o)),
8946 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8947 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8948 CResult_NodeAnnouncementInfoDecodeErrorZ {
8949 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8950 err: Box::into_raw(Box::new(e)),
8956 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8957 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8958 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8959 fn drop(&mut self) {
8961 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8962 let _ = unsafe { Box::from_raw(self.contents.result) };
8965 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8966 let _ = unsafe { Box::from_raw(self.contents.err) };
8971 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8972 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8973 let contents = if o.result_ok {
8974 let result = unsafe { o.contents.result };
8975 unsafe { o.contents.result = std::ptr::null_mut() };
8976 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8978 let err = unsafe { o.contents.err };
8979 unsafe { o.contents.err = std::ptr::null_mut(); }
8980 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8984 result_ok: o.result_ok,
8988 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8989 fn clone(&self) -> Self {
8991 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8992 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8995 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8996 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9002 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
9003 /// but with all dynamically-allocated buffers duplicated in new buffers.
9004 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
9006 /// A dynamically-allocated array of u64s of arbitrary size.
9007 /// This corresponds to std::vector in C++
9008 pub struct CVec_u64Z {
9009 /// The elements in the array.
9010 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9012 /// The number of elements pointed to by `data`.
9016 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
9017 if self.datalen == 0 { return Vec::new(); }
9018 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9019 self.data = std::ptr::null_mut();
9023 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
9024 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9027 impl From<Vec<u64>> for CVec_u64Z {
9028 fn from(v: Vec<u64>) -> Self {
9029 let datalen = v.len();
9030 let data = Box::into_raw(v.into_boxed_slice());
9031 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9035 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9036 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
9037 impl Drop for CVec_u64Z {
9038 fn drop(&mut self) {
9039 if self.datalen == 0 { return; }
9040 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9043 impl Clone for CVec_u64Z {
9044 fn clone(&self) -> Self {
9045 let mut res = Vec::new();
9046 if self.datalen == 0 { return Self::from(res); }
9047 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9052 /// The contents of CResult_NodeInfoDecodeErrorZ
9053 pub union CResult_NodeInfoDecodeErrorZPtr {
9054 /// A pointer to the contents in the success state.
9055 /// Reading from this pointer when `result_ok` is not set is undefined.
9056 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
9057 /// A pointer to the contents in the error state.
9058 /// Reading from this pointer when `result_ok` is set is undefined.
9059 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9062 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
9063 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9065 pub struct CResult_NodeInfoDecodeErrorZ {
9066 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
9067 /// `err` or `result` depending on the state of `result_ok`.
9068 pub contents: CResult_NodeInfoDecodeErrorZPtr,
9069 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
9070 pub result_ok: bool,
9073 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
9074 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
9075 CResult_NodeInfoDecodeErrorZ {
9076 contents: CResult_NodeInfoDecodeErrorZPtr {
9077 result: Box::into_raw(Box::new(o)),
9083 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
9084 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
9085 CResult_NodeInfoDecodeErrorZ {
9086 contents: CResult_NodeInfoDecodeErrorZPtr {
9087 err: Box::into_raw(Box::new(e)),
9093 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
9094 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
9095 impl Drop for CResult_NodeInfoDecodeErrorZ {
9096 fn drop(&mut self) {
9098 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9099 let _ = unsafe { Box::from_raw(self.contents.result) };
9102 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9103 let _ = unsafe { Box::from_raw(self.contents.err) };
9108 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
9109 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9110 let contents = if o.result_ok {
9111 let result = unsafe { o.contents.result };
9112 unsafe { o.contents.result = std::ptr::null_mut() };
9113 CResult_NodeInfoDecodeErrorZPtr { result }
9115 let err = unsafe { o.contents.err };
9116 unsafe { o.contents.err = std::ptr::null_mut(); }
9117 CResult_NodeInfoDecodeErrorZPtr { err }
9121 result_ok: o.result_ok,
9125 impl Clone for CResult_NodeInfoDecodeErrorZ {
9126 fn clone(&self) -> Self {
9128 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
9129 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
9132 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
9133 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9139 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
9140 /// but with all dynamically-allocated buffers duplicated in new buffers.
9141 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
9143 /// The contents of CResult_NetworkGraphDecodeErrorZ
9144 pub union CResult_NetworkGraphDecodeErrorZPtr {
9145 /// A pointer to the contents in the success state.
9146 /// Reading from this pointer when `result_ok` is not set is undefined.
9147 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
9148 /// A pointer to the contents in the error state.
9149 /// Reading from this pointer when `result_ok` is set is undefined.
9150 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9153 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
9154 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
9155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9156 pub struct CResult_NetworkGraphDecodeErrorZ {
9157 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
9158 /// `err` or `result` depending on the state of `result_ok`.
9159 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
9160 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
9161 pub result_ok: bool,
9164 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
9165 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
9166 CResult_NetworkGraphDecodeErrorZ {
9167 contents: CResult_NetworkGraphDecodeErrorZPtr {
9168 result: Box::into_raw(Box::new(o)),
9174 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
9175 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
9176 CResult_NetworkGraphDecodeErrorZ {
9177 contents: CResult_NetworkGraphDecodeErrorZPtr {
9178 err: Box::into_raw(Box::new(e)),
9184 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
9185 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
9186 impl Drop for CResult_NetworkGraphDecodeErrorZ {
9187 fn drop(&mut self) {
9189 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9190 let _ = unsafe { Box::from_raw(self.contents.result) };
9193 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9194 let _ = unsafe { Box::from_raw(self.contents.err) };
9199 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
9200 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
9201 let contents = if o.result_ok {
9202 let result = unsafe { o.contents.result };
9203 unsafe { o.contents.result = std::ptr::null_mut() };
9204 CResult_NetworkGraphDecodeErrorZPtr { result }
9206 let err = unsafe { o.contents.err };
9207 unsafe { o.contents.err = std::ptr::null_mut(); }
9208 CResult_NetworkGraphDecodeErrorZPtr { err }
9212 result_ok: o.result_ok,
9216 impl Clone for CResult_NetworkGraphDecodeErrorZ {
9217 fn clone(&self) -> Self {
9219 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
9220 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
9223 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
9224 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9230 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
9231 /// but with all dynamically-allocated buffers duplicated in new buffers.
9232 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
9235 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
9236 pub enum COption_CVec_NetAddressZZ {
9237 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
9238 Some(crate::c_types::derived::CVec_NetAddressZ),
9239 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
9242 impl COption_CVec_NetAddressZZ {
9243 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9244 if let Self::Some(_) = self { true } else { false }
9246 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9249 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
9250 if let Self::Some(v) = self { v } else { unreachable!() }
9254 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
9255 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
9256 COption_CVec_NetAddressZZ::Some(o)
9259 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
9260 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
9261 COption_CVec_NetAddressZZ::None
9264 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
9265 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
9267 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
9268 /// but with all dynamically-allocated buffers duplicated in new buffers.
9269 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
9271 /// The contents of CResult_NetAddressDecodeErrorZ
9272 pub union CResult_NetAddressDecodeErrorZPtr {
9273 /// A pointer to the contents in the success state.
9274 /// Reading from this pointer when `result_ok` is not set is undefined.
9275 pub result: *mut crate::lightning::ln::msgs::NetAddress,
9276 /// A pointer to the contents in the error state.
9277 /// Reading from this pointer when `result_ok` is set is undefined.
9278 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9281 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9282 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9284 pub struct CResult_NetAddressDecodeErrorZ {
9285 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9286 /// `err` or `result` depending on the state of `result_ok`.
9287 pub contents: CResult_NetAddressDecodeErrorZPtr,
9288 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9289 pub result_ok: bool,
9292 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
9293 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
9294 CResult_NetAddressDecodeErrorZ {
9295 contents: CResult_NetAddressDecodeErrorZPtr {
9296 result: Box::into_raw(Box::new(o)),
9302 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
9303 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
9304 CResult_NetAddressDecodeErrorZ {
9305 contents: CResult_NetAddressDecodeErrorZPtr {
9306 err: Box::into_raw(Box::new(e)),
9312 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
9313 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
9314 impl Drop for CResult_NetAddressDecodeErrorZ {
9315 fn drop(&mut self) {
9317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9318 let _ = unsafe { Box::from_raw(self.contents.result) };
9321 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9322 let _ = unsafe { Box::from_raw(self.contents.err) };
9327 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
9328 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
9329 let contents = if o.result_ok {
9330 let result = unsafe { o.contents.result };
9331 unsafe { o.contents.result = std::ptr::null_mut() };
9332 CResult_NetAddressDecodeErrorZPtr { result }
9334 let err = unsafe { o.contents.err };
9335 unsafe { o.contents.err = std::ptr::null_mut(); }
9336 CResult_NetAddressDecodeErrorZPtr { err }
9340 result_ok: o.result_ok,
9344 impl Clone for CResult_NetAddressDecodeErrorZ {
9345 fn clone(&self) -> Self {
9347 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
9348 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
9351 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
9352 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9358 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
9359 /// but with all dynamically-allocated buffers duplicated in new buffers.
9360 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
9362 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9363 /// This corresponds to std::vector in C++
9364 pub struct CVec_UpdateAddHTLCZ {
9365 /// The elements in the array.
9366 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9367 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9368 /// The number of elements pointed to by `data`.
9371 impl CVec_UpdateAddHTLCZ {
9372 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
9373 if self.datalen == 0 { return Vec::new(); }
9374 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9375 self.data = std::ptr::null_mut();
9379 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
9380 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9383 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
9384 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
9385 let datalen = v.len();
9386 let data = Box::into_raw(v.into_boxed_slice());
9387 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9391 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9392 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
9393 impl Drop for CVec_UpdateAddHTLCZ {
9394 fn drop(&mut self) {
9395 if self.datalen == 0 { return; }
9396 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9399 impl Clone for CVec_UpdateAddHTLCZ {
9400 fn clone(&self) -> Self {
9401 let mut res = Vec::new();
9402 if self.datalen == 0 { return Self::from(res); }
9403 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9408 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9409 /// This corresponds to std::vector in C++
9410 pub struct CVec_UpdateFulfillHTLCZ {
9411 /// The elements in the array.
9412 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9413 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9414 /// The number of elements pointed to by `data`.
9417 impl CVec_UpdateFulfillHTLCZ {
9418 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
9419 if self.datalen == 0 { return Vec::new(); }
9420 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9421 self.data = std::ptr::null_mut();
9425 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
9426 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9429 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
9430 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
9431 let datalen = v.len();
9432 let data = Box::into_raw(v.into_boxed_slice());
9433 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9437 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9438 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
9439 impl Drop for CVec_UpdateFulfillHTLCZ {
9440 fn drop(&mut self) {
9441 if self.datalen == 0 { return; }
9442 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9445 impl Clone for CVec_UpdateFulfillHTLCZ {
9446 fn clone(&self) -> Self {
9447 let mut res = Vec::new();
9448 if self.datalen == 0 { return Self::from(res); }
9449 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9454 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9455 /// This corresponds to std::vector in C++
9456 pub struct CVec_UpdateFailHTLCZ {
9457 /// The elements in the array.
9458 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9459 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9460 /// The number of elements pointed to by `data`.
9463 impl CVec_UpdateFailHTLCZ {
9464 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
9465 if self.datalen == 0 { return Vec::new(); }
9466 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9467 self.data = std::ptr::null_mut();
9471 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
9472 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9475 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
9476 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
9477 let datalen = v.len();
9478 let data = Box::into_raw(v.into_boxed_slice());
9479 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9483 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9484 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
9485 impl Drop for CVec_UpdateFailHTLCZ {
9486 fn drop(&mut self) {
9487 if self.datalen == 0 { return; }
9488 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9491 impl Clone for CVec_UpdateFailHTLCZ {
9492 fn clone(&self) -> Self {
9493 let mut res = Vec::new();
9494 if self.datalen == 0 { return Self::from(res); }
9495 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9500 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9501 /// This corresponds to std::vector in C++
9502 pub struct CVec_UpdateFailMalformedHTLCZ {
9503 /// The elements in the array.
9504 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9505 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9506 /// The number of elements pointed to by `data`.
9509 impl CVec_UpdateFailMalformedHTLCZ {
9510 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
9511 if self.datalen == 0 { return Vec::new(); }
9512 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9513 self.data = std::ptr::null_mut();
9517 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
9518 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9521 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
9522 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
9523 let datalen = v.len();
9524 let data = Box::into_raw(v.into_boxed_slice());
9525 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9529 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9530 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
9531 impl Drop for CVec_UpdateFailMalformedHTLCZ {
9532 fn drop(&mut self) {
9533 if self.datalen == 0 { return; }
9534 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9537 impl Clone for CVec_UpdateFailMalformedHTLCZ {
9538 fn clone(&self) -> Self {
9539 let mut res = Vec::new();
9540 if self.datalen == 0 { return Self::from(res); }
9541 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9546 /// The contents of CResult_AcceptChannelDecodeErrorZ
9547 pub union CResult_AcceptChannelDecodeErrorZPtr {
9548 /// A pointer to the contents in the success state.
9549 /// Reading from this pointer when `result_ok` is not set is undefined.
9550 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
9551 /// A pointer to the contents in the error state.
9552 /// Reading from this pointer when `result_ok` is set is undefined.
9553 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9556 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9557 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9559 pub struct CResult_AcceptChannelDecodeErrorZ {
9560 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9561 /// `err` or `result` depending on the state of `result_ok`.
9562 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
9563 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9564 pub result_ok: bool,
9567 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
9568 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
9569 CResult_AcceptChannelDecodeErrorZ {
9570 contents: CResult_AcceptChannelDecodeErrorZPtr {
9571 result: Box::into_raw(Box::new(o)),
9577 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
9578 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
9579 CResult_AcceptChannelDecodeErrorZ {
9580 contents: CResult_AcceptChannelDecodeErrorZPtr {
9581 err: Box::into_raw(Box::new(e)),
9587 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
9588 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
9589 impl Drop for CResult_AcceptChannelDecodeErrorZ {
9590 fn drop(&mut self) {
9592 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9593 let _ = unsafe { Box::from_raw(self.contents.result) };
9596 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9597 let _ = unsafe { Box::from_raw(self.contents.err) };
9602 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
9603 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9604 let contents = if o.result_ok {
9605 let result = unsafe { o.contents.result };
9606 unsafe { o.contents.result = std::ptr::null_mut() };
9607 CResult_AcceptChannelDecodeErrorZPtr { result }
9609 let err = unsafe { o.contents.err };
9610 unsafe { o.contents.err = std::ptr::null_mut(); }
9611 CResult_AcceptChannelDecodeErrorZPtr { err }
9615 result_ok: o.result_ok,
9619 impl Clone for CResult_AcceptChannelDecodeErrorZ {
9620 fn clone(&self) -> Self {
9622 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
9623 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
9626 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
9627 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9633 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
9634 /// but with all dynamically-allocated buffers duplicated in new buffers.
9635 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
9637 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9638 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
9639 /// A pointer to the contents in the success state.
9640 /// Reading from this pointer when `result_ok` is not set is undefined.
9641 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
9642 /// A pointer to the contents in the error state.
9643 /// Reading from this pointer when `result_ok` is set is undefined.
9644 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9647 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9648 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9649 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9650 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
9651 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9652 /// `err` or `result` depending on the state of `result_ok`.
9653 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
9654 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9655 pub result_ok: bool,
9658 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
9659 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9660 CResult_AnnouncementSignaturesDecodeErrorZ {
9661 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9662 result: Box::into_raw(Box::new(o)),
9668 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
9669 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9670 CResult_AnnouncementSignaturesDecodeErrorZ {
9671 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9672 err: Box::into_raw(Box::new(e)),
9678 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
9679 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
9680 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
9681 fn drop(&mut self) {
9683 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9684 let _ = unsafe { Box::from_raw(self.contents.result) };
9687 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9688 let _ = unsafe { Box::from_raw(self.contents.err) };
9693 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9694 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
9695 let contents = if o.result_ok {
9696 let result = unsafe { o.contents.result };
9697 unsafe { o.contents.result = std::ptr::null_mut() };
9698 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
9700 let err = unsafe { o.contents.err };
9701 unsafe { o.contents.err = std::ptr::null_mut(); }
9702 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9706 result_ok: o.result_ok,
9710 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9711 fn clone(&self) -> Self {
9713 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9714 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9717 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9718 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9724 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9725 /// but with all dynamically-allocated buffers duplicated in new buffers.
9726 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9728 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9729 pub union CResult_ChannelReestablishDecodeErrorZPtr {
9730 /// A pointer to the contents in the success state.
9731 /// Reading from this pointer when `result_ok` is not set is undefined.
9732 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
9733 /// A pointer to the contents in the error state.
9734 /// Reading from this pointer when `result_ok` is set is undefined.
9735 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9738 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9739 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9741 pub struct CResult_ChannelReestablishDecodeErrorZ {
9742 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9743 /// `err` or `result` depending on the state of `result_ok`.
9744 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9745 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9746 pub result_ok: bool,
9749 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9750 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9751 CResult_ChannelReestablishDecodeErrorZ {
9752 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9753 result: Box::into_raw(Box::new(o)),
9759 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9760 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9761 CResult_ChannelReestablishDecodeErrorZ {
9762 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9763 err: Box::into_raw(Box::new(e)),
9769 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
9770 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9771 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
9772 fn drop(&mut self) {
9774 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9775 let _ = unsafe { Box::from_raw(self.contents.result) };
9778 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9779 let _ = unsafe { Box::from_raw(self.contents.err) };
9784 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9785 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
9786 let contents = if o.result_ok {
9787 let result = unsafe { o.contents.result };
9788 unsafe { o.contents.result = std::ptr::null_mut() };
9789 CResult_ChannelReestablishDecodeErrorZPtr { result }
9791 let err = unsafe { o.contents.err };
9792 unsafe { o.contents.err = std::ptr::null_mut(); }
9793 CResult_ChannelReestablishDecodeErrorZPtr { err }
9797 result_ok: o.result_ok,
9801 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9802 fn clone(&self) -> Self {
9804 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9805 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9808 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9809 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9815 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9816 /// but with all dynamically-allocated buffers duplicated in new buffers.
9817 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9819 /// The contents of CResult_ClosingSignedDecodeErrorZ
9820 pub union CResult_ClosingSignedDecodeErrorZPtr {
9821 /// A pointer to the contents in the success state.
9822 /// Reading from this pointer when `result_ok` is not set is undefined.
9823 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
9824 /// A pointer to the contents in the error state.
9825 /// Reading from this pointer when `result_ok` is set is undefined.
9826 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9829 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9830 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9832 pub struct CResult_ClosingSignedDecodeErrorZ {
9833 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9834 /// `err` or `result` depending on the state of `result_ok`.
9835 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9836 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9837 pub result_ok: bool,
9840 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9841 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9842 CResult_ClosingSignedDecodeErrorZ {
9843 contents: CResult_ClosingSignedDecodeErrorZPtr {
9844 result: Box::into_raw(Box::new(o)),
9850 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9851 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
9852 CResult_ClosingSignedDecodeErrorZ {
9853 contents: CResult_ClosingSignedDecodeErrorZPtr {
9854 err: Box::into_raw(Box::new(e)),
9860 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
9861 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
9862 impl Drop for CResult_ClosingSignedDecodeErrorZ {
9863 fn drop(&mut self) {
9865 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9866 let _ = unsafe { Box::from_raw(self.contents.result) };
9869 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9870 let _ = unsafe { Box::from_raw(self.contents.err) };
9875 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
9876 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9877 let contents = if o.result_ok {
9878 let result = unsafe { o.contents.result };
9879 unsafe { o.contents.result = std::ptr::null_mut() };
9880 CResult_ClosingSignedDecodeErrorZPtr { result }
9882 let err = unsafe { o.contents.err };
9883 unsafe { o.contents.err = std::ptr::null_mut(); }
9884 CResult_ClosingSignedDecodeErrorZPtr { err }
9888 result_ok: o.result_ok,
9892 impl Clone for CResult_ClosingSignedDecodeErrorZ {
9893 fn clone(&self) -> Self {
9895 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
9896 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
9899 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
9900 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9906 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
9907 /// but with all dynamically-allocated buffers duplicated in new buffers.
9908 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
9910 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9911 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9912 /// A pointer to the contents in the success state.
9913 /// Reading from this pointer when `result_ok` is not set is undefined.
9914 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
9915 /// A pointer to the contents in the error state.
9916 /// Reading from this pointer when `result_ok` is set is undefined.
9917 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9920 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9921 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9922 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9923 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
9924 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9925 /// `err` or `result` depending on the state of `result_ok`.
9926 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
9927 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9928 pub result_ok: bool,
9931 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
9932 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9933 CResult_ClosingSignedFeeRangeDecodeErrorZ {
9934 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9935 result: Box::into_raw(Box::new(o)),
9941 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
9942 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9943 CResult_ClosingSignedFeeRangeDecodeErrorZ {
9944 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9945 err: Box::into_raw(Box::new(e)),
9951 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
9952 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
9953 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9954 fn drop(&mut self) {
9956 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9957 let _ = unsafe { Box::from_raw(self.contents.result) };
9960 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9961 let _ = unsafe { Box::from_raw(self.contents.err) };
9966 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9967 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
9968 let contents = if o.result_ok {
9969 let result = unsafe { o.contents.result };
9970 unsafe { o.contents.result = std::ptr::null_mut() };
9971 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
9973 let err = unsafe { o.contents.err };
9974 unsafe { o.contents.err = std::ptr::null_mut(); }
9975 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
9979 result_ok: o.result_ok,
9983 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9984 fn clone(&self) -> Self {
9986 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9987 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
9990 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9991 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9997 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
9998 /// but with all dynamically-allocated buffers duplicated in new buffers.
9999 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
10001 /// The contents of CResult_CommitmentSignedDecodeErrorZ
10002 pub union CResult_CommitmentSignedDecodeErrorZPtr {
10003 /// A pointer to the contents in the success state.
10004 /// Reading from this pointer when `result_ok` is not set is undefined.
10005 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
10006 /// A pointer to the contents in the error state.
10007 /// Reading from this pointer when `result_ok` is set is undefined.
10008 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10011 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
10012 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10013 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10014 pub struct CResult_CommitmentSignedDecodeErrorZ {
10015 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
10016 /// `err` or `result` depending on the state of `result_ok`.
10017 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
10018 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
10019 pub result_ok: bool,
10022 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10023 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
10024 CResult_CommitmentSignedDecodeErrorZ {
10025 contents: CResult_CommitmentSignedDecodeErrorZPtr {
10026 result: Box::into_raw(Box::new(o)),
10032 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10033 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
10034 CResult_CommitmentSignedDecodeErrorZ {
10035 contents: CResult_CommitmentSignedDecodeErrorZPtr {
10036 err: Box::into_raw(Box::new(e)),
10042 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10043 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
10044 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
10045 fn drop(&mut self) {
10046 if self.result_ok {
10047 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10048 let _ = unsafe { Box::from_raw(self.contents.result) };
10051 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10052 let _ = unsafe { Box::from_raw(self.contents.err) };
10057 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
10058 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10059 let contents = if o.result_ok {
10060 let result = unsafe { o.contents.result };
10061 unsafe { o.contents.result = std::ptr::null_mut() };
10062 CResult_CommitmentSignedDecodeErrorZPtr { result }
10064 let err = unsafe { o.contents.err };
10065 unsafe { o.contents.err = std::ptr::null_mut(); }
10066 CResult_CommitmentSignedDecodeErrorZPtr { err }
10070 result_ok: o.result_ok,
10074 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
10075 fn clone(&self) -> Self {
10076 if self.result_ok {
10077 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
10078 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
10081 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
10082 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10088 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10089 /// but with all dynamically-allocated buffers duplicated in new buffers.
10090 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
10092 /// The contents of CResult_FundingCreatedDecodeErrorZ
10093 pub union CResult_FundingCreatedDecodeErrorZPtr {
10094 /// A pointer to the contents in the success state.
10095 /// Reading from this pointer when `result_ok` is not set is undefined.
10096 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
10097 /// A pointer to the contents in the error state.
10098 /// Reading from this pointer when `result_ok` is set is undefined.
10099 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10102 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
10103 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
10104 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10105 pub struct CResult_FundingCreatedDecodeErrorZ {
10106 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
10107 /// `err` or `result` depending on the state of `result_ok`.
10108 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
10109 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
10110 pub result_ok: bool,
10113 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10114 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
10115 CResult_FundingCreatedDecodeErrorZ {
10116 contents: CResult_FundingCreatedDecodeErrorZPtr {
10117 result: Box::into_raw(Box::new(o)),
10123 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10124 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
10125 CResult_FundingCreatedDecodeErrorZ {
10126 contents: CResult_FundingCreatedDecodeErrorZPtr {
10127 err: Box::into_raw(Box::new(e)),
10133 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10134 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
10135 impl Drop for CResult_FundingCreatedDecodeErrorZ {
10136 fn drop(&mut self) {
10137 if self.result_ok {
10138 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10139 let _ = unsafe { Box::from_raw(self.contents.result) };
10142 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10143 let _ = unsafe { Box::from_raw(self.contents.err) };
10148 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
10149 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
10150 let contents = if o.result_ok {
10151 let result = unsafe { o.contents.result };
10152 unsafe { o.contents.result = std::ptr::null_mut() };
10153 CResult_FundingCreatedDecodeErrorZPtr { result }
10155 let err = unsafe { o.contents.err };
10156 unsafe { o.contents.err = std::ptr::null_mut(); }
10157 CResult_FundingCreatedDecodeErrorZPtr { err }
10161 result_ok: o.result_ok,
10165 impl Clone for CResult_FundingCreatedDecodeErrorZ {
10166 fn clone(&self) -> Self {
10167 if self.result_ok {
10168 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
10169 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
10172 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
10173 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10179 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10180 /// but with all dynamically-allocated buffers duplicated in new buffers.
10181 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
10183 /// The contents of CResult_FundingSignedDecodeErrorZ
10184 pub union CResult_FundingSignedDecodeErrorZPtr {
10185 /// A pointer to the contents in the success state.
10186 /// Reading from this pointer when `result_ok` is not set is undefined.
10187 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
10188 /// A pointer to the contents in the error state.
10189 /// Reading from this pointer when `result_ok` is set is undefined.
10190 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10193 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
10194 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10195 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10196 pub struct CResult_FundingSignedDecodeErrorZ {
10197 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
10198 /// `err` or `result` depending on the state of `result_ok`.
10199 pub contents: CResult_FundingSignedDecodeErrorZPtr,
10200 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
10201 pub result_ok: bool,
10204 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10205 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
10206 CResult_FundingSignedDecodeErrorZ {
10207 contents: CResult_FundingSignedDecodeErrorZPtr {
10208 result: Box::into_raw(Box::new(o)),
10214 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10215 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
10216 CResult_FundingSignedDecodeErrorZ {
10217 contents: CResult_FundingSignedDecodeErrorZPtr {
10218 err: Box::into_raw(Box::new(e)),
10224 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10225 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
10226 impl Drop for CResult_FundingSignedDecodeErrorZ {
10227 fn drop(&mut self) {
10228 if self.result_ok {
10229 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10230 let _ = unsafe { Box::from_raw(self.contents.result) };
10233 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10234 let _ = unsafe { Box::from_raw(self.contents.err) };
10239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
10240 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10241 let contents = if o.result_ok {
10242 let result = unsafe { o.contents.result };
10243 unsafe { o.contents.result = std::ptr::null_mut() };
10244 CResult_FundingSignedDecodeErrorZPtr { result }
10246 let err = unsafe { o.contents.err };
10247 unsafe { o.contents.err = std::ptr::null_mut(); }
10248 CResult_FundingSignedDecodeErrorZPtr { err }
10252 result_ok: o.result_ok,
10256 impl Clone for CResult_FundingSignedDecodeErrorZ {
10257 fn clone(&self) -> Self {
10258 if self.result_ok {
10259 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
10260 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
10263 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
10264 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10270 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10271 /// but with all dynamically-allocated buffers duplicated in new buffers.
10272 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
10274 /// The contents of CResult_FundingLockedDecodeErrorZ
10275 pub union CResult_FundingLockedDecodeErrorZPtr {
10276 /// A pointer to the contents in the success state.
10277 /// Reading from this pointer when `result_ok` is not set is undefined.
10278 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
10279 /// A pointer to the contents in the error state.
10280 /// Reading from this pointer when `result_ok` is set is undefined.
10281 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10284 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
10285 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
10286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10287 pub struct CResult_FundingLockedDecodeErrorZ {
10288 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
10289 /// `err` or `result` depending on the state of `result_ok`.
10290 pub contents: CResult_FundingLockedDecodeErrorZPtr,
10291 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
10292 pub result_ok: bool,
10295 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10296 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
10297 CResult_FundingLockedDecodeErrorZ {
10298 contents: CResult_FundingLockedDecodeErrorZPtr {
10299 result: Box::into_raw(Box::new(o)),
10305 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10306 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
10307 CResult_FundingLockedDecodeErrorZ {
10308 contents: CResult_FundingLockedDecodeErrorZPtr {
10309 err: Box::into_raw(Box::new(e)),
10315 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10316 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
10317 impl Drop for CResult_FundingLockedDecodeErrorZ {
10318 fn drop(&mut self) {
10319 if self.result_ok {
10320 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10321 let _ = unsafe { Box::from_raw(self.contents.result) };
10324 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10325 let _ = unsafe { Box::from_raw(self.contents.err) };
10330 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
10331 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
10332 let contents = if o.result_ok {
10333 let result = unsafe { o.contents.result };
10334 unsafe { o.contents.result = std::ptr::null_mut() };
10335 CResult_FundingLockedDecodeErrorZPtr { result }
10337 let err = unsafe { o.contents.err };
10338 unsafe { o.contents.err = std::ptr::null_mut(); }
10339 CResult_FundingLockedDecodeErrorZPtr { err }
10343 result_ok: o.result_ok,
10347 impl Clone for CResult_FundingLockedDecodeErrorZ {
10348 fn clone(&self) -> Self {
10349 if self.result_ok {
10350 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
10351 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
10354 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
10355 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10361 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10362 /// but with all dynamically-allocated buffers duplicated in new buffers.
10363 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
10365 /// The contents of CResult_InitDecodeErrorZ
10366 pub union CResult_InitDecodeErrorZPtr {
10367 /// A pointer to the contents in the success state.
10368 /// Reading from this pointer when `result_ok` is not set is undefined.
10369 pub result: *mut crate::lightning::ln::msgs::Init,
10370 /// A pointer to the contents in the error state.
10371 /// Reading from this pointer when `result_ok` is set is undefined.
10372 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10375 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
10376 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
10377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10378 pub struct CResult_InitDecodeErrorZ {
10379 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
10380 /// `err` or `result` depending on the state of `result_ok`.
10381 pub contents: CResult_InitDecodeErrorZPtr,
10382 /// Whether this CResult_InitDecodeErrorZ represents a success state.
10383 pub result_ok: bool,
10386 /// Creates a new CResult_InitDecodeErrorZ in the success state.
10387 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
10388 CResult_InitDecodeErrorZ {
10389 contents: CResult_InitDecodeErrorZPtr {
10390 result: Box::into_raw(Box::new(o)),
10396 /// Creates a new CResult_InitDecodeErrorZ in the error state.
10397 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
10398 CResult_InitDecodeErrorZ {
10399 contents: CResult_InitDecodeErrorZPtr {
10400 err: Box::into_raw(Box::new(e)),
10406 /// Frees any resources used by the CResult_InitDecodeErrorZ.
10407 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
10408 impl Drop for CResult_InitDecodeErrorZ {
10409 fn drop(&mut self) {
10410 if self.result_ok {
10411 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10412 let _ = unsafe { Box::from_raw(self.contents.result) };
10415 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10416 let _ = unsafe { Box::from_raw(self.contents.err) };
10421 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
10422 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
10423 let contents = if o.result_ok {
10424 let result = unsafe { o.contents.result };
10425 unsafe { o.contents.result = std::ptr::null_mut() };
10426 CResult_InitDecodeErrorZPtr { result }
10428 let err = unsafe { o.contents.err };
10429 unsafe { o.contents.err = std::ptr::null_mut(); }
10430 CResult_InitDecodeErrorZPtr { err }
10434 result_ok: o.result_ok,
10438 impl Clone for CResult_InitDecodeErrorZ {
10439 fn clone(&self) -> Self {
10440 if self.result_ok {
10441 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
10442 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
10445 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
10446 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10452 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10453 /// but with all dynamically-allocated buffers duplicated in new buffers.
10454 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
10456 /// The contents of CResult_OpenChannelDecodeErrorZ
10457 pub union CResult_OpenChannelDecodeErrorZPtr {
10458 /// A pointer to the contents in the success state.
10459 /// Reading from this pointer when `result_ok` is not set is undefined.
10460 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
10461 /// A pointer to the contents in the error state.
10462 /// Reading from this pointer when `result_ok` is set is undefined.
10463 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10466 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10467 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10469 pub struct CResult_OpenChannelDecodeErrorZ {
10470 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10471 /// `err` or `result` depending on the state of `result_ok`.
10472 pub contents: CResult_OpenChannelDecodeErrorZPtr,
10473 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10474 pub result_ok: bool,
10477 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10478 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
10479 CResult_OpenChannelDecodeErrorZ {
10480 contents: CResult_OpenChannelDecodeErrorZPtr {
10481 result: Box::into_raw(Box::new(o)),
10487 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10488 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
10489 CResult_OpenChannelDecodeErrorZ {
10490 contents: CResult_OpenChannelDecodeErrorZPtr {
10491 err: Box::into_raw(Box::new(e)),
10497 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10498 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
10499 impl Drop for CResult_OpenChannelDecodeErrorZ {
10500 fn drop(&mut self) {
10501 if self.result_ok {
10502 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10503 let _ = unsafe { Box::from_raw(self.contents.result) };
10506 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10507 let _ = unsafe { Box::from_raw(self.contents.err) };
10512 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
10513 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
10514 let contents = if o.result_ok {
10515 let result = unsafe { o.contents.result };
10516 unsafe { o.contents.result = std::ptr::null_mut() };
10517 CResult_OpenChannelDecodeErrorZPtr { result }
10519 let err = unsafe { o.contents.err };
10520 unsafe { o.contents.err = std::ptr::null_mut(); }
10521 CResult_OpenChannelDecodeErrorZPtr { err }
10525 result_ok: o.result_ok,
10529 impl Clone for CResult_OpenChannelDecodeErrorZ {
10530 fn clone(&self) -> Self {
10531 if self.result_ok {
10532 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
10533 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
10536 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
10537 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10543 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10544 /// but with all dynamically-allocated buffers duplicated in new buffers.
10545 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
10547 /// The contents of CResult_RevokeAndACKDecodeErrorZ
10548 pub union CResult_RevokeAndACKDecodeErrorZPtr {
10549 /// A pointer to the contents in the success state.
10550 /// Reading from this pointer when `result_ok` is not set is undefined.
10551 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
10552 /// A pointer to the contents in the error state.
10553 /// Reading from this pointer when `result_ok` is set is undefined.
10554 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10557 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10558 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
10559 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10560 pub struct CResult_RevokeAndACKDecodeErrorZ {
10561 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10562 /// `err` or `result` depending on the state of `result_ok`.
10563 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
10564 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10565 pub result_ok: bool,
10568 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10569 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
10570 CResult_RevokeAndACKDecodeErrorZ {
10571 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10572 result: Box::into_raw(Box::new(o)),
10578 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10579 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
10580 CResult_RevokeAndACKDecodeErrorZ {
10581 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10582 err: Box::into_raw(Box::new(e)),
10588 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10589 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
10590 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
10591 fn drop(&mut self) {
10592 if self.result_ok {
10593 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10594 let _ = unsafe { Box::from_raw(self.contents.result) };
10597 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10598 let _ = unsafe { Box::from_raw(self.contents.err) };
10603 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
10604 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
10605 let contents = if o.result_ok {
10606 let result = unsafe { o.contents.result };
10607 unsafe { o.contents.result = std::ptr::null_mut() };
10608 CResult_RevokeAndACKDecodeErrorZPtr { result }
10610 let err = unsafe { o.contents.err };
10611 unsafe { o.contents.err = std::ptr::null_mut(); }
10612 CResult_RevokeAndACKDecodeErrorZPtr { err }
10616 result_ok: o.result_ok,
10620 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
10621 fn clone(&self) -> Self {
10622 if self.result_ok {
10623 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10624 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
10627 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10628 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10634 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10635 /// but with all dynamically-allocated buffers duplicated in new buffers.
10636 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
10638 /// The contents of CResult_ShutdownDecodeErrorZ
10639 pub union CResult_ShutdownDecodeErrorZPtr {
10640 /// A pointer to the contents in the success state.
10641 /// Reading from this pointer when `result_ok` is not set is undefined.
10642 pub result: *mut crate::lightning::ln::msgs::Shutdown,
10643 /// A pointer to the contents in the error state.
10644 /// Reading from this pointer when `result_ok` is set is undefined.
10645 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10648 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
10649 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
10650 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10651 pub struct CResult_ShutdownDecodeErrorZ {
10652 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10653 /// `err` or `result` depending on the state of `result_ok`.
10654 pub contents: CResult_ShutdownDecodeErrorZPtr,
10655 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10656 pub result_ok: bool,
10659 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10660 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
10661 CResult_ShutdownDecodeErrorZ {
10662 contents: CResult_ShutdownDecodeErrorZPtr {
10663 result: Box::into_raw(Box::new(o)),
10669 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10670 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
10671 CResult_ShutdownDecodeErrorZ {
10672 contents: CResult_ShutdownDecodeErrorZPtr {
10673 err: Box::into_raw(Box::new(e)),
10679 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10680 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
10681 impl Drop for CResult_ShutdownDecodeErrorZ {
10682 fn drop(&mut self) {
10683 if self.result_ok {
10684 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10685 let _ = unsafe { Box::from_raw(self.contents.result) };
10688 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10689 let _ = unsafe { Box::from_raw(self.contents.err) };
10694 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10695 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
10696 let contents = if o.result_ok {
10697 let result = unsafe { o.contents.result };
10698 unsafe { o.contents.result = std::ptr::null_mut() };
10699 CResult_ShutdownDecodeErrorZPtr { result }
10701 let err = unsafe { o.contents.err };
10702 unsafe { o.contents.err = std::ptr::null_mut(); }
10703 CResult_ShutdownDecodeErrorZPtr { err }
10707 result_ok: o.result_ok,
10711 impl Clone for CResult_ShutdownDecodeErrorZ {
10712 fn clone(&self) -> Self {
10713 if self.result_ok {
10714 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10715 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10718 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
10719 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10725 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10726 /// but with all dynamically-allocated buffers duplicated in new buffers.
10727 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10729 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10730 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
10731 /// A pointer to the contents in the success state.
10732 /// Reading from this pointer when `result_ok` is not set is undefined.
10733 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10734 /// A pointer to the contents in the error state.
10735 /// Reading from this pointer when `result_ok` is set is undefined.
10736 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10739 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10740 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10741 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10742 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
10743 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10744 /// `err` or `result` depending on the state of `result_ok`.
10745 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10746 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10747 pub result_ok: bool,
10750 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10751 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10752 CResult_UpdateFailHTLCDecodeErrorZ {
10753 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10754 result: Box::into_raw(Box::new(o)),
10760 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10761 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10762 CResult_UpdateFailHTLCDecodeErrorZ {
10763 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10764 err: Box::into_raw(Box::new(e)),
10770 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10771 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10772 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
10773 fn drop(&mut self) {
10774 if self.result_ok {
10775 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10776 let _ = unsafe { Box::from_raw(self.contents.result) };
10779 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10780 let _ = unsafe { Box::from_raw(self.contents.err) };
10785 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10786 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10787 let contents = if o.result_ok {
10788 let result = unsafe { o.contents.result };
10789 unsafe { o.contents.result = std::ptr::null_mut() };
10790 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
10792 let err = unsafe { o.contents.err };
10793 unsafe { o.contents.err = std::ptr::null_mut(); }
10794 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10798 result_ok: o.result_ok,
10802 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10803 fn clone(&self) -> Self {
10804 if self.result_ok {
10805 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10806 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10809 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10810 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10816 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10817 /// but with all dynamically-allocated buffers duplicated in new buffers.
10818 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10820 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10821 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10822 /// A pointer to the contents in the success state.
10823 /// Reading from this pointer when `result_ok` is not set is undefined.
10824 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10825 /// A pointer to the contents in the error state.
10826 /// Reading from this pointer when `result_ok` is set is undefined.
10827 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10830 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10831 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10833 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10834 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10835 /// `err` or `result` depending on the state of `result_ok`.
10836 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10837 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10838 pub result_ok: bool,
10841 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10842 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10843 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10844 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10845 result: Box::into_raw(Box::new(o)),
10851 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10852 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10853 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10854 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10855 err: Box::into_raw(Box::new(e)),
10861 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10862 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
10863 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10864 fn drop(&mut self) {
10865 if self.result_ok {
10866 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10867 let _ = unsafe { Box::from_raw(self.contents.result) };
10870 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10871 let _ = unsafe { Box::from_raw(self.contents.err) };
10876 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10877 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10878 let contents = if o.result_ok {
10879 let result = unsafe { o.contents.result };
10880 unsafe { o.contents.result = std::ptr::null_mut() };
10881 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
10883 let err = unsafe { o.contents.err };
10884 unsafe { o.contents.err = std::ptr::null_mut(); }
10885 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
10889 result_ok: o.result_ok,
10893 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10894 fn clone(&self) -> Self {
10895 if self.result_ok {
10896 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10897 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
10900 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10901 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10907 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10908 /// but with all dynamically-allocated buffers duplicated in new buffers.
10909 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
10911 /// The contents of CResult_UpdateFeeDecodeErrorZ
10912 pub union CResult_UpdateFeeDecodeErrorZPtr {
10913 /// A pointer to the contents in the success state.
10914 /// Reading from this pointer when `result_ok` is not set is undefined.
10915 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
10916 /// A pointer to the contents in the error state.
10917 /// Reading from this pointer when `result_ok` is set is undefined.
10918 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10921 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10922 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10924 pub struct CResult_UpdateFeeDecodeErrorZ {
10925 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10926 /// `err` or `result` depending on the state of `result_ok`.
10927 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
10928 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10929 pub result_ok: bool,
10932 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10933 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
10934 CResult_UpdateFeeDecodeErrorZ {
10935 contents: CResult_UpdateFeeDecodeErrorZPtr {
10936 result: Box::into_raw(Box::new(o)),
10942 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10943 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
10944 CResult_UpdateFeeDecodeErrorZ {
10945 contents: CResult_UpdateFeeDecodeErrorZPtr {
10946 err: Box::into_raw(Box::new(e)),
10952 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10953 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
10954 impl Drop for CResult_UpdateFeeDecodeErrorZ {
10955 fn drop(&mut self) {
10956 if self.result_ok {
10957 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10958 let _ = unsafe { Box::from_raw(self.contents.result) };
10961 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10962 let _ = unsafe { Box::from_raw(self.contents.err) };
10967 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
10968 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
10969 let contents = if o.result_ok {
10970 let result = unsafe { o.contents.result };
10971 unsafe { o.contents.result = std::ptr::null_mut() };
10972 CResult_UpdateFeeDecodeErrorZPtr { result }
10974 let err = unsafe { o.contents.err };
10975 unsafe { o.contents.err = std::ptr::null_mut(); }
10976 CResult_UpdateFeeDecodeErrorZPtr { err }
10980 result_ok: o.result_ok,
10984 impl Clone for CResult_UpdateFeeDecodeErrorZ {
10985 fn clone(&self) -> Self {
10986 if self.result_ok {
10987 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
10988 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
10991 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
10992 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10998 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10999 /// but with all dynamically-allocated buffers duplicated in new buffers.
11000 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
11002 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
11003 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11004 /// A pointer to the contents in the success state.
11005 /// Reading from this pointer when `result_ok` is not set is undefined.
11006 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11007 /// A pointer to the contents in the error state.
11008 /// Reading from this pointer when `result_ok` is set is undefined.
11009 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11012 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
11013 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11015 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
11016 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
11017 /// `err` or `result` depending on the state of `result_ok`.
11018 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
11019 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
11020 pub result_ok: bool,
11023 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11024 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
11025 CResult_UpdateFulfillHTLCDecodeErrorZ {
11026 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11027 result: Box::into_raw(Box::new(o)),
11033 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11034 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
11035 CResult_UpdateFulfillHTLCDecodeErrorZ {
11036 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11037 err: Box::into_raw(Box::new(e)),
11043 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
11044 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
11045 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
11046 fn drop(&mut self) {
11047 if self.result_ok {
11048 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11049 let _ = unsafe { Box::from_raw(self.contents.result) };
11052 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11053 let _ = unsafe { Box::from_raw(self.contents.err) };
11058 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
11059 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11060 let contents = if o.result_ok {
11061 let result = unsafe { o.contents.result };
11062 unsafe { o.contents.result = std::ptr::null_mut() };
11063 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
11065 let err = unsafe { o.contents.err };
11066 unsafe { o.contents.err = std::ptr::null_mut(); }
11067 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
11071 result_ok: o.result_ok,
11075 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
11076 fn clone(&self) -> Self {
11077 if self.result_ok {
11078 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11079 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
11082 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11083 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11089 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11090 /// but with all dynamically-allocated buffers duplicated in new buffers.
11091 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
11093 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
11094 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
11095 /// A pointer to the contents in the success state.
11096 /// Reading from this pointer when `result_ok` is not set is undefined.
11097 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11098 /// A pointer to the contents in the error state.
11099 /// Reading from this pointer when `result_ok` is set is undefined.
11100 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11103 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
11104 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11106 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
11107 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
11108 /// `err` or `result` depending on the state of `result_ok`.
11109 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
11110 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
11111 pub result_ok: bool,
11114 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11115 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
11116 CResult_UpdateAddHTLCDecodeErrorZ {
11117 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11118 result: Box::into_raw(Box::new(o)),
11124 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11125 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
11126 CResult_UpdateAddHTLCDecodeErrorZ {
11127 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11128 err: Box::into_raw(Box::new(e)),
11134 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
11135 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
11136 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
11137 fn drop(&mut self) {
11138 if self.result_ok {
11139 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11140 let _ = unsafe { Box::from_raw(self.contents.result) };
11143 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11144 let _ = unsafe { Box::from_raw(self.contents.err) };
11149 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
11150 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11151 let contents = if o.result_ok {
11152 let result = unsafe { o.contents.result };
11153 unsafe { o.contents.result = std::ptr::null_mut() };
11154 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
11156 let err = unsafe { o.contents.err };
11157 unsafe { o.contents.err = std::ptr::null_mut(); }
11158 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
11162 result_ok: o.result_ok,
11166 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
11167 fn clone(&self) -> Self {
11168 if self.result_ok {
11169 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11170 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
11173 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11174 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11180 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11181 /// but with all dynamically-allocated buffers duplicated in new buffers.
11182 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
11184 /// The contents of CResult_PingDecodeErrorZ
11185 pub union CResult_PingDecodeErrorZPtr {
11186 /// A pointer to the contents in the success state.
11187 /// Reading from this pointer when `result_ok` is not set is undefined.
11188 pub result: *mut crate::lightning::ln::msgs::Ping,
11189 /// A pointer to the contents in the error state.
11190 /// Reading from this pointer when `result_ok` is set is undefined.
11191 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11194 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
11195 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
11196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11197 pub struct CResult_PingDecodeErrorZ {
11198 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
11199 /// `err` or `result` depending on the state of `result_ok`.
11200 pub contents: CResult_PingDecodeErrorZPtr,
11201 /// Whether this CResult_PingDecodeErrorZ represents a success state.
11202 pub result_ok: bool,
11205 /// Creates a new CResult_PingDecodeErrorZ in the success state.
11206 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
11207 CResult_PingDecodeErrorZ {
11208 contents: CResult_PingDecodeErrorZPtr {
11209 result: Box::into_raw(Box::new(o)),
11215 /// Creates a new CResult_PingDecodeErrorZ in the error state.
11216 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
11217 CResult_PingDecodeErrorZ {
11218 contents: CResult_PingDecodeErrorZPtr {
11219 err: Box::into_raw(Box::new(e)),
11225 /// Frees any resources used by the CResult_PingDecodeErrorZ.
11226 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
11227 impl Drop for CResult_PingDecodeErrorZ {
11228 fn drop(&mut self) {
11229 if self.result_ok {
11230 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11231 let _ = unsafe { Box::from_raw(self.contents.result) };
11234 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11235 let _ = unsafe { Box::from_raw(self.contents.err) };
11240 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
11241 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
11242 let contents = if o.result_ok {
11243 let result = unsafe { o.contents.result };
11244 unsafe { o.contents.result = std::ptr::null_mut() };
11245 CResult_PingDecodeErrorZPtr { result }
11247 let err = unsafe { o.contents.err };
11248 unsafe { o.contents.err = std::ptr::null_mut(); }
11249 CResult_PingDecodeErrorZPtr { err }
11253 result_ok: o.result_ok,
11257 impl Clone for CResult_PingDecodeErrorZ {
11258 fn clone(&self) -> Self {
11259 if self.result_ok {
11260 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
11261 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
11264 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
11265 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11271 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11272 /// but with all dynamically-allocated buffers duplicated in new buffers.
11273 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
11275 /// The contents of CResult_PongDecodeErrorZ
11276 pub union CResult_PongDecodeErrorZPtr {
11277 /// A pointer to the contents in the success state.
11278 /// Reading from this pointer when `result_ok` is not set is undefined.
11279 pub result: *mut crate::lightning::ln::msgs::Pong,
11280 /// A pointer to the contents in the error state.
11281 /// Reading from this pointer when `result_ok` is set is undefined.
11282 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11285 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11286 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11288 pub struct CResult_PongDecodeErrorZ {
11289 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
11290 /// `err` or `result` depending on the state of `result_ok`.
11291 pub contents: CResult_PongDecodeErrorZPtr,
11292 /// Whether this CResult_PongDecodeErrorZ represents a success state.
11293 pub result_ok: bool,
11296 /// Creates a new CResult_PongDecodeErrorZ in the success state.
11297 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
11298 CResult_PongDecodeErrorZ {
11299 contents: CResult_PongDecodeErrorZPtr {
11300 result: Box::into_raw(Box::new(o)),
11306 /// Creates a new CResult_PongDecodeErrorZ in the error state.
11307 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
11308 CResult_PongDecodeErrorZ {
11309 contents: CResult_PongDecodeErrorZPtr {
11310 err: Box::into_raw(Box::new(e)),
11316 /// Frees any resources used by the CResult_PongDecodeErrorZ.
11317 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
11318 impl Drop for CResult_PongDecodeErrorZ {
11319 fn drop(&mut self) {
11320 if self.result_ok {
11321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11322 let _ = unsafe { Box::from_raw(self.contents.result) };
11325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11326 let _ = unsafe { Box::from_raw(self.contents.err) };
11331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
11332 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
11333 let contents = if o.result_ok {
11334 let result = unsafe { o.contents.result };
11335 unsafe { o.contents.result = std::ptr::null_mut() };
11336 CResult_PongDecodeErrorZPtr { result }
11338 let err = unsafe { o.contents.err };
11339 unsafe { o.contents.err = std::ptr::null_mut(); }
11340 CResult_PongDecodeErrorZPtr { err }
11344 result_ok: o.result_ok,
11348 impl Clone for CResult_PongDecodeErrorZ {
11349 fn clone(&self) -> Self {
11350 if self.result_ok {
11351 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
11352 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
11355 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
11356 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11362 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11363 /// but with all dynamically-allocated buffers duplicated in new buffers.
11364 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
11366 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11367 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11368 /// A pointer to the contents in the success state.
11369 /// Reading from this pointer when `result_ok` is not set is undefined.
11370 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
11371 /// A pointer to the contents in the error state.
11372 /// Reading from this pointer when `result_ok` is set is undefined.
11373 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11376 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11377 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11379 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11380 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11381 /// `err` or `result` depending on the state of `result_ok`.
11382 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
11383 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11384 pub result_ok: bool,
11387 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11388 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11389 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11390 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11391 result: Box::into_raw(Box::new(o)),
11397 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11398 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11399 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11400 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11401 err: Box::into_raw(Box::new(e)),
11407 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11408 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
11409 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11410 fn drop(&mut self) {
11411 if self.result_ok {
11412 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11413 let _ = unsafe { Box::from_raw(self.contents.result) };
11416 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11417 let _ = unsafe { Box::from_raw(self.contents.err) };
11422 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11423 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11424 let contents = if o.result_ok {
11425 let result = unsafe { o.contents.result };
11426 unsafe { o.contents.result = std::ptr::null_mut() };
11427 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
11429 let err = unsafe { o.contents.err };
11430 unsafe { o.contents.err = std::ptr::null_mut(); }
11431 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
11435 result_ok: o.result_ok,
11439 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11440 fn clone(&self) -> Self {
11441 if self.result_ok {
11442 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11443 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11446 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11447 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11453 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11454 /// but with all dynamically-allocated buffers duplicated in new buffers.
11455 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11457 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
11458 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
11459 /// A pointer to the contents in the success state.
11460 /// Reading from this pointer when `result_ok` is not set is undefined.
11461 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
11462 /// A pointer to the contents in the error state.
11463 /// Reading from this pointer when `result_ok` is set is undefined.
11464 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11467 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11468 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11470 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
11471 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11472 /// `err` or `result` depending on the state of `result_ok`.
11473 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
11474 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11475 pub result_ok: bool,
11478 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11479 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
11480 CResult_ChannelAnnouncementDecodeErrorZ {
11481 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11482 result: Box::into_raw(Box::new(o)),
11488 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11489 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
11490 CResult_ChannelAnnouncementDecodeErrorZ {
11491 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11492 err: Box::into_raw(Box::new(e)),
11498 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11499 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
11500 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
11501 fn drop(&mut self) {
11502 if self.result_ok {
11503 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11504 let _ = unsafe { Box::from_raw(self.contents.result) };
11507 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11508 let _ = unsafe { Box::from_raw(self.contents.err) };
11513 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
11514 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11515 let contents = if o.result_ok {
11516 let result = unsafe { o.contents.result };
11517 unsafe { o.contents.result = std::ptr::null_mut() };
11518 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
11520 let err = unsafe { o.contents.err };
11521 unsafe { o.contents.err = std::ptr::null_mut(); }
11522 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
11526 result_ok: o.result_ok,
11530 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
11531 fn clone(&self) -> Self {
11532 if self.result_ok {
11533 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11534 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11537 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11538 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11544 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11545 /// but with all dynamically-allocated buffers duplicated in new buffers.
11546 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11548 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11549 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11550 /// A pointer to the contents in the success state.
11551 /// Reading from this pointer when `result_ok` is not set is undefined.
11552 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
11553 /// A pointer to the contents in the error state.
11554 /// Reading from this pointer when `result_ok` is set is undefined.
11555 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11558 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11559 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11561 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
11562 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11563 /// `err` or `result` depending on the state of `result_ok`.
11564 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
11565 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11566 pub result_ok: bool,
11569 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11570 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11571 CResult_UnsignedChannelUpdateDecodeErrorZ {
11572 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11573 result: Box::into_raw(Box::new(o)),
11579 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11580 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11581 CResult_UnsignedChannelUpdateDecodeErrorZ {
11582 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11583 err: Box::into_raw(Box::new(e)),
11589 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11590 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
11591 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
11592 fn drop(&mut self) {
11593 if self.result_ok {
11594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11595 let _ = unsafe { Box::from_raw(self.contents.result) };
11598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11599 let _ = unsafe { Box::from_raw(self.contents.err) };
11604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
11605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11606 let contents = if o.result_ok {
11607 let result = unsafe { o.contents.result };
11608 unsafe { o.contents.result = std::ptr::null_mut() };
11609 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
11611 let err = unsafe { o.contents.err };
11612 unsafe { o.contents.err = std::ptr::null_mut(); }
11613 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
11617 result_ok: o.result_ok,
11621 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
11622 fn clone(&self) -> Self {
11623 if self.result_ok {
11624 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11625 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
11628 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11635 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11636 /// but with all dynamically-allocated buffers duplicated in new buffers.
11637 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11639 /// The contents of CResult_ChannelUpdateDecodeErrorZ
11640 pub union CResult_ChannelUpdateDecodeErrorZPtr {
11641 /// A pointer to the contents in the success state.
11642 /// Reading from this pointer when `result_ok` is not set is undefined.
11643 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
11644 /// A pointer to the contents in the error state.
11645 /// Reading from this pointer when `result_ok` is set is undefined.
11646 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11649 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11650 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11652 pub struct CResult_ChannelUpdateDecodeErrorZ {
11653 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11654 /// `err` or `result` depending on the state of `result_ok`.
11655 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
11656 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11657 pub result_ok: bool,
11660 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11661 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
11662 CResult_ChannelUpdateDecodeErrorZ {
11663 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11664 result: Box::into_raw(Box::new(o)),
11670 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11671 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
11672 CResult_ChannelUpdateDecodeErrorZ {
11673 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11674 err: Box::into_raw(Box::new(e)),
11680 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11681 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
11682 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
11683 fn drop(&mut self) {
11684 if self.result_ok {
11685 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11686 let _ = unsafe { Box::from_raw(self.contents.result) };
11689 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11690 let _ = unsafe { Box::from_raw(self.contents.err) };
11695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11696 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11697 let contents = if o.result_ok {
11698 let result = unsafe { o.contents.result };
11699 unsafe { o.contents.result = std::ptr::null_mut() };
11700 CResult_ChannelUpdateDecodeErrorZPtr { result }
11702 let err = unsafe { o.contents.err };
11703 unsafe { o.contents.err = std::ptr::null_mut(); }
11704 CResult_ChannelUpdateDecodeErrorZPtr { err }
11708 result_ok: o.result_ok,
11712 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11713 fn clone(&self) -> Self {
11714 if self.result_ok {
11715 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11716 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11719 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11720 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11726 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11727 /// but with all dynamically-allocated buffers duplicated in new buffers.
11728 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11730 /// The contents of CResult_ErrorMessageDecodeErrorZ
11731 pub union CResult_ErrorMessageDecodeErrorZPtr {
11732 /// A pointer to the contents in the success state.
11733 /// Reading from this pointer when `result_ok` is not set is undefined.
11734 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11735 /// A pointer to the contents in the error state.
11736 /// Reading from this pointer when `result_ok` is set is undefined.
11737 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11740 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11741 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11743 pub struct CResult_ErrorMessageDecodeErrorZ {
11744 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11745 /// `err` or `result` depending on the state of `result_ok`.
11746 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11747 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11748 pub result_ok: bool,
11751 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11752 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11753 CResult_ErrorMessageDecodeErrorZ {
11754 contents: CResult_ErrorMessageDecodeErrorZPtr {
11755 result: Box::into_raw(Box::new(o)),
11761 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11762 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11763 CResult_ErrorMessageDecodeErrorZ {
11764 contents: CResult_ErrorMessageDecodeErrorZPtr {
11765 err: Box::into_raw(Box::new(e)),
11771 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11772 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11773 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11774 fn drop(&mut self) {
11775 if self.result_ok {
11776 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11777 let _ = unsafe { Box::from_raw(self.contents.result) };
11780 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11781 let _ = unsafe { Box::from_raw(self.contents.err) };
11786 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11787 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11788 let contents = if o.result_ok {
11789 let result = unsafe { o.contents.result };
11790 unsafe { o.contents.result = std::ptr::null_mut() };
11791 CResult_ErrorMessageDecodeErrorZPtr { result }
11793 let err = unsafe { o.contents.err };
11794 unsafe { o.contents.err = std::ptr::null_mut(); }
11795 CResult_ErrorMessageDecodeErrorZPtr { err }
11799 result_ok: o.result_ok,
11803 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11804 fn clone(&self) -> Self {
11805 if self.result_ok {
11806 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11807 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11810 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11811 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11817 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11818 /// but with all dynamically-allocated buffers duplicated in new buffers.
11819 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11821 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11822 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11823 /// A pointer to the contents in the success state.
11824 /// Reading from this pointer when `result_ok` is not set is undefined.
11825 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11826 /// A pointer to the contents in the error state.
11827 /// Reading from this pointer when `result_ok` is set is undefined.
11828 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11831 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11832 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11834 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11835 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11836 /// `err` or `result` depending on the state of `result_ok`.
11837 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11838 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11839 pub result_ok: bool,
11842 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11843 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11844 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11845 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11846 result: Box::into_raw(Box::new(o)),
11852 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11853 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11854 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11855 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11856 err: Box::into_raw(Box::new(e)),
11862 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11863 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
11864 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11865 fn drop(&mut self) {
11866 if self.result_ok {
11867 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11868 let _ = unsafe { Box::from_raw(self.contents.result) };
11871 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11872 let _ = unsafe { Box::from_raw(self.contents.err) };
11877 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11878 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11879 let contents = if o.result_ok {
11880 let result = unsafe { o.contents.result };
11881 unsafe { o.contents.result = std::ptr::null_mut() };
11882 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
11884 let err = unsafe { o.contents.err };
11885 unsafe { o.contents.err = std::ptr::null_mut(); }
11886 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
11890 result_ok: o.result_ok,
11894 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11895 fn clone(&self) -> Self {
11896 if self.result_ok {
11897 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11898 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11901 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11902 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11908 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11909 /// but with all dynamically-allocated buffers duplicated in new buffers.
11910 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11912 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
11913 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
11914 /// A pointer to the contents in the success state.
11915 /// Reading from this pointer when `result_ok` is not set is undefined.
11916 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
11917 /// A pointer to the contents in the error state.
11918 /// Reading from this pointer when `result_ok` is set is undefined.
11919 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11922 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11923 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11925 pub struct CResult_NodeAnnouncementDecodeErrorZ {
11926 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11927 /// `err` or `result` depending on the state of `result_ok`.
11928 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
11929 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11930 pub result_ok: bool,
11933 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11934 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
11935 CResult_NodeAnnouncementDecodeErrorZ {
11936 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11937 result: Box::into_raw(Box::new(o)),
11943 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11944 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
11945 CResult_NodeAnnouncementDecodeErrorZ {
11946 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11947 err: Box::into_raw(Box::new(e)),
11953 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11954 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
11955 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
11956 fn drop(&mut self) {
11957 if self.result_ok {
11958 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11959 let _ = unsafe { Box::from_raw(self.contents.result) };
11962 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11963 let _ = unsafe { Box::from_raw(self.contents.err) };
11968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
11969 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11970 let contents = if o.result_ok {
11971 let result = unsafe { o.contents.result };
11972 unsafe { o.contents.result = std::ptr::null_mut() };
11973 CResult_NodeAnnouncementDecodeErrorZPtr { result }
11975 let err = unsafe { o.contents.err };
11976 unsafe { o.contents.err = std::ptr::null_mut(); }
11977 CResult_NodeAnnouncementDecodeErrorZPtr { err }
11981 result_ok: o.result_ok,
11985 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
11986 fn clone(&self) -> Self {
11987 if self.result_ok {
11988 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11989 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11992 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11993 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11999 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
12000 /// but with all dynamically-allocated buffers duplicated in new buffers.
12001 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12003 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
12004 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
12005 /// A pointer to the contents in the success state.
12006 /// Reading from this pointer when `result_ok` is not set is undefined.
12007 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
12008 /// A pointer to the contents in the error state.
12009 /// Reading from this pointer when `result_ok` is set is undefined.
12010 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12013 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
12014 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
12015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12016 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
12017 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
12018 /// `err` or `result` depending on the state of `result_ok`.
12019 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
12020 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
12021 pub result_ok: bool,
12024 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
12025 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
12026 CResult_QueryShortChannelIdsDecodeErrorZ {
12027 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12028 result: Box::into_raw(Box::new(o)),
12034 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
12035 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
12036 CResult_QueryShortChannelIdsDecodeErrorZ {
12037 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12038 err: Box::into_raw(Box::new(e)),
12044 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
12045 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
12046 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
12047 fn drop(&mut self) {
12048 if self.result_ok {
12049 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12050 let _ = unsafe { Box::from_raw(self.contents.result) };
12053 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12054 let _ = unsafe { Box::from_raw(self.contents.err) };
12059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
12060 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
12061 let contents = if o.result_ok {
12062 let result = unsafe { o.contents.result };
12063 unsafe { o.contents.result = std::ptr::null_mut() };
12064 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
12066 let err = unsafe { o.contents.err };
12067 unsafe { o.contents.err = std::ptr::null_mut(); }
12068 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
12072 result_ok: o.result_ok,
12076 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
12077 fn clone(&self) -> Self {
12078 if self.result_ok {
12079 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12080 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
12083 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12084 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12090 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
12091 /// but with all dynamically-allocated buffers duplicated in new buffers.
12092 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
12094 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
12095 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12096 /// A pointer to the contents in the success state.
12097 /// Reading from this pointer when `result_ok` is not set is undefined.
12098 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
12099 /// A pointer to the contents in the error state.
12100 /// Reading from this pointer when `result_ok` is set is undefined.
12101 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12104 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
12105 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
12106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12107 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12108 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
12109 /// `err` or `result` depending on the state of `result_ok`.
12110 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
12111 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
12112 pub result_ok: bool,
12115 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
12116 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12117 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12118 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12119 result: Box::into_raw(Box::new(o)),
12125 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
12126 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12127 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12128 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12129 err: Box::into_raw(Box::new(e)),
12135 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
12136 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
12137 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12138 fn drop(&mut self) {
12139 if self.result_ok {
12140 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12141 let _ = unsafe { Box::from_raw(self.contents.result) };
12144 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12145 let _ = unsafe { Box::from_raw(self.contents.err) };
12150 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12151 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
12152 let contents = if o.result_ok {
12153 let result = unsafe { o.contents.result };
12154 unsafe { o.contents.result = std::ptr::null_mut() };
12155 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
12157 let err = unsafe { o.contents.err };
12158 unsafe { o.contents.err = std::ptr::null_mut(); }
12159 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
12163 result_ok: o.result_ok,
12167 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12168 fn clone(&self) -> Self {
12169 if self.result_ok {
12170 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12171 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
12174 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12175 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12181 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
12182 /// but with all dynamically-allocated buffers duplicated in new buffers.
12183 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
12185 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
12186 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
12187 /// A pointer to the contents in the success state.
12188 /// Reading from this pointer when `result_ok` is not set is undefined.
12189 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
12190 /// A pointer to the contents in the error state.
12191 /// Reading from this pointer when `result_ok` is set is undefined.
12192 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12195 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
12196 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12198 pub struct CResult_QueryChannelRangeDecodeErrorZ {
12199 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
12200 /// `err` or `result` depending on the state of `result_ok`.
12201 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
12202 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
12203 pub result_ok: bool,
12206 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
12207 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
12208 CResult_QueryChannelRangeDecodeErrorZ {
12209 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12210 result: Box::into_raw(Box::new(o)),
12216 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
12217 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
12218 CResult_QueryChannelRangeDecodeErrorZ {
12219 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12220 err: Box::into_raw(Box::new(e)),
12226 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
12227 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
12228 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
12229 fn drop(&mut self) {
12230 if self.result_ok {
12231 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12232 let _ = unsafe { Box::from_raw(self.contents.result) };
12235 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12236 let _ = unsafe { Box::from_raw(self.contents.err) };
12241 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
12242 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12243 let contents = if o.result_ok {
12244 let result = unsafe { o.contents.result };
12245 unsafe { o.contents.result = std::ptr::null_mut() };
12246 CResult_QueryChannelRangeDecodeErrorZPtr { result }
12248 let err = unsafe { o.contents.err };
12249 unsafe { o.contents.err = std::ptr::null_mut(); }
12250 CResult_QueryChannelRangeDecodeErrorZPtr { err }
12254 result_ok: o.result_ok,
12258 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
12259 fn clone(&self) -> Self {
12260 if self.result_ok {
12261 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12262 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
12265 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12266 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12272 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
12273 /// but with all dynamically-allocated buffers duplicated in new buffers.
12274 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12276 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
12277 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
12278 /// A pointer to the contents in the success state.
12279 /// Reading from this pointer when `result_ok` is not set is undefined.
12280 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
12281 /// A pointer to the contents in the error state.
12282 /// Reading from this pointer when `result_ok` is set is undefined.
12283 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12286 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12287 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12288 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12289 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
12290 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12291 /// `err` or `result` depending on the state of `result_ok`.
12292 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
12293 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12294 pub result_ok: bool,
12297 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
12298 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
12299 CResult_ReplyChannelRangeDecodeErrorZ {
12300 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12301 result: Box::into_raw(Box::new(o)),
12307 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
12308 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
12309 CResult_ReplyChannelRangeDecodeErrorZ {
12310 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12311 err: Box::into_raw(Box::new(e)),
12317 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
12318 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
12319 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
12320 fn drop(&mut self) {
12321 if self.result_ok {
12322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12323 let _ = unsafe { Box::from_raw(self.contents.result) };
12326 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12327 let _ = unsafe { Box::from_raw(self.contents.err) };
12332 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
12333 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12334 let contents = if o.result_ok {
12335 let result = unsafe { o.contents.result };
12336 unsafe { o.contents.result = std::ptr::null_mut() };
12337 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
12339 let err = unsafe { o.contents.err };
12340 unsafe { o.contents.err = std::ptr::null_mut(); }
12341 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
12345 result_ok: o.result_ok,
12349 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
12350 fn clone(&self) -> Self {
12351 if self.result_ok {
12352 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12353 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
12356 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12357 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12363 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
12364 /// but with all dynamically-allocated buffers duplicated in new buffers.
12365 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12367 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
12368 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
12369 /// A pointer to the contents in the success state.
12370 /// Reading from this pointer when `result_ok` is not set is undefined.
12371 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
12372 /// A pointer to the contents in the error state.
12373 /// Reading from this pointer when `result_ok` is set is undefined.
12374 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12377 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12378 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12380 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
12381 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12382 /// `err` or `result` depending on the state of `result_ok`.
12383 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
12384 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12385 pub result_ok: bool,
12388 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
12389 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
12390 CResult_GossipTimestampFilterDecodeErrorZ {
12391 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12392 result: Box::into_raw(Box::new(o)),
12398 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
12399 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
12400 CResult_GossipTimestampFilterDecodeErrorZ {
12401 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12402 err: Box::into_raw(Box::new(e)),
12408 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
12409 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
12410 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
12411 fn drop(&mut self) {
12412 if self.result_ok {
12413 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12414 let _ = unsafe { Box::from_raw(self.contents.result) };
12417 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12418 let _ = unsafe { Box::from_raw(self.contents.err) };
12423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
12424 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
12425 let contents = if o.result_ok {
12426 let result = unsafe { o.contents.result };
12427 unsafe { o.contents.result = std::ptr::null_mut() };
12428 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
12430 let err = unsafe { o.contents.err };
12431 unsafe { o.contents.err = std::ptr::null_mut(); }
12432 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
12436 result_ok: o.result_ok,
12440 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
12441 fn clone(&self) -> Self {
12442 if self.result_ok {
12443 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12444 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
12447 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12448 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12454 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
12455 /// but with all dynamically-allocated buffers duplicated in new buffers.
12456 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
12458 /// The contents of CResult_InvoiceSignOrCreationErrorZ
12459 pub union CResult_InvoiceSignOrCreationErrorZPtr {
12460 /// A pointer to the contents in the success state.
12461 /// Reading from this pointer when `result_ok` is not set is undefined.
12462 pub result: *mut crate::lightning_invoice::Invoice,
12463 /// A pointer to the contents in the error state.
12464 /// Reading from this pointer when `result_ok` is set is undefined.
12465 pub err: *mut crate::lightning_invoice::SignOrCreationError,
12468 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12469 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12471 pub struct CResult_InvoiceSignOrCreationErrorZ {
12472 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
12473 /// `err` or `result` depending on the state of `result_ok`.
12474 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
12475 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
12476 pub result_ok: bool,
12479 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
12480 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
12481 CResult_InvoiceSignOrCreationErrorZ {
12482 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12483 result: Box::into_raw(Box::new(o)),
12489 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
12490 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
12491 CResult_InvoiceSignOrCreationErrorZ {
12492 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12493 err: Box::into_raw(Box::new(e)),
12499 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
12500 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
12501 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
12502 fn drop(&mut self) {
12503 if self.result_ok {
12504 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12505 let _ = unsafe { Box::from_raw(self.contents.result) };
12508 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12509 let _ = unsafe { Box::from_raw(self.contents.err) };
12514 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
12515 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
12516 let contents = if o.result_ok {
12517 let result = unsafe { o.contents.result };
12518 unsafe { o.contents.result = std::ptr::null_mut() };
12519 CResult_InvoiceSignOrCreationErrorZPtr { result }
12521 let err = unsafe { o.contents.err };
12522 unsafe { o.contents.err = std::ptr::null_mut(); }
12523 CResult_InvoiceSignOrCreationErrorZPtr { err }
12527 result_ok: o.result_ok,
12531 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
12532 fn clone(&self) -> Self {
12533 if self.result_ok {
12534 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12535 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12538 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12539 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
12545 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
12546 /// but with all dynamically-allocated buffers duplicated in new buffers.
12547 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
12549 /// An enum which can either contain a crate::lightning::chain::Filter or not
12550 pub enum COption_FilterZ {
12551 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
12552 Some(crate::lightning::chain::Filter),
12553 /// When we're in this state, this COption_FilterZ contains nothing
12556 impl COption_FilterZ {
12557 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12558 if let Self::Some(_) = self { true } else { false }
12560 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12563 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
12564 if let Self::Some(v) = self { v } else { unreachable!() }
12568 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
12569 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
12570 COption_FilterZ::Some(o)
12573 /// Constructs a new COption_FilterZ containing nothing
12574 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
12575 COption_FilterZ::None
12578 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
12579 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
12581 /// The contents of CResult_LockedChannelMonitorNoneZ
12582 pub union CResult_LockedChannelMonitorNoneZPtr {
12583 /// A pointer to the contents in the success state.
12584 /// Reading from this pointer when `result_ok` is not set is undefined.
12585 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
12586 /// Note that this value is always NULL, as there are no contents in the Err variant
12587 pub err: *mut std::ffi::c_void,
12590 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
12591 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
12592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12593 pub struct CResult_LockedChannelMonitorNoneZ {
12594 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
12595 /// `err` or `result` depending on the state of `result_ok`.
12596 pub contents: CResult_LockedChannelMonitorNoneZPtr,
12597 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
12598 pub result_ok: bool,
12601 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
12602 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
12603 CResult_LockedChannelMonitorNoneZ {
12604 contents: CResult_LockedChannelMonitorNoneZPtr {
12605 result: Box::into_raw(Box::new(o)),
12611 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
12612 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
12613 CResult_LockedChannelMonitorNoneZ {
12614 contents: CResult_LockedChannelMonitorNoneZPtr {
12615 err: std::ptr::null_mut(),
12621 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
12622 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
12623 impl Drop for CResult_LockedChannelMonitorNoneZ {
12624 fn drop(&mut self) {
12625 if self.result_ok {
12626 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12627 let _ = unsafe { Box::from_raw(self.contents.result) };
12633 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
12634 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
12635 let contents = if o.result_ok {
12636 let result = unsafe { o.contents.result };
12637 unsafe { o.contents.result = std::ptr::null_mut() };
12638 CResult_LockedChannelMonitorNoneZPtr { result }
12640 let _ = unsafe { Box::from_raw(o.contents.err) };
12641 o.contents.err = std::ptr::null_mut();
12642 CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
12646 result_ok: o.result_ok,
12651 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
12652 /// This corresponds to std::vector in C++
12653 pub struct CVec_OutPointZ {
12654 /// The elements in the array.
12655 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12656 pub data: *mut crate::lightning::chain::transaction::OutPoint,
12657 /// The number of elements pointed to by `data`.
12660 impl CVec_OutPointZ {
12661 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
12662 if self.datalen == 0 { return Vec::new(); }
12663 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12664 self.data = std::ptr::null_mut();
12668 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
12669 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
12672 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
12673 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
12674 let datalen = v.len();
12675 let data = Box::into_raw(v.into_boxed_slice());
12676 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12680 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12681 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
12682 impl Drop for CVec_OutPointZ {
12683 fn drop(&mut self) {
12684 if self.datalen == 0 { return; }
12685 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
12688 impl Clone for CVec_OutPointZ {
12689 fn clone(&self) -> Self {
12690 let mut res = Vec::new();
12691 if self.datalen == 0 { return Self::from(res); }
12692 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });