2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4 /// A pointer to the contents in the success state.
5 /// Reading from this pointer when `result_ok` is not set is undefined.
6 pub result: *mut crate::c_types::SecretKey,
7 /// A pointer to the contents in the error state.
8 /// Reading from this pointer when `result_ok` is set is undefined.
9 pub err: *mut crate::c_types::Secp256k1Error,
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17 /// `err` or `result` depending on the state of `result_ok`.
18 pub contents: CResult_SecretKeyErrorZPtr,
19 /// Whether this CResult_SecretKeyErrorZ represents a success state.
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25 CResult_SecretKeyErrorZ {
26 contents: CResult_SecretKeyErrorZPtr {
27 result: Box::into_raw(Box::new(o)),
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35 CResult_SecretKeyErrorZ {
36 contents: CResult_SecretKeyErrorZPtr {
37 err: Box::into_raw(Box::new(e)),
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
48 if unsafe { !(self.contents.result as *mut ()).is_null() } {
49 let _ = unsafe { Box::from_raw(self.contents.result) };
52 if unsafe { !(self.contents.err as *mut ()).is_null() } {
53 let _ = unsafe { Box::from_raw(self.contents.err) };
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60 let contents = if o.result_ok {
61 let result = unsafe { o.contents.result };
62 unsafe { o.contents.result = std::ptr::null_mut() };
63 CResult_SecretKeyErrorZPtr { result }
65 let err = unsafe { o.contents.err };
66 unsafe { o.contents.err = std::ptr::null_mut(); }
67 CResult_SecretKeyErrorZPtr { err }
71 result_ok: o.result_ok,
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78 /// A pointer to the contents in the success state.
79 /// Reading from this pointer when `result_ok` is not set is undefined.
80 pub result: *mut crate::c_types::PublicKey,
81 /// A pointer to the contents in the error state.
82 /// Reading from this pointer when `result_ok` is set is undefined.
83 pub err: *mut crate::c_types::Secp256k1Error,
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91 /// `err` or `result` depending on the state of `result_ok`.
92 pub contents: CResult_PublicKeyErrorZPtr,
93 /// Whether this CResult_PublicKeyErrorZ represents a success state.
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99 CResult_PublicKeyErrorZ {
100 contents: CResult_PublicKeyErrorZPtr {
101 result: Box::into_raw(Box::new(o)),
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109 CResult_PublicKeyErrorZ {
110 contents: CResult_PublicKeyErrorZPtr {
111 err: Box::into_raw(Box::new(e)),
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
123 let _ = unsafe { Box::from_raw(self.contents.result) };
126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
127 let _ = unsafe { Box::from_raw(self.contents.err) };
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134 let contents = if o.result_ok {
135 let result = unsafe { o.contents.result };
136 unsafe { o.contents.result = std::ptr::null_mut() };
137 CResult_PublicKeyErrorZPtr { result }
139 let err = unsafe { o.contents.err };
140 unsafe { o.contents.err = std::ptr::null_mut(); }
141 CResult_PublicKeyErrorZPtr { err }
145 result_ok: o.result_ok,
149 impl Clone for CResult_PublicKeyErrorZ {
150 fn clone(&self) -> Self {
152 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
153 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
156 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
157 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
163 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
164 /// but with all dynamically-allocated buffers duplicated in new buffers.
165 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
167 /// The contents of CResult_TxCreationKeysDecodeErrorZ
168 pub union CResult_TxCreationKeysDecodeErrorZPtr {
169 /// A pointer to the contents in the success state.
170 /// Reading from this pointer when `result_ok` is not set is undefined.
171 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
172 /// A pointer to the contents in the error state.
173 /// Reading from this pointer when `result_ok` is set is undefined.
174 pub err: *mut crate::lightning::ln::msgs::DecodeError,
177 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
178 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
180 pub struct CResult_TxCreationKeysDecodeErrorZ {
181 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
182 /// `err` or `result` depending on the state of `result_ok`.
183 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
184 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
188 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
189 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
190 CResult_TxCreationKeysDecodeErrorZ {
191 contents: CResult_TxCreationKeysDecodeErrorZPtr {
192 result: Box::into_raw(Box::new(o)),
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
200 CResult_TxCreationKeysDecodeErrorZ {
201 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202 err: Box::into_raw(Box::new(e)),
208 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
210 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
214 let _ = unsafe { Box::from_raw(self.contents.result) };
217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
218 let _ = unsafe { Box::from_raw(self.contents.err) };
223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
225 let contents = if o.result_ok {
226 let result = unsafe { o.contents.result };
227 unsafe { o.contents.result = std::ptr::null_mut() };
228 CResult_TxCreationKeysDecodeErrorZPtr { result }
230 let err = unsafe { o.contents.err };
231 unsafe { o.contents.err = std::ptr::null_mut(); }
232 CResult_TxCreationKeysDecodeErrorZPtr { err }
236 result_ok: o.result_ok,
240 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
241 fn clone(&self) -> Self {
243 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
244 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
247 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
254 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
255 /// but with all dynamically-allocated buffers duplicated in new buffers.
256 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
258 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
259 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
260 /// A pointer to the contents in the success state.
261 /// Reading from this pointer when `result_ok` is not set is undefined.
262 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
263 /// A pointer to the contents in the error state.
264 /// Reading from this pointer when `result_ok` is set is undefined.
265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
268 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
269 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
272 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
273 /// `err` or `result` depending on the state of `result_ok`.
274 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
275 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
279 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
280 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
281 CResult_ChannelPublicKeysDecodeErrorZ {
282 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
283 result: Box::into_raw(Box::new(o)),
289 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
290 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
291 CResult_ChannelPublicKeysDecodeErrorZ {
292 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
293 err: Box::into_raw(Box::new(e)),
299 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
300 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
301 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
305 let _ = unsafe { Box::from_raw(self.contents.result) };
308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
309 let _ = unsafe { Box::from_raw(self.contents.err) };
314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
315 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
316 let contents = if o.result_ok {
317 let result = unsafe { o.contents.result };
318 unsafe { o.contents.result = std::ptr::null_mut() };
319 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
321 let err = unsafe { o.contents.err };
322 unsafe { o.contents.err = std::ptr::null_mut(); }
323 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
327 result_ok: o.result_ok,
331 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
332 fn clone(&self) -> Self {
334 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
335 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
338 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
345 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
346 /// but with all dynamically-allocated buffers duplicated in new buffers.
347 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
349 /// The contents of CResult_TxCreationKeysErrorZ
350 pub union CResult_TxCreationKeysErrorZPtr {
351 /// A pointer to the contents in the success state.
352 /// Reading from this pointer when `result_ok` is not set is undefined.
353 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
354 /// A pointer to the contents in the error state.
355 /// Reading from this pointer when `result_ok` is set is undefined.
356 pub err: *mut crate::c_types::Secp256k1Error,
359 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
360 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
362 pub struct CResult_TxCreationKeysErrorZ {
363 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
364 /// `err` or `result` depending on the state of `result_ok`.
365 pub contents: CResult_TxCreationKeysErrorZPtr,
366 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
370 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
371 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
372 CResult_TxCreationKeysErrorZ {
373 contents: CResult_TxCreationKeysErrorZPtr {
374 result: Box::into_raw(Box::new(o)),
380 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
381 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
382 CResult_TxCreationKeysErrorZ {
383 contents: CResult_TxCreationKeysErrorZPtr {
384 err: Box::into_raw(Box::new(e)),
390 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
392 impl Drop for CResult_TxCreationKeysErrorZ {
395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
396 let _ = unsafe { Box::from_raw(self.contents.result) };
399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
400 let _ = unsafe { Box::from_raw(self.contents.err) };
405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
407 let contents = if o.result_ok {
408 let result = unsafe { o.contents.result };
409 unsafe { o.contents.result = std::ptr::null_mut() };
410 CResult_TxCreationKeysErrorZPtr { result }
412 let err = unsafe { o.contents.err };
413 unsafe { o.contents.err = std::ptr::null_mut(); }
414 CResult_TxCreationKeysErrorZPtr { err }
418 result_ok: o.result_ok,
422 impl Clone for CResult_TxCreationKeysErrorZ {
423 fn clone(&self) -> Self {
425 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
426 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
429 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
430 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
436 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
437 /// but with all dynamically-allocated buffers duplicated in new buffers.
438 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
441 /// An enum which can either contain a u32 or not
442 pub enum COption_u32Z {
443 /// When we're in this state, this COption_u32Z contains a u32
445 /// When we're in this state, this COption_u32Z contains nothing
449 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
450 if let Self::Some(_) = self { true } else { false }
452 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
455 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
456 if let Self::Some(v) = self { v } else { unreachable!() }
460 /// Constructs a new COption_u32Z containing a u32
461 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
462 COption_u32Z::Some(o)
465 /// Constructs a new COption_u32Z containing nothing
466 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
470 /// Frees any resources associated with the u32, if we are in the Some state
471 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
473 /// Creates a new COption_u32Z which has the same data as `orig`
474 /// but with all dynamically-allocated buffers duplicated in new buffers.
475 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
477 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
478 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
479 /// A pointer to the contents in the success state.
480 /// Reading from this pointer when `result_ok` is not set is undefined.
481 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
482 /// A pointer to the contents in the error state.
483 /// Reading from this pointer when `result_ok` is set is undefined.
484 pub err: *mut crate::lightning::ln::msgs::DecodeError,
487 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
488 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
490 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
491 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
492 /// `err` or `result` depending on the state of `result_ok`.
493 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
494 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
498 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
499 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
500 CResult_HTLCOutputInCommitmentDecodeErrorZ {
501 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
502 result: Box::into_raw(Box::new(o)),
508 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
509 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
510 CResult_HTLCOutputInCommitmentDecodeErrorZ {
511 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
512 err: Box::into_raw(Box::new(e)),
518 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
519 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
520 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
523 if unsafe { !(self.contents.result as *mut ()).is_null() } {
524 let _ = unsafe { Box::from_raw(self.contents.result) };
527 if unsafe { !(self.contents.err as *mut ()).is_null() } {
528 let _ = unsafe { Box::from_raw(self.contents.err) };
533 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
534 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
535 let contents = if o.result_ok {
536 let result = unsafe { o.contents.result };
537 unsafe { o.contents.result = std::ptr::null_mut() };
538 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
540 let err = unsafe { o.contents.err };
541 unsafe { o.contents.err = std::ptr::null_mut(); }
542 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
546 result_ok: o.result_ok,
550 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
551 fn clone(&self) -> Self {
553 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
554 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
557 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
558 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
564 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
565 /// but with all dynamically-allocated buffers duplicated in new buffers.
566 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
568 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
569 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
570 /// A pointer to the contents in the success state.
571 /// Reading from this pointer when `result_ok` is not set is undefined.
572 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
573 /// A pointer to the contents in the error state.
574 /// Reading from this pointer when `result_ok` is set is undefined.
575 pub err: *mut crate::lightning::ln::msgs::DecodeError,
578 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
579 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
581 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
582 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
583 /// `err` or `result` depending on the state of `result_ok`.
584 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
585 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
589 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
590 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
591 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
592 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
593 result: Box::into_raw(Box::new(o)),
599 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
600 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
601 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
602 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
603 err: Box::into_raw(Box::new(e)),
609 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
610 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
611 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
614 if unsafe { !(self.contents.result as *mut ()).is_null() } {
615 let _ = unsafe { Box::from_raw(self.contents.result) };
618 if unsafe { !(self.contents.err as *mut ()).is_null() } {
619 let _ = unsafe { Box::from_raw(self.contents.err) };
624 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
625 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
626 let contents = if o.result_ok {
627 let result = unsafe { o.contents.result };
628 unsafe { o.contents.result = std::ptr::null_mut() };
629 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
631 let err = unsafe { o.contents.err };
632 unsafe { o.contents.err = std::ptr::null_mut(); }
633 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
637 result_ok: o.result_ok,
641 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
642 fn clone(&self) -> Self {
644 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
645 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
648 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
649 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
655 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
656 /// but with all dynamically-allocated buffers duplicated in new buffers.
657 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
659 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
660 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
661 /// A pointer to the contents in the success state.
662 /// Reading from this pointer when `result_ok` is not set is undefined.
663 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
664 /// A pointer to the contents in the error state.
665 /// Reading from this pointer when `result_ok` is set is undefined.
666 pub err: *mut crate::lightning::ln::msgs::DecodeError,
669 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
670 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
672 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
673 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
674 /// `err` or `result` depending on the state of `result_ok`.
675 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
676 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
680 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
681 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
682 CResult_ChannelTransactionParametersDecodeErrorZ {
683 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
684 result: Box::into_raw(Box::new(o)),
690 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
691 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
692 CResult_ChannelTransactionParametersDecodeErrorZ {
693 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
694 err: Box::into_raw(Box::new(e)),
700 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
701 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
702 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
705 if unsafe { !(self.contents.result as *mut ()).is_null() } {
706 let _ = unsafe { Box::from_raw(self.contents.result) };
709 if unsafe { !(self.contents.err as *mut ()).is_null() } {
710 let _ = unsafe { Box::from_raw(self.contents.err) };
715 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
716 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
717 let contents = if o.result_ok {
718 let result = unsafe { o.contents.result };
719 unsafe { o.contents.result = std::ptr::null_mut() };
720 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
722 let err = unsafe { o.contents.err };
723 unsafe { o.contents.err = std::ptr::null_mut(); }
724 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
728 result_ok: o.result_ok,
732 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
733 fn clone(&self) -> Self {
735 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
736 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
739 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
740 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
746 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
747 /// but with all dynamically-allocated buffers duplicated in new buffers.
748 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
750 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
751 /// This corresponds to std::vector in C++
752 pub struct CVec_SignatureZ {
753 /// The elements in the array.
754 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
755 pub data: *mut crate::c_types::Signature,
756 /// The number of elements pointed to by `data`.
759 impl CVec_SignatureZ {
760 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
761 if self.datalen == 0 { return Vec::new(); }
762 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
763 self.data = std::ptr::null_mut();
767 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
768 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
771 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
772 fn from(v: Vec<crate::c_types::Signature>) -> Self {
773 let datalen = v.len();
774 let data = Box::into_raw(v.into_boxed_slice());
775 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
779 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
780 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
781 impl Drop for CVec_SignatureZ {
783 if self.datalen == 0 { return; }
784 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
787 impl Clone for CVec_SignatureZ {
788 fn clone(&self) -> Self {
789 let mut res = Vec::new();
790 if self.datalen == 0 { return Self::from(res); }
791 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
796 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
797 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
798 /// A pointer to the contents in the success state.
799 /// Reading from this pointer when `result_ok` is not set is undefined.
800 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
801 /// A pointer to the contents in the error state.
802 /// Reading from this pointer when `result_ok` is set is undefined.
803 pub err: *mut crate::lightning::ln::msgs::DecodeError,
806 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
807 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
809 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
810 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
811 /// `err` or `result` depending on the state of `result_ok`.
812 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
813 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
817 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
818 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
819 CResult_HolderCommitmentTransactionDecodeErrorZ {
820 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
821 result: Box::into_raw(Box::new(o)),
827 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
828 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
829 CResult_HolderCommitmentTransactionDecodeErrorZ {
830 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
831 err: Box::into_raw(Box::new(e)),
837 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
838 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
839 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
843 let _ = unsafe { Box::from_raw(self.contents.result) };
846 if unsafe { !(self.contents.err as *mut ()).is_null() } {
847 let _ = unsafe { Box::from_raw(self.contents.err) };
852 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
853 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
854 let contents = if o.result_ok {
855 let result = unsafe { o.contents.result };
856 unsafe { o.contents.result = std::ptr::null_mut() };
857 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
859 let err = unsafe { o.contents.err };
860 unsafe { o.contents.err = std::ptr::null_mut(); }
861 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
865 result_ok: o.result_ok,
869 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
870 fn clone(&self) -> Self {
872 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
873 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
876 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
877 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
883 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
884 /// but with all dynamically-allocated buffers duplicated in new buffers.
885 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
887 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
888 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
889 /// A pointer to the contents in the success state.
890 /// Reading from this pointer when `result_ok` is not set is undefined.
891 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
892 /// A pointer to the contents in the error state.
893 /// Reading from this pointer when `result_ok` is set is undefined.
894 pub err: *mut crate::lightning::ln::msgs::DecodeError,
897 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
898 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
900 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
901 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
902 /// `err` or `result` depending on the state of `result_ok`.
903 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
904 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
908 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
909 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
910 CResult_BuiltCommitmentTransactionDecodeErrorZ {
911 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
912 result: Box::into_raw(Box::new(o)),
918 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
919 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
920 CResult_BuiltCommitmentTransactionDecodeErrorZ {
921 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
922 err: Box::into_raw(Box::new(e)),
928 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
929 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
930 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
934 let _ = unsafe { Box::from_raw(self.contents.result) };
937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
938 let _ = unsafe { Box::from_raw(self.contents.err) };
943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
944 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
945 let contents = if o.result_ok {
946 let result = unsafe { o.contents.result };
947 unsafe { o.contents.result = std::ptr::null_mut() };
948 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
950 let err = unsafe { o.contents.err };
951 unsafe { o.contents.err = std::ptr::null_mut(); }
952 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
956 result_ok: o.result_ok,
960 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
961 fn clone(&self) -> Self {
963 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
964 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
967 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
968 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
974 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
975 /// but with all dynamically-allocated buffers duplicated in new buffers.
976 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
978 /// The contents of CResult_TrustedClosingTransactionNoneZ
979 pub union CResult_TrustedClosingTransactionNoneZPtr {
980 /// A pointer to the contents in the success state.
981 /// Reading from this pointer when `result_ok` is not set is undefined.
982 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
983 /// Note that this value is always NULL, as there are no contents in the Err variant
984 pub err: *mut std::ffi::c_void,
987 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
988 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
990 pub struct CResult_TrustedClosingTransactionNoneZ {
991 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
992 /// `err` or `result` depending on the state of `result_ok`.
993 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
994 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
998 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
999 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1000 CResult_TrustedClosingTransactionNoneZ {
1001 contents: CResult_TrustedClosingTransactionNoneZPtr {
1002 result: Box::into_raw(Box::new(o)),
1008 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1009 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1010 CResult_TrustedClosingTransactionNoneZ {
1011 contents: CResult_TrustedClosingTransactionNoneZPtr {
1012 err: std::ptr::null_mut(),
1018 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1019 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1020 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1021 fn drop(&mut self) {
1023 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1024 let _ = unsafe { Box::from_raw(self.contents.result) };
1030 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1031 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1032 let contents = if o.result_ok {
1033 let result = unsafe { o.contents.result };
1034 unsafe { o.contents.result = std::ptr::null_mut() };
1035 CResult_TrustedClosingTransactionNoneZPtr { result }
1037 let _ = unsafe { Box::from_raw(o.contents.err) };
1038 o.contents.err = std::ptr::null_mut();
1039 CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1043 result_ok: o.result_ok,
1048 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1049 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1050 /// A pointer to the contents in the success state.
1051 /// Reading from this pointer when `result_ok` is not set is undefined.
1052 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1053 /// A pointer to the contents in the error state.
1054 /// Reading from this pointer when `result_ok` is set is undefined.
1055 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1058 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1059 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1061 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1062 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1063 /// `err` or `result` depending on the state of `result_ok`.
1064 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1065 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1066 pub result_ok: bool,
1069 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1070 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1071 CResult_CommitmentTransactionDecodeErrorZ {
1072 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1073 result: Box::into_raw(Box::new(o)),
1079 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1080 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1081 CResult_CommitmentTransactionDecodeErrorZ {
1082 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1083 err: Box::into_raw(Box::new(e)),
1089 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1090 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1091 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1092 fn drop(&mut self) {
1094 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1095 let _ = unsafe { Box::from_raw(self.contents.result) };
1098 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1099 let _ = unsafe { Box::from_raw(self.contents.err) };
1104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1105 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1106 let contents = if o.result_ok {
1107 let result = unsafe { o.contents.result };
1108 unsafe { o.contents.result = std::ptr::null_mut() };
1109 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1111 let err = unsafe { o.contents.err };
1112 unsafe { o.contents.err = std::ptr::null_mut(); }
1113 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1117 result_ok: o.result_ok,
1121 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1122 fn clone(&self) -> Self {
1124 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1125 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1128 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1129 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1135 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1136 /// but with all dynamically-allocated buffers duplicated in new buffers.
1137 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1139 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1140 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1141 /// A pointer to the contents in the success state.
1142 /// Reading from this pointer when `result_ok` is not set is undefined.
1143 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1144 /// Note that this value is always NULL, as there are no contents in the Err variant
1145 pub err: *mut std::ffi::c_void,
1148 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1149 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1151 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1152 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1153 /// `err` or `result` depending on the state of `result_ok`.
1154 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1155 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1156 pub result_ok: bool,
1159 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1160 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1161 CResult_TrustedCommitmentTransactionNoneZ {
1162 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1163 result: Box::into_raw(Box::new(o)),
1169 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1170 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1171 CResult_TrustedCommitmentTransactionNoneZ {
1172 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1173 err: std::ptr::null_mut(),
1179 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1180 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1181 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1182 fn drop(&mut self) {
1184 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1185 let _ = unsafe { Box::from_raw(self.contents.result) };
1191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1192 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1193 let contents = if o.result_ok {
1194 let result = unsafe { o.contents.result };
1195 unsafe { o.contents.result = std::ptr::null_mut() };
1196 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1198 let _ = unsafe { Box::from_raw(o.contents.err) };
1199 o.contents.err = std::ptr::null_mut();
1200 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1204 result_ok: o.result_ok,
1209 /// The contents of CResult_CVec_SignatureZNoneZ
1210 pub union CResult_CVec_SignatureZNoneZPtr {
1211 /// A pointer to the contents in the success state.
1212 /// Reading from this pointer when `result_ok` is not set is undefined.
1213 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1214 /// Note that this value is always NULL, as there are no contents in the Err variant
1215 pub err: *mut std::ffi::c_void,
1218 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1219 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1220 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1221 pub struct CResult_CVec_SignatureZNoneZ {
1222 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1223 /// `err` or `result` depending on the state of `result_ok`.
1224 pub contents: CResult_CVec_SignatureZNoneZPtr,
1225 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1226 pub result_ok: bool,
1229 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1230 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1231 CResult_CVec_SignatureZNoneZ {
1232 contents: CResult_CVec_SignatureZNoneZPtr {
1233 result: Box::into_raw(Box::new(o)),
1239 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1240 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1241 CResult_CVec_SignatureZNoneZ {
1242 contents: CResult_CVec_SignatureZNoneZPtr {
1243 err: std::ptr::null_mut(),
1249 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1250 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1251 impl Drop for CResult_CVec_SignatureZNoneZ {
1252 fn drop(&mut self) {
1254 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1255 let _ = unsafe { Box::from_raw(self.contents.result) };
1261 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1262 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1263 let contents = if o.result_ok {
1264 let result = unsafe { o.contents.result };
1265 unsafe { o.contents.result = std::ptr::null_mut() };
1266 CResult_CVec_SignatureZNoneZPtr { result }
1268 let _ = unsafe { Box::from_raw(o.contents.err) };
1269 o.contents.err = std::ptr::null_mut();
1270 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1274 result_ok: o.result_ok,
1278 impl Clone for CResult_CVec_SignatureZNoneZ {
1279 fn clone(&self) -> Self {
1281 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1282 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1285 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1286 err: std::ptr::null_mut()
1292 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1293 /// but with all dynamically-allocated buffers duplicated in new buffers.
1294 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1296 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1297 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1298 /// A pointer to the contents in the success state.
1299 /// Reading from this pointer when `result_ok` is not set is undefined.
1300 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1301 /// A pointer to the contents in the error state.
1302 /// Reading from this pointer when `result_ok` is set is undefined.
1303 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1306 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1307 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1309 pub struct CResult_ShutdownScriptDecodeErrorZ {
1310 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1311 /// `err` or `result` depending on the state of `result_ok`.
1312 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1313 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1314 pub result_ok: bool,
1317 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1318 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1319 CResult_ShutdownScriptDecodeErrorZ {
1320 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1321 result: Box::into_raw(Box::new(o)),
1327 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1328 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1329 CResult_ShutdownScriptDecodeErrorZ {
1330 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1331 err: Box::into_raw(Box::new(e)),
1337 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1338 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1339 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1340 fn drop(&mut self) {
1342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1343 let _ = unsafe { Box::from_raw(self.contents.result) };
1346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1347 let _ = unsafe { Box::from_raw(self.contents.err) };
1352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1353 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1354 let contents = if o.result_ok {
1355 let result = unsafe { o.contents.result };
1356 unsafe { o.contents.result = std::ptr::null_mut() };
1357 CResult_ShutdownScriptDecodeErrorZPtr { result }
1359 let err = unsafe { o.contents.err };
1360 unsafe { o.contents.err = std::ptr::null_mut(); }
1361 CResult_ShutdownScriptDecodeErrorZPtr { err }
1365 result_ok: o.result_ok,
1369 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1370 fn clone(&self) -> Self {
1372 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1373 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1376 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1377 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1383 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1384 /// but with all dynamically-allocated buffers duplicated in new buffers.
1385 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1387 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1388 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1389 /// A pointer to the contents in the success state.
1390 /// Reading from this pointer when `result_ok` is not set is undefined.
1391 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1392 /// A pointer to the contents in the error state.
1393 /// Reading from this pointer when `result_ok` is set is undefined.
1394 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1397 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1398 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1400 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1401 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1402 /// `err` or `result` depending on the state of `result_ok`.
1403 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1404 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1405 pub result_ok: bool,
1408 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1409 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1410 CResult_ShutdownScriptInvalidShutdownScriptZ {
1411 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1412 result: Box::into_raw(Box::new(o)),
1418 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1419 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1420 CResult_ShutdownScriptInvalidShutdownScriptZ {
1421 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1422 err: Box::into_raw(Box::new(e)),
1428 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1429 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1430 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1431 fn drop(&mut self) {
1433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1434 let _ = unsafe { Box::from_raw(self.contents.result) };
1437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1438 let _ = unsafe { Box::from_raw(self.contents.err) };
1443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1444 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1445 let contents = if o.result_ok {
1446 let result = unsafe { o.contents.result };
1447 unsafe { o.contents.result = std::ptr::null_mut() };
1448 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1450 let err = unsafe { o.contents.err };
1451 unsafe { o.contents.err = std::ptr::null_mut(); }
1452 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1456 result_ok: o.result_ok,
1461 /// The contents of CResult_NoneErrorZ
1462 pub union CResult_NoneErrorZPtr {
1463 /// Note that this value is always NULL, as there are no contents in the OK variant
1464 pub result: *mut std::ffi::c_void,
1465 /// A pointer to the contents in the error state.
1466 /// Reading from this pointer when `result_ok` is set is undefined.
1467 pub err: *mut crate::c_types::IOError,
1470 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1471 /// containing a () on success and a crate::c_types::IOError on failure.
1472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1473 pub struct CResult_NoneErrorZ {
1474 /// The contents of this CResult_NoneErrorZ, accessible via either
1475 /// `err` or `result` depending on the state of `result_ok`.
1476 pub contents: CResult_NoneErrorZPtr,
1477 /// Whether this CResult_NoneErrorZ represents a success state.
1478 pub result_ok: bool,
1481 /// Creates a new CResult_NoneErrorZ in the success state.
1482 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1483 CResult_NoneErrorZ {
1484 contents: CResult_NoneErrorZPtr {
1485 result: std::ptr::null_mut(),
1491 /// Creates a new CResult_NoneErrorZ in the error state.
1492 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1493 CResult_NoneErrorZ {
1494 contents: CResult_NoneErrorZPtr {
1495 err: Box::into_raw(Box::new(e)),
1501 /// Frees any resources used by the CResult_NoneErrorZ.
1502 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1503 impl Drop for CResult_NoneErrorZ {
1504 fn drop(&mut self) {
1507 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1508 let _ = unsafe { Box::from_raw(self.contents.err) };
1513 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1514 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1515 let contents = if o.result_ok {
1516 let _ = unsafe { Box::from_raw(o.contents.result) };
1517 o.contents.result = std::ptr::null_mut();
1518 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1520 let err = unsafe { o.contents.err };
1521 unsafe { o.contents.err = std::ptr::null_mut(); }
1522 CResult_NoneErrorZPtr { err }
1526 result_ok: o.result_ok,
1530 impl Clone for CResult_NoneErrorZ {
1531 fn clone(&self) -> Self {
1533 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1534 result: std::ptr::null_mut()
1537 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1538 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1544 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1545 /// but with all dynamically-allocated buffers duplicated in new buffers.
1546 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1548 /// The contents of CResult_RouteHopDecodeErrorZ
1549 pub union CResult_RouteHopDecodeErrorZPtr {
1550 /// A pointer to the contents in the success state.
1551 /// Reading from this pointer when `result_ok` is not set is undefined.
1552 pub result: *mut crate::lightning::routing::router::RouteHop,
1553 /// A pointer to the contents in the error state.
1554 /// Reading from this pointer when `result_ok` is set is undefined.
1555 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1558 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1559 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1561 pub struct CResult_RouteHopDecodeErrorZ {
1562 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1563 /// `err` or `result` depending on the state of `result_ok`.
1564 pub contents: CResult_RouteHopDecodeErrorZPtr,
1565 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1566 pub result_ok: bool,
1569 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1570 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1571 CResult_RouteHopDecodeErrorZ {
1572 contents: CResult_RouteHopDecodeErrorZPtr {
1573 result: Box::into_raw(Box::new(o)),
1579 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1580 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1581 CResult_RouteHopDecodeErrorZ {
1582 contents: CResult_RouteHopDecodeErrorZPtr {
1583 err: Box::into_raw(Box::new(e)),
1589 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1590 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1591 impl Drop for CResult_RouteHopDecodeErrorZ {
1592 fn drop(&mut self) {
1594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1595 let _ = unsafe { Box::from_raw(self.contents.result) };
1598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1599 let _ = unsafe { Box::from_raw(self.contents.err) };
1604 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1606 let contents = if o.result_ok {
1607 let result = unsafe { o.contents.result };
1608 unsafe { o.contents.result = std::ptr::null_mut() };
1609 CResult_RouteHopDecodeErrorZPtr { result }
1611 let err = unsafe { o.contents.err };
1612 unsafe { o.contents.err = std::ptr::null_mut(); }
1613 CResult_RouteHopDecodeErrorZPtr { err }
1617 result_ok: o.result_ok,
1621 impl Clone for CResult_RouteHopDecodeErrorZ {
1622 fn clone(&self) -> Self {
1624 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1625 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1628 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1635 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1636 /// but with all dynamically-allocated buffers duplicated in new buffers.
1637 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1639 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1640 /// This corresponds to std::vector in C++
1641 pub struct CVec_RouteHopZ {
1642 /// The elements in the array.
1643 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1644 pub data: *mut crate::lightning::routing::router::RouteHop,
1645 /// The number of elements pointed to by `data`.
1648 impl CVec_RouteHopZ {
1649 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1650 if self.datalen == 0 { return Vec::new(); }
1651 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1652 self.data = std::ptr::null_mut();
1656 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1657 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1660 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1661 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1662 let datalen = v.len();
1663 let data = Box::into_raw(v.into_boxed_slice());
1664 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1668 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1669 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1670 impl Drop for CVec_RouteHopZ {
1671 fn drop(&mut self) {
1672 if self.datalen == 0 { return; }
1673 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1676 impl Clone for CVec_RouteHopZ {
1677 fn clone(&self) -> Self {
1678 let mut res = Vec::new();
1679 if self.datalen == 0 { return Self::from(res); }
1680 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1685 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1686 /// This corresponds to std::vector in C++
1687 pub struct CVec_CVec_RouteHopZZ {
1688 /// The elements in the array.
1689 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1690 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1691 /// The number of elements pointed to by `data`.
1694 impl CVec_CVec_RouteHopZZ {
1695 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1696 if self.datalen == 0 { return Vec::new(); }
1697 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1698 self.data = std::ptr::null_mut();
1702 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1703 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1706 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1707 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1708 let datalen = v.len();
1709 let data = Box::into_raw(v.into_boxed_slice());
1710 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1714 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1715 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1716 impl Drop for CVec_CVec_RouteHopZZ {
1717 fn drop(&mut self) {
1718 if self.datalen == 0 { return; }
1719 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1722 impl Clone for CVec_CVec_RouteHopZZ {
1723 fn clone(&self) -> Self {
1724 let mut res = Vec::new();
1725 if self.datalen == 0 { return Self::from(res); }
1726 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1731 /// The contents of CResult_RouteDecodeErrorZ
1732 pub union CResult_RouteDecodeErrorZPtr {
1733 /// A pointer to the contents in the success state.
1734 /// Reading from this pointer when `result_ok` is not set is undefined.
1735 pub result: *mut crate::lightning::routing::router::Route,
1736 /// A pointer to the contents in the error state.
1737 /// Reading from this pointer when `result_ok` is set is undefined.
1738 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1741 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1742 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1744 pub struct CResult_RouteDecodeErrorZ {
1745 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1746 /// `err` or `result` depending on the state of `result_ok`.
1747 pub contents: CResult_RouteDecodeErrorZPtr,
1748 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1749 pub result_ok: bool,
1752 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1753 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1754 CResult_RouteDecodeErrorZ {
1755 contents: CResult_RouteDecodeErrorZPtr {
1756 result: Box::into_raw(Box::new(o)),
1762 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1763 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1764 CResult_RouteDecodeErrorZ {
1765 contents: CResult_RouteDecodeErrorZPtr {
1766 err: Box::into_raw(Box::new(e)),
1772 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1773 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1774 impl Drop for CResult_RouteDecodeErrorZ {
1775 fn drop(&mut self) {
1777 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1778 let _ = unsafe { Box::from_raw(self.contents.result) };
1781 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1782 let _ = unsafe { Box::from_raw(self.contents.err) };
1787 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1788 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1789 let contents = if o.result_ok {
1790 let result = unsafe { o.contents.result };
1791 unsafe { o.contents.result = std::ptr::null_mut() };
1792 CResult_RouteDecodeErrorZPtr { result }
1794 let err = unsafe { o.contents.err };
1795 unsafe { o.contents.err = std::ptr::null_mut(); }
1796 CResult_RouteDecodeErrorZPtr { err }
1800 result_ok: o.result_ok,
1804 impl Clone for CResult_RouteDecodeErrorZ {
1805 fn clone(&self) -> Self {
1807 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1808 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1811 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1812 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1818 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1819 /// but with all dynamically-allocated buffers duplicated in new buffers.
1820 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1823 /// An enum which can either contain a u64 or not
1824 pub enum COption_u64Z {
1825 /// When we're in this state, this COption_u64Z contains a u64
1827 /// When we're in this state, this COption_u64Z contains nothing
1831 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1832 if let Self::Some(_) = self { true } else { false }
1834 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1837 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1838 if let Self::Some(v) = self { v } else { unreachable!() }
1842 /// Constructs a new COption_u64Z containing a u64
1843 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1844 COption_u64Z::Some(o)
1847 /// Constructs a new COption_u64Z containing nothing
1848 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1852 /// Frees any resources associated with the u64, if we are in the Some state
1853 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1855 /// Creates a new COption_u64Z which has the same data as `orig`
1856 /// but with all dynamically-allocated buffers duplicated in new buffers.
1857 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
1859 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1860 /// This corresponds to std::vector in C++
1861 pub struct CVec_ChannelDetailsZ {
1862 /// The elements in the array.
1863 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1864 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
1865 /// The number of elements pointed to by `data`.
1868 impl CVec_ChannelDetailsZ {
1869 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
1870 if self.datalen == 0 { return Vec::new(); }
1871 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1872 self.data = std::ptr::null_mut();
1876 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
1877 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1880 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1881 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
1882 let datalen = v.len();
1883 let data = Box::into_raw(v.into_boxed_slice());
1884 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1888 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1889 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1890 impl Drop for CVec_ChannelDetailsZ {
1891 fn drop(&mut self) {
1892 if self.datalen == 0 { return; }
1893 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1896 impl Clone for CVec_ChannelDetailsZ {
1897 fn clone(&self) -> Self {
1898 let mut res = Vec::new();
1899 if self.datalen == 0 { return Self::from(res); }
1900 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1905 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1906 /// This corresponds to std::vector in C++
1907 pub struct CVec_RouteHintZ {
1908 /// The elements in the array.
1909 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1910 pub data: *mut crate::lightning::routing::router::RouteHint,
1911 /// The number of elements pointed to by `data`.
1914 impl CVec_RouteHintZ {
1915 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1916 if self.datalen == 0 { return Vec::new(); }
1917 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1918 self.data = std::ptr::null_mut();
1922 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1923 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1926 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1927 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1928 let datalen = v.len();
1929 let data = Box::into_raw(v.into_boxed_slice());
1930 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1934 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1935 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1936 impl Drop for CVec_RouteHintZ {
1937 fn drop(&mut self) {
1938 if self.datalen == 0 { return; }
1939 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1942 impl Clone for CVec_RouteHintZ {
1943 fn clone(&self) -> Self {
1944 let mut res = Vec::new();
1945 if self.datalen == 0 { return Self::from(res); }
1946 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1951 /// The contents of CResult_RouteLightningErrorZ
1952 pub union CResult_RouteLightningErrorZPtr {
1953 /// A pointer to the contents in the success state.
1954 /// Reading from this pointer when `result_ok` is not set is undefined.
1955 pub result: *mut crate::lightning::routing::router::Route,
1956 /// A pointer to the contents in the error state.
1957 /// Reading from this pointer when `result_ok` is set is undefined.
1958 pub err: *mut crate::lightning::ln::msgs::LightningError,
1961 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1962 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1964 pub struct CResult_RouteLightningErrorZ {
1965 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
1966 /// `err` or `result` depending on the state of `result_ok`.
1967 pub contents: CResult_RouteLightningErrorZPtr,
1968 /// Whether this CResult_RouteLightningErrorZ represents a success state.
1969 pub result_ok: bool,
1972 /// Creates a new CResult_RouteLightningErrorZ in the success state.
1973 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
1974 CResult_RouteLightningErrorZ {
1975 contents: CResult_RouteLightningErrorZPtr {
1976 result: Box::into_raw(Box::new(o)),
1982 /// Creates a new CResult_RouteLightningErrorZ in the error state.
1983 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
1984 CResult_RouteLightningErrorZ {
1985 contents: CResult_RouteLightningErrorZPtr {
1986 err: Box::into_raw(Box::new(e)),
1992 /// Frees any resources used by the CResult_RouteLightningErrorZ.
1993 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
1994 impl Drop for CResult_RouteLightningErrorZ {
1995 fn drop(&mut self) {
1997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1998 let _ = unsafe { Box::from_raw(self.contents.result) };
2001 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2002 let _ = unsafe { Box::from_raw(self.contents.err) };
2007 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2008 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2009 let contents = if o.result_ok {
2010 let result = unsafe { o.contents.result };
2011 unsafe { o.contents.result = std::ptr::null_mut() };
2012 CResult_RouteLightningErrorZPtr { result }
2014 let err = unsafe { o.contents.err };
2015 unsafe { o.contents.err = std::ptr::null_mut(); }
2016 CResult_RouteLightningErrorZPtr { err }
2020 result_ok: o.result_ok,
2024 impl Clone for CResult_RouteLightningErrorZ {
2025 fn clone(&self) -> Self {
2027 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2028 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2031 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2032 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2038 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2039 /// but with all dynamically-allocated buffers duplicated in new buffers.
2040 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2042 /// The contents of CResult_TxOutAccessErrorZ
2043 pub union CResult_TxOutAccessErrorZPtr {
2044 /// A pointer to the contents in the success state.
2045 /// Reading from this pointer when `result_ok` is not set is undefined.
2046 pub result: *mut crate::c_types::TxOut,
2047 /// A pointer to the contents in the error state.
2048 /// Reading from this pointer when `result_ok` is set is undefined.
2049 pub err: *mut crate::lightning::chain::AccessError,
2052 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2053 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2055 pub struct CResult_TxOutAccessErrorZ {
2056 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2057 /// `err` or `result` depending on the state of `result_ok`.
2058 pub contents: CResult_TxOutAccessErrorZPtr,
2059 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2060 pub result_ok: bool,
2063 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2064 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2065 CResult_TxOutAccessErrorZ {
2066 contents: CResult_TxOutAccessErrorZPtr {
2067 result: Box::into_raw(Box::new(o)),
2073 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2074 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2075 CResult_TxOutAccessErrorZ {
2076 contents: CResult_TxOutAccessErrorZPtr {
2077 err: Box::into_raw(Box::new(e)),
2083 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2084 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2085 impl Drop for CResult_TxOutAccessErrorZ {
2086 fn drop(&mut self) {
2088 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2089 let _ = unsafe { Box::from_raw(self.contents.result) };
2092 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2093 let _ = unsafe { Box::from_raw(self.contents.err) };
2098 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2099 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2100 let contents = if o.result_ok {
2101 let result = unsafe { o.contents.result };
2102 unsafe { o.contents.result = std::ptr::null_mut() };
2103 CResult_TxOutAccessErrorZPtr { result }
2105 let err = unsafe { o.contents.err };
2106 unsafe { o.contents.err = std::ptr::null_mut(); }
2107 CResult_TxOutAccessErrorZPtr { err }
2111 result_ok: o.result_ok,
2115 impl Clone for CResult_TxOutAccessErrorZ {
2116 fn clone(&self) -> Self {
2118 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2119 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2122 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2123 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2129 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2130 /// but with all dynamically-allocated buffers duplicated in new buffers.
2131 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2133 /// A tuple of 2 elements. See the individual fields for the types contained.
2134 pub struct C2Tuple_usizeTransactionZ {
2135 /// The element at position 0
2137 /// The element at position 1
2138 pub b: crate::c_types::Transaction,
2140 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2141 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2148 impl C2Tuple_usizeTransactionZ {
2149 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2153 impl Clone for C2Tuple_usizeTransactionZ {
2154 fn clone(&self) -> Self {
2156 a: Clone::clone(&self.a),
2157 b: Clone::clone(&self.b),
2162 /// Creates a new tuple which has the same data as `orig`
2163 /// but with all dynamically-allocated buffers duplicated in new buffers.
2164 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2165 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2167 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2168 C2Tuple_usizeTransactionZ { a, b, }
2172 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2173 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2175 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2176 /// This corresponds to std::vector in C++
2177 pub struct CVec_C2Tuple_usizeTransactionZZ {
2178 /// The elements in the array.
2179 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2180 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2181 /// The number of elements pointed to by `data`.
2184 impl CVec_C2Tuple_usizeTransactionZZ {
2185 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2186 if self.datalen == 0 { return Vec::new(); }
2187 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2188 self.data = std::ptr::null_mut();
2192 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2193 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2196 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2197 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2198 let datalen = v.len();
2199 let data = Box::into_raw(v.into_boxed_slice());
2200 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2205 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2206 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2207 fn drop(&mut self) {
2208 if self.datalen == 0 { return; }
2209 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2212 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2213 fn clone(&self) -> Self {
2214 let mut res = Vec::new();
2215 if self.datalen == 0 { return Self::from(res); }
2216 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2221 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2222 /// This corresponds to std::vector in C++
2223 pub struct CVec_TxidZ {
2224 /// The elements in the array.
2225 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2226 pub data: *mut crate::c_types::ThirtyTwoBytes,
2227 /// The number of elements pointed to by `data`.
2231 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2232 if self.datalen == 0 { return Vec::new(); }
2233 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2234 self.data = std::ptr::null_mut();
2238 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2239 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2242 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2243 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2244 let datalen = v.len();
2245 let data = Box::into_raw(v.into_boxed_slice());
2246 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2250 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2251 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2252 impl Drop for CVec_TxidZ {
2253 fn drop(&mut self) {
2254 if self.datalen == 0 { return; }
2255 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2258 impl Clone for CVec_TxidZ {
2259 fn clone(&self) -> Self {
2260 let mut res = Vec::new();
2261 if self.datalen == 0 { return Self::from(res); }
2262 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2267 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2268 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2269 /// Note that this value is always NULL, as there are no contents in the OK variant
2270 pub result: *mut std::ffi::c_void,
2271 /// A pointer to the contents in the error state.
2272 /// Reading from this pointer when `result_ok` is set is undefined.
2273 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2276 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2277 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2279 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2280 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2281 /// `err` or `result` depending on the state of `result_ok`.
2282 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2283 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2284 pub result_ok: bool,
2287 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2288 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2289 CResult_NoneChannelMonitorUpdateErrZ {
2290 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2291 result: std::ptr::null_mut(),
2297 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2298 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2299 CResult_NoneChannelMonitorUpdateErrZ {
2300 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2301 err: Box::into_raw(Box::new(e)),
2307 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2308 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2309 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2310 fn drop(&mut self) {
2313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2314 let _ = unsafe { Box::from_raw(self.contents.err) };
2319 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2320 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2321 let contents = if o.result_ok {
2322 let _ = unsafe { Box::from_raw(o.contents.result) };
2323 o.contents.result = std::ptr::null_mut();
2324 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2326 let err = unsafe { o.contents.err };
2327 unsafe { o.contents.err = std::ptr::null_mut(); }
2328 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2332 result_ok: o.result_ok,
2336 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2337 fn clone(&self) -> Self {
2339 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2340 result: std::ptr::null_mut()
2343 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2344 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2350 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2351 /// but with all dynamically-allocated buffers duplicated in new buffers.
2352 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2354 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2355 /// This corresponds to std::vector in C++
2356 pub struct CVec_MonitorEventZ {
2357 /// The elements in the array.
2358 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2359 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2360 /// The number of elements pointed to by `data`.
2363 impl CVec_MonitorEventZ {
2364 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2365 if self.datalen == 0 { return Vec::new(); }
2366 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2367 self.data = std::ptr::null_mut();
2371 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2372 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2375 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2376 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2377 let datalen = v.len();
2378 let data = Box::into_raw(v.into_boxed_slice());
2379 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2383 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2384 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2385 impl Drop for CVec_MonitorEventZ {
2386 fn drop(&mut self) {
2387 if self.datalen == 0 { return; }
2388 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2391 impl Clone for CVec_MonitorEventZ {
2392 fn clone(&self) -> Self {
2393 let mut res = Vec::new();
2394 if self.datalen == 0 { return Self::from(res); }
2395 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2401 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2402 pub enum COption_C2Tuple_usizeTransactionZZ {
2403 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2404 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2405 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2408 impl COption_C2Tuple_usizeTransactionZZ {
2409 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2410 if let Self::Some(_) = self { true } else { false }
2412 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2415 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2416 if let Self::Some(v) = self { v } else { unreachable!() }
2420 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2421 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2422 COption_C2Tuple_usizeTransactionZZ::Some(o)
2425 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2426 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2427 COption_C2Tuple_usizeTransactionZZ::None
2430 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2431 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2433 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2434 /// but with all dynamically-allocated buffers duplicated in new buffers.
2435 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
2438 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2439 pub enum COption_NetworkUpdateZ {
2440 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2441 Some(crate::lightning::routing::network_graph::NetworkUpdate),
2442 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
2445 impl COption_NetworkUpdateZ {
2446 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2447 if let Self::Some(_) = self { true } else { false }
2449 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2452 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
2453 if let Self::Some(v) = self { v } else { unreachable!() }
2457 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
2458 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
2459 COption_NetworkUpdateZ::Some(o)
2462 /// Constructs a new COption_NetworkUpdateZ containing nothing
2463 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
2464 COption_NetworkUpdateZ::None
2467 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
2468 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
2470 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
2471 /// but with all dynamically-allocated buffers duplicated in new buffers.
2472 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
2474 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2475 /// This corresponds to std::vector in C++
2476 pub struct CVec_SpendableOutputDescriptorZ {
2477 /// The elements in the array.
2478 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2479 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2480 /// The number of elements pointed to by `data`.
2483 impl CVec_SpendableOutputDescriptorZ {
2484 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2485 if self.datalen == 0 { return Vec::new(); }
2486 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2487 self.data = std::ptr::null_mut();
2491 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2492 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2495 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2496 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2497 let datalen = v.len();
2498 let data = Box::into_raw(v.into_boxed_slice());
2499 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2503 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2504 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2505 impl Drop for CVec_SpendableOutputDescriptorZ {
2506 fn drop(&mut self) {
2507 if self.datalen == 0 { return; }
2508 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2511 impl Clone for CVec_SpendableOutputDescriptorZ {
2512 fn clone(&self) -> Self {
2513 let mut res = Vec::new();
2514 if self.datalen == 0 { return Self::from(res); }
2515 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2520 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2521 /// This corresponds to std::vector in C++
2522 pub struct CVec_MessageSendEventZ {
2523 /// The elements in the array.
2524 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2525 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2526 /// The number of elements pointed to by `data`.
2529 impl CVec_MessageSendEventZ {
2530 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2531 if self.datalen == 0 { return Vec::new(); }
2532 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2533 self.data = std::ptr::null_mut();
2537 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2538 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2541 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2542 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2543 let datalen = v.len();
2544 let data = Box::into_raw(v.into_boxed_slice());
2545 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2549 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2550 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2551 impl Drop for CVec_MessageSendEventZ {
2552 fn drop(&mut self) {
2553 if self.datalen == 0 { return; }
2554 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2557 impl Clone for CVec_MessageSendEventZ {
2558 fn clone(&self) -> Self {
2559 let mut res = Vec::new();
2560 if self.datalen == 0 { return Self::from(res); }
2561 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2566 /// The contents of CResult_InitFeaturesDecodeErrorZ
2567 pub union CResult_InitFeaturesDecodeErrorZPtr {
2568 /// A pointer to the contents in the success state.
2569 /// Reading from this pointer when `result_ok` is not set is undefined.
2570 pub result: *mut crate::lightning::ln::features::InitFeatures,
2571 /// A pointer to the contents in the error state.
2572 /// Reading from this pointer when `result_ok` is set is undefined.
2573 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2576 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2577 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2579 pub struct CResult_InitFeaturesDecodeErrorZ {
2580 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2581 /// `err` or `result` depending on the state of `result_ok`.
2582 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2583 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2584 pub result_ok: bool,
2587 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2588 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2589 CResult_InitFeaturesDecodeErrorZ {
2590 contents: CResult_InitFeaturesDecodeErrorZPtr {
2591 result: Box::into_raw(Box::new(o)),
2597 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
2598 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
2599 CResult_InitFeaturesDecodeErrorZ {
2600 contents: CResult_InitFeaturesDecodeErrorZPtr {
2601 err: Box::into_raw(Box::new(e)),
2607 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
2608 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
2609 impl Drop for CResult_InitFeaturesDecodeErrorZ {
2610 fn drop(&mut self) {
2612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2613 let _ = unsafe { Box::from_raw(self.contents.result) };
2616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2617 let _ = unsafe { Box::from_raw(self.contents.err) };
2622 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
2623 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2624 let contents = if o.result_ok {
2625 let result = unsafe { o.contents.result };
2626 unsafe { o.contents.result = std::ptr::null_mut() };
2627 CResult_InitFeaturesDecodeErrorZPtr { result }
2629 let err = unsafe { o.contents.err };
2630 unsafe { o.contents.err = std::ptr::null_mut(); }
2631 CResult_InitFeaturesDecodeErrorZPtr { err }
2635 result_ok: o.result_ok,
2640 /// The contents of CResult_NodeFeaturesDecodeErrorZ
2641 pub union CResult_NodeFeaturesDecodeErrorZPtr {
2642 /// A pointer to the contents in the success state.
2643 /// Reading from this pointer when `result_ok` is not set is undefined.
2644 pub result: *mut crate::lightning::ln::features::NodeFeatures,
2645 /// A pointer to the contents in the error state.
2646 /// Reading from this pointer when `result_ok` is set is undefined.
2647 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2650 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2651 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2653 pub struct CResult_NodeFeaturesDecodeErrorZ {
2654 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2655 /// `err` or `result` depending on the state of `result_ok`.
2656 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
2657 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2658 pub result_ok: bool,
2661 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2662 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2663 CResult_NodeFeaturesDecodeErrorZ {
2664 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2665 result: Box::into_raw(Box::new(o)),
2671 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2672 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2673 CResult_NodeFeaturesDecodeErrorZ {
2674 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2675 err: Box::into_raw(Box::new(e)),
2681 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2682 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2683 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2684 fn drop(&mut self) {
2686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2687 let _ = unsafe { Box::from_raw(self.contents.result) };
2690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2691 let _ = unsafe { Box::from_raw(self.contents.err) };
2696 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2697 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2698 let contents = if o.result_ok {
2699 let result = unsafe { o.contents.result };
2700 unsafe { o.contents.result = std::ptr::null_mut() };
2701 CResult_NodeFeaturesDecodeErrorZPtr { result }
2703 let err = unsafe { o.contents.err };
2704 unsafe { o.contents.err = std::ptr::null_mut(); }
2705 CResult_NodeFeaturesDecodeErrorZPtr { err }
2709 result_ok: o.result_ok,
2714 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2715 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2716 /// A pointer to the contents in the success state.
2717 /// Reading from this pointer when `result_ok` is not set is undefined.
2718 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
2719 /// A pointer to the contents in the error state.
2720 /// Reading from this pointer when `result_ok` is set is undefined.
2721 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2724 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2725 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2727 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2728 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2729 /// `err` or `result` depending on the state of `result_ok`.
2730 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2731 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2732 pub result_ok: bool,
2735 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2736 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2737 CResult_ChannelFeaturesDecodeErrorZ {
2738 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2739 result: Box::into_raw(Box::new(o)),
2745 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2746 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2747 CResult_ChannelFeaturesDecodeErrorZ {
2748 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2749 err: Box::into_raw(Box::new(e)),
2755 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2756 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2757 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
2758 fn drop(&mut self) {
2760 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2761 let _ = unsafe { Box::from_raw(self.contents.result) };
2764 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2765 let _ = unsafe { Box::from_raw(self.contents.err) };
2770 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2771 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2772 let contents = if o.result_ok {
2773 let result = unsafe { o.contents.result };
2774 unsafe { o.contents.result = std::ptr::null_mut() };
2775 CResult_ChannelFeaturesDecodeErrorZPtr { result }
2777 let err = unsafe { o.contents.err };
2778 unsafe { o.contents.err = std::ptr::null_mut(); }
2779 CResult_ChannelFeaturesDecodeErrorZPtr { err }
2783 result_ok: o.result_ok,
2788 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2789 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
2790 /// A pointer to the contents in the success state.
2791 /// Reading from this pointer when `result_ok` is not set is undefined.
2792 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
2793 /// A pointer to the contents in the error state.
2794 /// Reading from this pointer when `result_ok` is set is undefined.
2795 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2798 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2799 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2801 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
2802 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2803 /// `err` or `result` depending on the state of `result_ok`.
2804 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2805 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2806 pub result_ok: bool,
2809 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2810 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2811 CResult_InvoiceFeaturesDecodeErrorZ {
2812 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2813 result: Box::into_raw(Box::new(o)),
2819 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2820 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2821 CResult_InvoiceFeaturesDecodeErrorZ {
2822 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2823 err: Box::into_raw(Box::new(e)),
2829 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2830 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2831 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
2832 fn drop(&mut self) {
2834 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2835 let _ = unsafe { Box::from_raw(self.contents.result) };
2838 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2839 let _ = unsafe { Box::from_raw(self.contents.err) };
2844 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2845 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2846 let contents = if o.result_ok {
2847 let result = unsafe { o.contents.result };
2848 unsafe { o.contents.result = std::ptr::null_mut() };
2849 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
2851 let err = unsafe { o.contents.err };
2852 unsafe { o.contents.err = std::ptr::null_mut(); }
2853 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2857 result_ok: o.result_ok,
2862 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2863 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2864 /// A pointer to the contents in the success state.
2865 /// Reading from this pointer when `result_ok` is not set is undefined.
2866 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
2867 /// A pointer to the contents in the error state.
2868 /// Reading from this pointer when `result_ok` is set is undefined.
2869 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2872 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2873 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2875 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2876 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2877 /// `err` or `result` depending on the state of `result_ok`.
2878 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
2879 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2880 pub result_ok: bool,
2883 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
2884 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2885 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2886 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2887 result: Box::into_raw(Box::new(o)),
2893 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
2894 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2895 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2896 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2897 err: Box::into_raw(Box::new(e)),
2903 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
2904 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
2905 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2906 fn drop(&mut self) {
2908 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2909 let _ = unsafe { Box::from_raw(self.contents.result) };
2912 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2913 let _ = unsafe { Box::from_raw(self.contents.err) };
2918 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2919 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2920 let contents = if o.result_ok {
2921 let result = unsafe { o.contents.result };
2922 unsafe { o.contents.result = std::ptr::null_mut() };
2923 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
2925 let err = unsafe { o.contents.err };
2926 unsafe { o.contents.err = std::ptr::null_mut(); }
2927 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
2931 result_ok: o.result_ok,
2935 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2936 fn clone(&self) -> Self {
2938 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2939 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2942 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2943 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2949 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2950 /// but with all dynamically-allocated buffers duplicated in new buffers.
2951 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
2953 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2954 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2955 /// A pointer to the contents in the success state.
2956 /// Reading from this pointer when `result_ok` is not set is undefined.
2957 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
2958 /// A pointer to the contents in the error state.
2959 /// Reading from this pointer when `result_ok` is set is undefined.
2960 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2963 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2964 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2966 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2967 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2968 /// `err` or `result` depending on the state of `result_ok`.
2969 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
2970 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2971 pub result_ok: bool,
2974 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
2975 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2976 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2977 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2978 result: Box::into_raw(Box::new(o)),
2984 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
2985 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2986 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2987 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2988 err: Box::into_raw(Box::new(e)),
2994 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
2995 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
2996 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2997 fn drop(&mut self) {
2999 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3000 let _ = unsafe { Box::from_raw(self.contents.result) };
3003 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3004 let _ = unsafe { Box::from_raw(self.contents.err) };
3009 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3010 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3011 let contents = if o.result_ok {
3012 let result = unsafe { o.contents.result };
3013 unsafe { o.contents.result = std::ptr::null_mut() };
3014 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
3016 let err = unsafe { o.contents.err };
3017 unsafe { o.contents.err = std::ptr::null_mut(); }
3018 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
3022 result_ok: o.result_ok,
3026 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3027 fn clone(&self) -> Self {
3029 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3030 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3033 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3034 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3040 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3041 /// but with all dynamically-allocated buffers duplicated in new buffers.
3042 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3044 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3045 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3046 /// A pointer to the contents in the success state.
3047 /// Reading from this pointer when `result_ok` is not set is undefined.
3048 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3049 /// A pointer to the contents in the error state.
3050 /// Reading from this pointer when `result_ok` is set is undefined.
3051 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3054 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3055 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3057 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3058 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3059 /// `err` or `result` depending on the state of `result_ok`.
3060 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3061 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3062 pub result_ok: bool,
3065 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
3066 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3067 CResult_SpendableOutputDescriptorDecodeErrorZ {
3068 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3069 result: Box::into_raw(Box::new(o)),
3075 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
3076 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3077 CResult_SpendableOutputDescriptorDecodeErrorZ {
3078 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3079 err: Box::into_raw(Box::new(e)),
3085 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
3086 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3087 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3088 fn drop(&mut self) {
3090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3091 let _ = unsafe { Box::from_raw(self.contents.result) };
3094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3095 let _ = unsafe { Box::from_raw(self.contents.err) };
3100 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3102 let contents = if o.result_ok {
3103 let result = unsafe { o.contents.result };
3104 unsafe { o.contents.result = std::ptr::null_mut() };
3105 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3107 let err = unsafe { o.contents.err };
3108 unsafe { o.contents.err = std::ptr::null_mut(); }
3109 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3113 result_ok: o.result_ok,
3117 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3118 fn clone(&self) -> Self {
3120 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3121 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3124 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3125 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3131 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3132 /// but with all dynamically-allocated buffers duplicated in new buffers.
3133 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3135 /// The contents of CResult_NoneNoneZ
3136 pub union CResult_NoneNoneZPtr {
3137 /// Note that this value is always NULL, as there are no contents in the OK variant
3138 pub result: *mut std::ffi::c_void,
3139 /// Note that this value is always NULL, as there are no contents in the Err variant
3140 pub err: *mut std::ffi::c_void,
3143 /// A CResult_NoneNoneZ represents the result of a fallible operation,
3144 /// containing a () on success and a () on failure.
3145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3146 pub struct CResult_NoneNoneZ {
3147 /// The contents of this CResult_NoneNoneZ, accessible via either
3148 /// `err` or `result` depending on the state of `result_ok`.
3149 pub contents: CResult_NoneNoneZPtr,
3150 /// Whether this CResult_NoneNoneZ represents a success state.
3151 pub result_ok: bool,
3154 /// Creates a new CResult_NoneNoneZ in the success state.
3155 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
3157 contents: CResult_NoneNoneZPtr {
3158 result: std::ptr::null_mut(),
3164 /// Creates a new CResult_NoneNoneZ in the error state.
3165 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
3167 contents: CResult_NoneNoneZPtr {
3168 err: std::ptr::null_mut(),
3174 /// Frees any resources used by the CResult_NoneNoneZ.
3175 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
3176 impl Drop for CResult_NoneNoneZ {
3177 fn drop(&mut self) {
3183 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
3184 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
3185 let contents = if o.result_ok {
3186 let _ = unsafe { Box::from_raw(o.contents.result) };
3187 o.contents.result = std::ptr::null_mut();
3188 CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
3190 let _ = unsafe { Box::from_raw(o.contents.err) };
3191 o.contents.err = std::ptr::null_mut();
3192 CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
3196 result_ok: o.result_ok,
3200 impl Clone for CResult_NoneNoneZ {
3201 fn clone(&self) -> Self {
3203 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
3204 result: std::ptr::null_mut()
3207 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
3208 err: std::ptr::null_mut()
3214 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
3215 /// but with all dynamically-allocated buffers duplicated in new buffers.
3216 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
3218 /// A tuple of 2 elements. See the individual fields for the types contained.
3219 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3220 /// The element at position 0
3221 pub a: crate::c_types::Signature,
3222 /// The element at position 1
3223 pub b: crate::c_types::derived::CVec_SignatureZ,
3225 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3226 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3233 impl C2Tuple_SignatureCVec_SignatureZZ {
3234 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3238 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3239 fn clone(&self) -> Self {
3241 a: Clone::clone(&self.a),
3242 b: Clone::clone(&self.b),
3247 /// Creates a new tuple which has the same data as `orig`
3248 /// but with all dynamically-allocated buffers duplicated in new buffers.
3249 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
3250 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3252 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3253 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3257 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3258 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3260 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3261 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3262 /// A pointer to the contents in the success state.
3263 /// Reading from this pointer when `result_ok` is not set is undefined.
3264 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3265 /// Note that this value is always NULL, as there are no contents in the Err variant
3266 pub err: *mut std::ffi::c_void,
3269 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3270 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3271 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3272 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3273 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3274 /// `err` or `result` depending on the state of `result_ok`.
3275 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3276 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3277 pub result_ok: bool,
3280 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3281 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3282 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3283 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3284 result: Box::into_raw(Box::new(o)),
3290 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3291 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3292 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3293 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3294 err: std::ptr::null_mut(),
3300 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3301 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3302 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3303 fn drop(&mut self) {
3305 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3306 let _ = unsafe { Box::from_raw(self.contents.result) };
3312 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3313 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3314 let contents = if o.result_ok {
3315 let result = unsafe { o.contents.result };
3316 unsafe { o.contents.result = std::ptr::null_mut() };
3317 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3319 let _ = unsafe { Box::from_raw(o.contents.err) };
3320 o.contents.err = std::ptr::null_mut();
3321 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3325 result_ok: o.result_ok,
3329 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3330 fn clone(&self) -> Self {
3332 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3333 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3336 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3337 err: std::ptr::null_mut()
3343 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3344 /// but with all dynamically-allocated buffers duplicated in new buffers.
3345 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
3347 /// The contents of CResult_SignatureNoneZ
3348 pub union CResult_SignatureNoneZPtr {
3349 /// A pointer to the contents in the success state.
3350 /// Reading from this pointer when `result_ok` is not set is undefined.
3351 pub result: *mut crate::c_types::Signature,
3352 /// Note that this value is always NULL, as there are no contents in the Err variant
3353 pub err: *mut std::ffi::c_void,
3356 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3357 /// containing a crate::c_types::Signature on success and a () on failure.
3358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3359 pub struct CResult_SignatureNoneZ {
3360 /// The contents of this CResult_SignatureNoneZ, accessible via either
3361 /// `err` or `result` depending on the state of `result_ok`.
3362 pub contents: CResult_SignatureNoneZPtr,
3363 /// Whether this CResult_SignatureNoneZ represents a success state.
3364 pub result_ok: bool,
3367 /// Creates a new CResult_SignatureNoneZ in the success state.
3368 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3369 CResult_SignatureNoneZ {
3370 contents: CResult_SignatureNoneZPtr {
3371 result: Box::into_raw(Box::new(o)),
3377 /// Creates a new CResult_SignatureNoneZ in the error state.
3378 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3379 CResult_SignatureNoneZ {
3380 contents: CResult_SignatureNoneZPtr {
3381 err: std::ptr::null_mut(),
3387 /// Frees any resources used by the CResult_SignatureNoneZ.
3388 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3389 impl Drop for CResult_SignatureNoneZ {
3390 fn drop(&mut self) {
3392 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3393 let _ = unsafe { Box::from_raw(self.contents.result) };
3399 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3400 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3401 let contents = if o.result_ok {
3402 let result = unsafe { o.contents.result };
3403 unsafe { o.contents.result = std::ptr::null_mut() };
3404 CResult_SignatureNoneZPtr { result }
3406 let _ = unsafe { Box::from_raw(o.contents.err) };
3407 o.contents.err = std::ptr::null_mut();
3408 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3412 result_ok: o.result_ok,
3416 impl Clone for CResult_SignatureNoneZ {
3417 fn clone(&self) -> Self {
3419 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3420 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3423 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3424 err: std::ptr::null_mut()
3430 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3431 /// but with all dynamically-allocated buffers duplicated in new buffers.
3432 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
3434 /// The contents of CResult_SignDecodeErrorZ
3435 pub union CResult_SignDecodeErrorZPtr {
3436 /// A pointer to the contents in the success state.
3437 /// Reading from this pointer when `result_ok` is not set is undefined.
3438 pub result: *mut crate::lightning::chain::keysinterface::Sign,
3439 /// A pointer to the contents in the error state.
3440 /// Reading from this pointer when `result_ok` is set is undefined.
3441 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3444 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3445 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3446 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3447 pub struct CResult_SignDecodeErrorZ {
3448 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3449 /// `err` or `result` depending on the state of `result_ok`.
3450 pub contents: CResult_SignDecodeErrorZPtr,
3451 /// Whether this CResult_SignDecodeErrorZ represents a success state.
3452 pub result_ok: bool,
3455 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3456 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3457 CResult_SignDecodeErrorZ {
3458 contents: CResult_SignDecodeErrorZPtr {
3459 result: Box::into_raw(Box::new(o)),
3465 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3466 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3467 CResult_SignDecodeErrorZ {
3468 contents: CResult_SignDecodeErrorZPtr {
3469 err: Box::into_raw(Box::new(e)),
3475 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3476 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3477 impl Drop for CResult_SignDecodeErrorZ {
3478 fn drop(&mut self) {
3480 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3481 let _ = unsafe { Box::from_raw(self.contents.result) };
3484 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3485 let _ = unsafe { Box::from_raw(self.contents.err) };
3490 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3491 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3492 let contents = if o.result_ok {
3493 let result = unsafe { o.contents.result };
3494 unsafe { o.contents.result = std::ptr::null_mut() };
3495 CResult_SignDecodeErrorZPtr { result }
3497 let err = unsafe { o.contents.err };
3498 unsafe { o.contents.err = std::ptr::null_mut(); }
3499 CResult_SignDecodeErrorZPtr { err }
3503 result_ok: o.result_ok,
3507 impl Clone for CResult_SignDecodeErrorZ {
3508 fn clone(&self) -> Self {
3510 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3511 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3514 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3515 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3521 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3522 /// but with all dynamically-allocated buffers duplicated in new buffers.
3523 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
3525 /// A dynamically-allocated array of u8s of arbitrary size.
3526 /// This corresponds to std::vector in C++
3527 pub struct CVec_u8Z {
3528 /// The elements in the array.
3529 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3531 /// The number of elements pointed to by `data`.
3535 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3536 if self.datalen == 0 { return Vec::new(); }
3537 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3538 self.data = std::ptr::null_mut();
3542 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3543 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3546 impl From<Vec<u8>> for CVec_u8Z {
3547 fn from(v: Vec<u8>) -> Self {
3548 let datalen = v.len();
3549 let data = Box::into_raw(v.into_boxed_slice());
3550 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3554 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3555 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3556 impl Drop for CVec_u8Z {
3557 fn drop(&mut self) {
3558 if self.datalen == 0 { return; }
3559 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3562 impl Clone for CVec_u8Z {
3563 fn clone(&self) -> Self {
3564 let mut res = Vec::new();
3565 if self.datalen == 0 { return Self::from(res); }
3566 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3571 /// The contents of CResult_RecoverableSignatureNoneZ
3572 pub union CResult_RecoverableSignatureNoneZPtr {
3573 /// A pointer to the contents in the success state.
3574 /// Reading from this pointer when `result_ok` is not set is undefined.
3575 pub result: *mut crate::c_types::RecoverableSignature,
3576 /// Note that this value is always NULL, as there are no contents in the Err variant
3577 pub err: *mut std::ffi::c_void,
3580 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3581 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3582 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3583 pub struct CResult_RecoverableSignatureNoneZ {
3584 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3585 /// `err` or `result` depending on the state of `result_ok`.
3586 pub contents: CResult_RecoverableSignatureNoneZPtr,
3587 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3588 pub result_ok: bool,
3591 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
3592 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
3593 CResult_RecoverableSignatureNoneZ {
3594 contents: CResult_RecoverableSignatureNoneZPtr {
3595 result: Box::into_raw(Box::new(o)),
3601 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
3602 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
3603 CResult_RecoverableSignatureNoneZ {
3604 contents: CResult_RecoverableSignatureNoneZPtr {
3605 err: std::ptr::null_mut(),
3611 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
3612 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
3613 impl Drop for CResult_RecoverableSignatureNoneZ {
3614 fn drop(&mut self) {
3616 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3617 let _ = unsafe { Box::from_raw(self.contents.result) };
3623 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
3624 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
3625 let contents = if o.result_ok {
3626 let result = unsafe { o.contents.result };
3627 unsafe { o.contents.result = std::ptr::null_mut() };
3628 CResult_RecoverableSignatureNoneZPtr { result }
3630 let _ = unsafe { Box::from_raw(o.contents.err) };
3631 o.contents.err = std::ptr::null_mut();
3632 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
3636 result_ok: o.result_ok,
3640 impl Clone for CResult_RecoverableSignatureNoneZ {
3641 fn clone(&self) -> Self {
3643 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
3644 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
3647 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
3648 err: std::ptr::null_mut()
3654 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
3655 /// but with all dynamically-allocated buffers duplicated in new buffers.
3656 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
3658 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3659 /// This corresponds to std::vector in C++
3660 pub struct CVec_CVec_u8ZZ {
3661 /// The elements in the array.
3662 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3663 pub data: *mut crate::c_types::derived::CVec_u8Z,
3664 /// The number of elements pointed to by `data`.
3667 impl CVec_CVec_u8ZZ {
3668 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3669 if self.datalen == 0 { return Vec::new(); }
3670 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3671 self.data = std::ptr::null_mut();
3675 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3676 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3679 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3680 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3681 let datalen = v.len();
3682 let data = Box::into_raw(v.into_boxed_slice());
3683 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3687 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3688 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3689 impl Drop for CVec_CVec_u8ZZ {
3690 fn drop(&mut self) {
3691 if self.datalen == 0 { return; }
3692 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3695 impl Clone for CVec_CVec_u8ZZ {
3696 fn clone(&self) -> Self {
3697 let mut res = Vec::new();
3698 if self.datalen == 0 { return Self::from(res); }
3699 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3704 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3705 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3706 /// A pointer to the contents in the success state.
3707 /// Reading from this pointer when `result_ok` is not set is undefined.
3708 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3709 /// Note that this value is always NULL, as there are no contents in the Err variant
3710 pub err: *mut std::ffi::c_void,
3713 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3714 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3715 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3716 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3717 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3718 /// `err` or `result` depending on the state of `result_ok`.
3719 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3720 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3721 pub result_ok: bool,
3724 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3725 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3726 CResult_CVec_CVec_u8ZZNoneZ {
3727 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3728 result: Box::into_raw(Box::new(o)),
3734 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3735 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3736 CResult_CVec_CVec_u8ZZNoneZ {
3737 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3738 err: std::ptr::null_mut(),
3744 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3745 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3746 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3747 fn drop(&mut self) {
3749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3750 let _ = unsafe { Box::from_raw(self.contents.result) };
3756 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3757 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3758 let contents = if o.result_ok {
3759 let result = unsafe { o.contents.result };
3760 unsafe { o.contents.result = std::ptr::null_mut() };
3761 CResult_CVec_CVec_u8ZZNoneZPtr { result }
3763 let _ = unsafe { Box::from_raw(o.contents.err) };
3764 o.contents.err = std::ptr::null_mut();
3765 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
3769 result_ok: o.result_ok,
3773 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3774 fn clone(&self) -> Self {
3776 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3777 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3780 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3781 err: std::ptr::null_mut()
3787 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3788 /// but with all dynamically-allocated buffers duplicated in new buffers.
3789 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
3791 /// The contents of CResult_InMemorySignerDecodeErrorZ
3792 pub union CResult_InMemorySignerDecodeErrorZPtr {
3793 /// A pointer to the contents in the success state.
3794 /// Reading from this pointer when `result_ok` is not set is undefined.
3795 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
3796 /// A pointer to the contents in the error state.
3797 /// Reading from this pointer when `result_ok` is set is undefined.
3798 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3801 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3802 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3804 pub struct CResult_InMemorySignerDecodeErrorZ {
3805 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3806 /// `err` or `result` depending on the state of `result_ok`.
3807 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3808 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3809 pub result_ok: bool,
3812 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3813 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3814 CResult_InMemorySignerDecodeErrorZ {
3815 contents: CResult_InMemorySignerDecodeErrorZPtr {
3816 result: Box::into_raw(Box::new(o)),
3822 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3823 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3824 CResult_InMemorySignerDecodeErrorZ {
3825 contents: CResult_InMemorySignerDecodeErrorZPtr {
3826 err: Box::into_raw(Box::new(e)),
3832 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3833 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3834 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3835 fn drop(&mut self) {
3837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838 let _ = unsafe { Box::from_raw(self.contents.result) };
3841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842 let _ = unsafe { Box::from_raw(self.contents.err) };
3847 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849 let contents = if o.result_ok {
3850 let result = unsafe { o.contents.result };
3851 unsafe { o.contents.result = std::ptr::null_mut() };
3852 CResult_InMemorySignerDecodeErrorZPtr { result }
3854 let err = unsafe { o.contents.err };
3855 unsafe { o.contents.err = std::ptr::null_mut(); }
3856 CResult_InMemorySignerDecodeErrorZPtr { err }
3860 result_ok: o.result_ok,
3864 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3865 fn clone(&self) -> Self {
3867 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3868 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3871 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3872 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3878 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3879 /// but with all dynamically-allocated buffers duplicated in new buffers.
3880 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3882 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3883 /// This corresponds to std::vector in C++
3884 pub struct CVec_TxOutZ {
3885 /// The elements in the array.
3886 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3887 pub data: *mut crate::c_types::TxOut,
3888 /// The number of elements pointed to by `data`.
3892 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
3893 if self.datalen == 0 { return Vec::new(); }
3894 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3895 self.data = std::ptr::null_mut();
3899 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
3900 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3903 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
3904 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
3905 let datalen = v.len();
3906 let data = Box::into_raw(v.into_boxed_slice());
3907 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3911 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3912 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
3913 impl Drop for CVec_TxOutZ {
3914 fn drop(&mut self) {
3915 if self.datalen == 0 { return; }
3916 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3919 impl Clone for CVec_TxOutZ {
3920 fn clone(&self) -> Self {
3921 let mut res = Vec::new();
3922 if self.datalen == 0 { return Self::from(res); }
3923 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3928 /// The contents of CResult_TransactionNoneZ
3929 pub union CResult_TransactionNoneZPtr {
3930 /// A pointer to the contents in the success state.
3931 /// Reading from this pointer when `result_ok` is not set is undefined.
3932 pub result: *mut crate::c_types::Transaction,
3933 /// Note that this value is always NULL, as there are no contents in the Err variant
3934 pub err: *mut std::ffi::c_void,
3937 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3938 /// containing a crate::c_types::Transaction on success and a () on failure.
3939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3940 pub struct CResult_TransactionNoneZ {
3941 /// The contents of this CResult_TransactionNoneZ, accessible via either
3942 /// `err` or `result` depending on the state of `result_ok`.
3943 pub contents: CResult_TransactionNoneZPtr,
3944 /// Whether this CResult_TransactionNoneZ represents a success state.
3945 pub result_ok: bool,
3948 /// Creates a new CResult_TransactionNoneZ in the success state.
3949 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3950 CResult_TransactionNoneZ {
3951 contents: CResult_TransactionNoneZPtr {
3952 result: Box::into_raw(Box::new(o)),
3958 /// Creates a new CResult_TransactionNoneZ in the error state.
3959 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3960 CResult_TransactionNoneZ {
3961 contents: CResult_TransactionNoneZPtr {
3962 err: std::ptr::null_mut(),
3968 /// Frees any resources used by the CResult_TransactionNoneZ.
3969 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3970 impl Drop for CResult_TransactionNoneZ {
3971 fn drop(&mut self) {
3973 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3974 let _ = unsafe { Box::from_raw(self.contents.result) };
3980 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3981 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3982 let contents = if o.result_ok {
3983 let result = unsafe { o.contents.result };
3984 unsafe { o.contents.result = std::ptr::null_mut() };
3985 CResult_TransactionNoneZPtr { result }
3987 let _ = unsafe { Box::from_raw(o.contents.err) };
3988 o.contents.err = std::ptr::null_mut();
3989 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
3993 result_ok: o.result_ok,
3997 impl Clone for CResult_TransactionNoneZ {
3998 fn clone(&self) -> Self {
4000 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
4001 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
4004 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
4005 err: std::ptr::null_mut()
4011 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
4012 /// but with all dynamically-allocated buffers duplicated in new buffers.
4013 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
4015 /// A tuple of 2 elements. See the individual fields for the types contained.
4016 pub struct C2Tuple_BlockHashChannelMonitorZ {
4017 /// The element at position 0
4018 pub a: crate::c_types::ThirtyTwoBytes,
4019 /// The element at position 1
4020 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
4022 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4023 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
4030 impl C2Tuple_BlockHashChannelMonitorZ {
4031 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
4035 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4037 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4038 C2Tuple_BlockHashChannelMonitorZ { a, b, }
4042 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4043 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4045 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4046 /// This corresponds to std::vector in C++
4047 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
4048 /// The elements in the array.
4049 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4050 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4051 /// The number of elements pointed to by `data`.
4054 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
4055 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
4056 if self.datalen == 0 { return Vec::new(); }
4057 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4058 self.data = std::ptr::null_mut();
4062 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
4063 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4066 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4067 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
4068 let datalen = v.len();
4069 let data = Box::into_raw(v.into_boxed_slice());
4070 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4074 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4075 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
4076 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4077 fn drop(&mut self) {
4078 if self.datalen == 0 { return; }
4079 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4083 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4084 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4085 /// A pointer to the contents in the success state.
4086 /// Reading from this pointer when `result_ok` is not set is undefined.
4087 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
4088 /// A pointer to the contents in the error state.
4089 /// Reading from this pointer when `result_ok` is set is undefined.
4090 pub err: *mut crate::c_types::IOError,
4093 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4094 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4096 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4097 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4098 /// `err` or `result` depending on the state of `result_ok`.
4099 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
4100 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4101 pub result_ok: bool,
4104 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
4105 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4106 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4107 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4108 result: Box::into_raw(Box::new(o)),
4114 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
4115 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4116 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4117 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4118 err: Box::into_raw(Box::new(e)),
4124 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
4125 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
4126 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4127 fn drop(&mut self) {
4129 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4130 let _ = unsafe { Box::from_raw(self.contents.result) };
4133 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4134 let _ = unsafe { Box::from_raw(self.contents.err) };
4139 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4140 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
4141 let contents = if o.result_ok {
4142 let result = unsafe { o.contents.result };
4143 unsafe { o.contents.result = std::ptr::null_mut() };
4144 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
4146 let err = unsafe { o.contents.err };
4147 unsafe { o.contents.err = std::ptr::null_mut(); }
4148 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
4152 result_ok: o.result_ok,
4157 /// The contents of CResult_PaymentIdDecodeErrorZ
4158 pub union CResult_PaymentIdDecodeErrorZPtr {
4159 /// A pointer to the contents in the success state.
4160 /// Reading from this pointer when `result_ok` is not set is undefined.
4161 pub result: *mut crate::lightning::ln::channelmanager::PaymentId,
4162 /// A pointer to the contents in the error state.
4163 /// Reading from this pointer when `result_ok` is set is undefined.
4164 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4167 /// A CResult_PaymentIdDecodeErrorZ represents the result of a fallible operation,
4168 /// containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4170 pub struct CResult_PaymentIdDecodeErrorZ {
4171 /// The contents of this CResult_PaymentIdDecodeErrorZ, accessible via either
4172 /// `err` or `result` depending on the state of `result_ok`.
4173 pub contents: CResult_PaymentIdDecodeErrorZPtr,
4174 /// Whether this CResult_PaymentIdDecodeErrorZ represents a success state.
4175 pub result_ok: bool,
4178 /// Creates a new CResult_PaymentIdDecodeErrorZ in the success state.
4179 pub extern "C" fn CResult_PaymentIdDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PaymentId) -> CResult_PaymentIdDecodeErrorZ {
4180 CResult_PaymentIdDecodeErrorZ {
4181 contents: CResult_PaymentIdDecodeErrorZPtr {
4182 result: Box::into_raw(Box::new(o)),
4188 /// Creates a new CResult_PaymentIdDecodeErrorZ in the error state.
4189 pub extern "C" fn CResult_PaymentIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentIdDecodeErrorZ {
4190 CResult_PaymentIdDecodeErrorZ {
4191 contents: CResult_PaymentIdDecodeErrorZPtr {
4192 err: Box::into_raw(Box::new(e)),
4198 /// Frees any resources used by the CResult_PaymentIdDecodeErrorZ.
4199 pub extern "C" fn CResult_PaymentIdDecodeErrorZ_free(_res: CResult_PaymentIdDecodeErrorZ) { }
4200 impl Drop for CResult_PaymentIdDecodeErrorZ {
4201 fn drop(&mut self) {
4203 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4204 let _ = unsafe { Box::from_raw(self.contents.result) };
4207 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4208 let _ = unsafe { Box::from_raw(self.contents.err) };
4213 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentIdDecodeErrorZ {
4214 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4215 let contents = if o.result_ok {
4216 let result = unsafe { o.contents.result };
4217 unsafe { o.contents.result = std::ptr::null_mut() };
4218 CResult_PaymentIdDecodeErrorZPtr { result }
4220 let err = unsafe { o.contents.err };
4221 unsafe { o.contents.err = std::ptr::null_mut(); }
4222 CResult_PaymentIdDecodeErrorZPtr { err }
4226 result_ok: o.result_ok,
4230 impl Clone for CResult_PaymentIdDecodeErrorZ {
4231 fn clone(&self) -> Self {
4233 Self { result_ok: true, contents: CResult_PaymentIdDecodeErrorZPtr {
4234 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentId>::clone(unsafe { &*self.contents.result })))
4237 Self { result_ok: false, contents: CResult_PaymentIdDecodeErrorZPtr {
4238 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4244 /// Creates a new CResult_PaymentIdDecodeErrorZ which has the same data as `orig`
4245 /// but with all dynamically-allocated buffers duplicated in new buffers.
4246 pub extern "C" fn CResult_PaymentIdDecodeErrorZ_clone(orig: &CResult_PaymentIdDecodeErrorZ) -> CResult_PaymentIdDecodeErrorZ { Clone::clone(&orig) }
4249 /// An enum which can either contain a u16 or not
4250 pub enum COption_u16Z {
4251 /// When we're in this state, this COption_u16Z contains a u16
4253 /// When we're in this state, this COption_u16Z contains nothing
4257 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4258 if let Self::Some(_) = self { true } else { false }
4260 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4263 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
4264 if let Self::Some(v) = self { v } else { unreachable!() }
4268 /// Constructs a new COption_u16Z containing a u16
4269 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
4270 COption_u16Z::Some(o)
4273 /// Constructs a new COption_u16Z containing nothing
4274 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
4278 /// Frees any resources associated with the u16, if we are in the Some state
4279 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
4281 /// Creates a new COption_u16Z which has the same data as `orig`
4282 /// but with all dynamically-allocated buffers duplicated in new buffers.
4283 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
4285 /// The contents of CResult_NoneAPIErrorZ
4286 pub union CResult_NoneAPIErrorZPtr {
4287 /// Note that this value is always NULL, as there are no contents in the OK variant
4288 pub result: *mut std::ffi::c_void,
4289 /// A pointer to the contents in the error state.
4290 /// Reading from this pointer when `result_ok` is set is undefined.
4291 pub err: *mut crate::lightning::util::errors::APIError,
4294 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4295 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4296 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4297 pub struct CResult_NoneAPIErrorZ {
4298 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4299 /// `err` or `result` depending on the state of `result_ok`.
4300 pub contents: CResult_NoneAPIErrorZPtr,
4301 /// Whether this CResult_NoneAPIErrorZ represents a success state.
4302 pub result_ok: bool,
4305 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4306 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4307 CResult_NoneAPIErrorZ {
4308 contents: CResult_NoneAPIErrorZPtr {
4309 result: std::ptr::null_mut(),
4315 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4316 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4317 CResult_NoneAPIErrorZ {
4318 contents: CResult_NoneAPIErrorZPtr {
4319 err: Box::into_raw(Box::new(e)),
4325 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4326 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4327 impl Drop for CResult_NoneAPIErrorZ {
4328 fn drop(&mut self) {
4331 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4332 let _ = unsafe { Box::from_raw(self.contents.err) };
4337 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4338 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4339 let contents = if o.result_ok {
4340 let _ = unsafe { Box::from_raw(o.contents.result) };
4341 o.contents.result = std::ptr::null_mut();
4342 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4344 let err = unsafe { o.contents.err };
4345 unsafe { o.contents.err = std::ptr::null_mut(); }
4346 CResult_NoneAPIErrorZPtr { err }
4350 result_ok: o.result_ok,
4354 impl Clone for CResult_NoneAPIErrorZ {
4355 fn clone(&self) -> Self {
4357 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4358 result: std::ptr::null_mut()
4361 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4362 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4368 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4369 /// but with all dynamically-allocated buffers duplicated in new buffers.
4370 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
4372 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4373 /// This corresponds to std::vector in C++
4374 pub struct CVec_CResult_NoneAPIErrorZZ {
4375 /// The elements in the array.
4376 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4377 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4378 /// The number of elements pointed to by `data`.
4381 impl CVec_CResult_NoneAPIErrorZZ {
4382 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4383 if self.datalen == 0 { return Vec::new(); }
4384 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4385 self.data = std::ptr::null_mut();
4389 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4390 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4393 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4394 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4395 let datalen = v.len();
4396 let data = Box::into_raw(v.into_boxed_slice());
4397 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4402 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4403 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4404 fn drop(&mut self) {
4405 if self.datalen == 0 { return; }
4406 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4409 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4410 fn clone(&self) -> Self {
4411 let mut res = Vec::new();
4412 if self.datalen == 0 { return Self::from(res); }
4413 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4418 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4419 /// This corresponds to std::vector in C++
4420 pub struct CVec_APIErrorZ {
4421 /// The elements in the array.
4422 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4423 pub data: *mut crate::lightning::util::errors::APIError,
4424 /// The number of elements pointed to by `data`.
4427 impl CVec_APIErrorZ {
4428 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4429 if self.datalen == 0 { return Vec::new(); }
4430 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4431 self.data = std::ptr::null_mut();
4435 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4436 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4439 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4440 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4441 let datalen = v.len();
4442 let data = Box::into_raw(v.into_boxed_slice());
4443 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4447 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4448 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4449 impl Drop for CVec_APIErrorZ {
4450 fn drop(&mut self) {
4451 if self.datalen == 0 { return; }
4452 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4455 impl Clone for CVec_APIErrorZ {
4456 fn clone(&self) -> Self {
4457 let mut res = Vec::new();
4458 if self.datalen == 0 { return Self::from(res); }
4459 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4464 /// The contents of CResult__u832APIErrorZ
4465 pub union CResult__u832APIErrorZPtr {
4466 /// A pointer to the contents in the success state.
4467 /// Reading from this pointer when `result_ok` is not set is undefined.
4468 pub result: *mut crate::c_types::ThirtyTwoBytes,
4469 /// A pointer to the contents in the error state.
4470 /// Reading from this pointer when `result_ok` is set is undefined.
4471 pub err: *mut crate::lightning::util::errors::APIError,
4474 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
4475 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4476 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4477 pub struct CResult__u832APIErrorZ {
4478 /// The contents of this CResult__u832APIErrorZ, accessible via either
4479 /// `err` or `result` depending on the state of `result_ok`.
4480 pub contents: CResult__u832APIErrorZPtr,
4481 /// Whether this CResult__u832APIErrorZ represents a success state.
4482 pub result_ok: bool,
4485 /// Creates a new CResult__u832APIErrorZ in the success state.
4486 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
4487 CResult__u832APIErrorZ {
4488 contents: CResult__u832APIErrorZPtr {
4489 result: Box::into_raw(Box::new(o)),
4495 /// Creates a new CResult__u832APIErrorZ in the error state.
4496 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
4497 CResult__u832APIErrorZ {
4498 contents: CResult__u832APIErrorZPtr {
4499 err: Box::into_raw(Box::new(e)),
4505 /// Frees any resources used by the CResult__u832APIErrorZ.
4506 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
4507 impl Drop for CResult__u832APIErrorZ {
4508 fn drop(&mut self) {
4510 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4511 let _ = unsafe { Box::from_raw(self.contents.result) };
4514 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4515 let _ = unsafe { Box::from_raw(self.contents.err) };
4520 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
4521 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4522 let contents = if o.result_ok {
4523 let result = unsafe { o.contents.result };
4524 unsafe { o.contents.result = std::ptr::null_mut() };
4525 CResult__u832APIErrorZPtr { result }
4527 let err = unsafe { o.contents.err };
4528 unsafe { o.contents.err = std::ptr::null_mut(); }
4529 CResult__u832APIErrorZPtr { err }
4533 result_ok: o.result_ok,
4537 impl Clone for CResult__u832APIErrorZ {
4538 fn clone(&self) -> Self {
4540 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
4541 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4544 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
4545 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4551 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
4552 /// but with all dynamically-allocated buffers duplicated in new buffers.
4553 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
4555 /// The contents of CResult_PaymentIdPaymentSendFailureZ
4556 pub union CResult_PaymentIdPaymentSendFailureZPtr {
4557 /// A pointer to the contents in the success state.
4558 /// Reading from this pointer when `result_ok` is not set is undefined.
4559 pub result: *mut crate::lightning::ln::channelmanager::PaymentId,
4560 /// A pointer to the contents in the error state.
4561 /// Reading from this pointer when `result_ok` is set is undefined.
4562 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4565 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
4566 /// containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4568 pub struct CResult_PaymentIdPaymentSendFailureZ {
4569 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
4570 /// `err` or `result` depending on the state of `result_ok`.
4571 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
4572 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
4573 pub result_ok: bool,
4576 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
4577 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::lightning::ln::channelmanager::PaymentId) -> CResult_PaymentIdPaymentSendFailureZ {
4578 CResult_PaymentIdPaymentSendFailureZ {
4579 contents: CResult_PaymentIdPaymentSendFailureZPtr {
4580 result: Box::into_raw(Box::new(o)),
4586 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
4587 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
4588 CResult_PaymentIdPaymentSendFailureZ {
4589 contents: CResult_PaymentIdPaymentSendFailureZPtr {
4590 err: Box::into_raw(Box::new(e)),
4596 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
4597 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
4598 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
4599 fn drop(&mut self) {
4601 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4602 let _ = unsafe { Box::from_raw(self.contents.result) };
4605 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4606 let _ = unsafe { Box::from_raw(self.contents.err) };
4611 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
4612 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4613 let contents = if o.result_ok {
4614 let result = unsafe { o.contents.result };
4615 unsafe { o.contents.result = std::ptr::null_mut() };
4616 CResult_PaymentIdPaymentSendFailureZPtr { result }
4618 let err = unsafe { o.contents.err };
4619 unsafe { o.contents.err = std::ptr::null_mut(); }
4620 CResult_PaymentIdPaymentSendFailureZPtr { err }
4624 result_ok: o.result_ok,
4628 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
4629 fn clone(&self) -> Self {
4631 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
4632 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentId>::clone(unsafe { &*self.contents.result })))
4635 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
4636 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4642 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
4643 /// but with all dynamically-allocated buffers duplicated in new buffers.
4644 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
4646 /// The contents of CResult_NonePaymentSendFailureZ
4647 pub union CResult_NonePaymentSendFailureZPtr {
4648 /// Note that this value is always NULL, as there are no contents in the OK variant
4649 pub result: *mut std::ffi::c_void,
4650 /// A pointer to the contents in the error state.
4651 /// Reading from this pointer when `result_ok` is set is undefined.
4652 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4655 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4656 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4658 pub struct CResult_NonePaymentSendFailureZ {
4659 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4660 /// `err` or `result` depending on the state of `result_ok`.
4661 pub contents: CResult_NonePaymentSendFailureZPtr,
4662 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4663 pub result_ok: bool,
4666 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4667 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4668 CResult_NonePaymentSendFailureZ {
4669 contents: CResult_NonePaymentSendFailureZPtr {
4670 result: std::ptr::null_mut(),
4676 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4677 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4678 CResult_NonePaymentSendFailureZ {
4679 contents: CResult_NonePaymentSendFailureZPtr {
4680 err: Box::into_raw(Box::new(e)),
4686 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4687 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4688 impl Drop for CResult_NonePaymentSendFailureZ {
4689 fn drop(&mut self) {
4692 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4693 let _ = unsafe { Box::from_raw(self.contents.err) };
4698 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4699 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4700 let contents = if o.result_ok {
4701 let _ = unsafe { Box::from_raw(o.contents.result) };
4702 o.contents.result = std::ptr::null_mut();
4703 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4705 let err = unsafe { o.contents.err };
4706 unsafe { o.contents.err = std::ptr::null_mut(); }
4707 CResult_NonePaymentSendFailureZPtr { err }
4711 result_ok: o.result_ok,
4715 impl Clone for CResult_NonePaymentSendFailureZ {
4716 fn clone(&self) -> Self {
4718 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4719 result: std::ptr::null_mut()
4722 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4723 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4729 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4730 /// but with all dynamically-allocated buffers duplicated in new buffers.
4731 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
4733 /// A tuple of 2 elements. See the individual fields for the types contained.
4734 pub struct C2Tuple_PaymentHashPaymentIdZ {
4735 /// The element at position 0
4736 pub a: crate::c_types::ThirtyTwoBytes,
4737 /// The element at position 1
4738 pub b: crate::lightning::ln::channelmanager::PaymentId,
4740 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId)> for C2Tuple_PaymentHashPaymentIdZ {
4741 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId)) -> Self {
4748 impl C2Tuple_PaymentHashPaymentIdZ {
4749 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId) {
4753 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
4754 fn clone(&self) -> Self {
4756 a: Clone::clone(&self.a),
4757 b: Clone::clone(&self.b),
4762 /// Creates a new tuple which has the same data as `orig`
4763 /// but with all dynamically-allocated buffers duplicated in new buffers.
4764 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
4765 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
4767 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::PaymentId) -> C2Tuple_PaymentHashPaymentIdZ {
4768 C2Tuple_PaymentHashPaymentIdZ { a, b, }
4772 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
4773 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
4775 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
4776 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4777 /// A pointer to the contents in the success state.
4778 /// Reading from this pointer when `result_ok` is not set is undefined.
4779 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
4780 /// A pointer to the contents in the error state.
4781 /// Reading from this pointer when `result_ok` is set is undefined.
4782 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4785 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
4786 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4788 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4789 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
4790 /// `err` or `result` depending on the state of `result_ok`.
4791 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
4792 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
4793 pub result_ok: bool,
4796 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
4797 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4798 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4799 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4800 result: Box::into_raw(Box::new(o)),
4806 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
4807 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4808 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4809 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4810 err: Box::into_raw(Box::new(e)),
4816 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
4817 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
4818 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4819 fn drop(&mut self) {
4821 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4822 let _ = unsafe { Box::from_raw(self.contents.result) };
4825 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4826 let _ = unsafe { Box::from_raw(self.contents.err) };
4831 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4832 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4833 let contents = if o.result_ok {
4834 let result = unsafe { o.contents.result };
4835 unsafe { o.contents.result = std::ptr::null_mut() };
4836 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
4838 let err = unsafe { o.contents.err };
4839 unsafe { o.contents.err = std::ptr::null_mut(); }
4840 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
4844 result_ok: o.result_ok,
4848 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4849 fn clone(&self) -> Self {
4851 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4852 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
4855 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4856 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4862 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
4863 /// but with all dynamically-allocated buffers duplicated in new buffers.
4864 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
4866 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4867 /// This corresponds to std::vector in C++
4868 pub struct CVec_NetAddressZ {
4869 /// The elements in the array.
4870 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4871 pub data: *mut crate::lightning::ln::msgs::NetAddress,
4872 /// The number of elements pointed to by `data`.
4875 impl CVec_NetAddressZ {
4876 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4877 if self.datalen == 0 { return Vec::new(); }
4878 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4879 self.data = std::ptr::null_mut();
4883 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4884 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4887 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4888 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4889 let datalen = v.len();
4890 let data = Box::into_raw(v.into_boxed_slice());
4891 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4895 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4896 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4897 impl Drop for CVec_NetAddressZ {
4898 fn drop(&mut self) {
4899 if self.datalen == 0 { return; }
4900 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4903 impl Clone for CVec_NetAddressZ {
4904 fn clone(&self) -> Self {
4905 let mut res = Vec::new();
4906 if self.datalen == 0 { return Self::from(res); }
4907 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4912 /// A tuple of 2 elements. See the individual fields for the types contained.
4913 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4914 /// The element at position 0
4915 pub a: crate::c_types::ThirtyTwoBytes,
4916 /// The element at position 1
4917 pub b: crate::c_types::ThirtyTwoBytes,
4919 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4920 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4927 impl C2Tuple_PaymentHashPaymentSecretZ {
4928 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4932 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4933 fn clone(&self) -> Self {
4935 a: Clone::clone(&self.a),
4936 b: Clone::clone(&self.b),
4941 /// Creates a new tuple which has the same data as `orig`
4942 /// but with all dynamically-allocated buffers duplicated in new buffers.
4943 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
4944 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4946 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4947 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4951 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4952 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4954 /// The contents of CResult_PaymentSecretAPIErrorZ
4955 pub union CResult_PaymentSecretAPIErrorZPtr {
4956 /// A pointer to the contents in the success state.
4957 /// Reading from this pointer when `result_ok` is not set is undefined.
4958 pub result: *mut crate::c_types::ThirtyTwoBytes,
4959 /// A pointer to the contents in the error state.
4960 /// Reading from this pointer when `result_ok` is set is undefined.
4961 pub err: *mut crate::lightning::util::errors::APIError,
4964 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4965 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4967 pub struct CResult_PaymentSecretAPIErrorZ {
4968 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4969 /// `err` or `result` depending on the state of `result_ok`.
4970 pub contents: CResult_PaymentSecretAPIErrorZPtr,
4971 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4972 pub result_ok: bool,
4975 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4976 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4977 CResult_PaymentSecretAPIErrorZ {
4978 contents: CResult_PaymentSecretAPIErrorZPtr {
4979 result: Box::into_raw(Box::new(o)),
4985 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4986 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4987 CResult_PaymentSecretAPIErrorZ {
4988 contents: CResult_PaymentSecretAPIErrorZPtr {
4989 err: Box::into_raw(Box::new(e)),
4995 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4996 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4997 impl Drop for CResult_PaymentSecretAPIErrorZ {
4998 fn drop(&mut self) {
5000 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5001 let _ = unsafe { Box::from_raw(self.contents.result) };
5004 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5005 let _ = unsafe { Box::from_raw(self.contents.err) };
5010 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
5011 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5012 let contents = if o.result_ok {
5013 let result = unsafe { o.contents.result };
5014 unsafe { o.contents.result = std::ptr::null_mut() };
5015 CResult_PaymentSecretAPIErrorZPtr { result }
5017 let err = unsafe { o.contents.err };
5018 unsafe { o.contents.err = std::ptr::null_mut(); }
5019 CResult_PaymentSecretAPIErrorZPtr { err }
5023 result_ok: o.result_ok,
5027 impl Clone for CResult_PaymentSecretAPIErrorZ {
5028 fn clone(&self) -> Self {
5030 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
5031 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5034 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
5035 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5041 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
5042 /// but with all dynamically-allocated buffers duplicated in new buffers.
5043 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
5045 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
5046 /// This corresponds to std::vector in C++
5047 pub struct CVec_ChannelMonitorZ {
5048 /// The elements in the array.
5049 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5050 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
5051 /// The number of elements pointed to by `data`.
5054 impl CVec_ChannelMonitorZ {
5055 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
5056 if self.datalen == 0 { return Vec::new(); }
5057 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5058 self.data = std::ptr::null_mut();
5062 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
5063 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5066 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
5067 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
5068 let datalen = v.len();
5069 let data = Box::into_raw(v.into_boxed_slice());
5070 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5074 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5075 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
5076 impl Drop for CVec_ChannelMonitorZ {
5077 fn drop(&mut self) {
5078 if self.datalen == 0 { return; }
5079 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5083 /// A tuple of 2 elements. See the individual fields for the types contained.
5084 pub struct C2Tuple_BlockHashChannelManagerZ {
5085 /// The element at position 0
5086 pub a: crate::c_types::ThirtyTwoBytes,
5087 /// The element at position 1
5088 pub b: crate::lightning::ln::channelmanager::ChannelManager,
5090 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
5091 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
5098 impl C2Tuple_BlockHashChannelManagerZ {
5099 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
5103 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
5105 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
5106 C2Tuple_BlockHashChannelManagerZ { a, b, }
5110 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
5111 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
5113 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5114 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5115 /// A pointer to the contents in the success state.
5116 /// Reading from this pointer when `result_ok` is not set is undefined.
5117 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
5118 /// A pointer to the contents in the error state.
5119 /// Reading from this pointer when `result_ok` is set is undefined.
5120 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5123 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5124 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5126 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5127 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5128 /// `err` or `result` depending on the state of `result_ok`.
5129 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
5130 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5131 pub result_ok: bool,
5134 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
5135 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5136 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5137 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5138 result: Box::into_raw(Box::new(o)),
5144 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
5145 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5146 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5147 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5148 err: Box::into_raw(Box::new(e)),
5154 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
5155 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
5156 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5157 fn drop(&mut self) {
5159 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5160 let _ = unsafe { Box::from_raw(self.contents.result) };
5163 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5164 let _ = unsafe { Box::from_raw(self.contents.err) };
5169 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5170 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5171 let contents = if o.result_ok {
5172 let result = unsafe { o.contents.result };
5173 unsafe { o.contents.result = std::ptr::null_mut() };
5174 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
5176 let err = unsafe { o.contents.err };
5177 unsafe { o.contents.err = std::ptr::null_mut(); }
5178 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
5182 result_ok: o.result_ok,
5187 /// The contents of CResult_ChannelConfigDecodeErrorZ
5188 pub union CResult_ChannelConfigDecodeErrorZPtr {
5189 /// A pointer to the contents in the success state.
5190 /// Reading from this pointer when `result_ok` is not set is undefined.
5191 pub result: *mut crate::lightning::util::config::ChannelConfig,
5192 /// A pointer to the contents in the error state.
5193 /// Reading from this pointer when `result_ok` is set is undefined.
5194 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5197 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5198 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5199 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5200 pub struct CResult_ChannelConfigDecodeErrorZ {
5201 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5202 /// `err` or `result` depending on the state of `result_ok`.
5203 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
5204 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5205 pub result_ok: bool,
5208 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
5209 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
5210 CResult_ChannelConfigDecodeErrorZ {
5211 contents: CResult_ChannelConfigDecodeErrorZPtr {
5212 result: Box::into_raw(Box::new(o)),
5218 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
5219 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
5220 CResult_ChannelConfigDecodeErrorZ {
5221 contents: CResult_ChannelConfigDecodeErrorZPtr {
5222 err: Box::into_raw(Box::new(e)),
5228 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
5229 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
5230 impl Drop for CResult_ChannelConfigDecodeErrorZ {
5231 fn drop(&mut self) {
5233 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5234 let _ = unsafe { Box::from_raw(self.contents.result) };
5237 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5238 let _ = unsafe { Box::from_raw(self.contents.err) };
5243 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
5244 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
5245 let contents = if o.result_ok {
5246 let result = unsafe { o.contents.result };
5247 unsafe { o.contents.result = std::ptr::null_mut() };
5248 CResult_ChannelConfigDecodeErrorZPtr { result }
5250 let err = unsafe { o.contents.err };
5251 unsafe { o.contents.err = std::ptr::null_mut(); }
5252 CResult_ChannelConfigDecodeErrorZPtr { err }
5256 result_ok: o.result_ok,
5260 impl Clone for CResult_ChannelConfigDecodeErrorZ {
5261 fn clone(&self) -> Self {
5263 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
5264 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
5267 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
5268 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5274 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
5275 /// but with all dynamically-allocated buffers duplicated in new buffers.
5276 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
5278 /// The contents of CResult_OutPointDecodeErrorZ
5279 pub union CResult_OutPointDecodeErrorZPtr {
5280 /// A pointer to the contents in the success state.
5281 /// Reading from this pointer when `result_ok` is not set is undefined.
5282 pub result: *mut crate::lightning::chain::transaction::OutPoint,
5283 /// A pointer to the contents in the error state.
5284 /// Reading from this pointer when `result_ok` is set is undefined.
5285 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5288 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5289 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5291 pub struct CResult_OutPointDecodeErrorZ {
5292 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5293 /// `err` or `result` depending on the state of `result_ok`.
5294 pub contents: CResult_OutPointDecodeErrorZPtr,
5295 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
5296 pub result_ok: bool,
5299 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
5300 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
5301 CResult_OutPointDecodeErrorZ {
5302 contents: CResult_OutPointDecodeErrorZPtr {
5303 result: Box::into_raw(Box::new(o)),
5309 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
5310 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
5311 CResult_OutPointDecodeErrorZ {
5312 contents: CResult_OutPointDecodeErrorZPtr {
5313 err: Box::into_raw(Box::new(e)),
5319 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
5320 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
5321 impl Drop for CResult_OutPointDecodeErrorZ {
5322 fn drop(&mut self) {
5324 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5325 let _ = unsafe { Box::from_raw(self.contents.result) };
5328 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5329 let _ = unsafe { Box::from_raw(self.contents.err) };
5334 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
5335 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5336 let contents = if o.result_ok {
5337 let result = unsafe { o.contents.result };
5338 unsafe { o.contents.result = std::ptr::null_mut() };
5339 CResult_OutPointDecodeErrorZPtr { result }
5341 let err = unsafe { o.contents.err };
5342 unsafe { o.contents.err = std::ptr::null_mut(); }
5343 CResult_OutPointDecodeErrorZPtr { err }
5347 result_ok: o.result_ok,
5351 impl Clone for CResult_OutPointDecodeErrorZ {
5352 fn clone(&self) -> Self {
5354 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
5355 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
5358 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
5359 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5365 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
5366 /// but with all dynamically-allocated buffers duplicated in new buffers.
5367 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
5369 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
5370 pub enum COption_TypeZ {
5371 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5372 Some(crate::lightning::ln::wire::Type),
5373 /// When we're in this state, this COption_TypeZ contains nothing
5376 impl COption_TypeZ {
5377 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5378 if let Self::Some(_) = self { true } else { false }
5380 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5383 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
5384 if let Self::Some(v) = self { v } else { unreachable!() }
5388 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
5389 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
5390 COption_TypeZ::Some(o)
5393 /// Constructs a new COption_TypeZ containing nothing
5394 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
5398 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
5399 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
5401 /// The contents of CResult_COption_TypeZDecodeErrorZ
5402 pub union CResult_COption_TypeZDecodeErrorZPtr {
5403 /// A pointer to the contents in the success state.
5404 /// Reading from this pointer when `result_ok` is not set is undefined.
5405 pub result: *mut crate::c_types::derived::COption_TypeZ,
5406 /// A pointer to the contents in the error state.
5407 /// Reading from this pointer when `result_ok` is set is undefined.
5408 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5411 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5412 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5414 pub struct CResult_COption_TypeZDecodeErrorZ {
5415 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5416 /// `err` or `result` depending on the state of `result_ok`.
5417 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
5418 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5419 pub result_ok: bool,
5422 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
5423 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
5424 CResult_COption_TypeZDecodeErrorZ {
5425 contents: CResult_COption_TypeZDecodeErrorZPtr {
5426 result: Box::into_raw(Box::new(o)),
5432 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
5433 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
5434 CResult_COption_TypeZDecodeErrorZ {
5435 contents: CResult_COption_TypeZDecodeErrorZPtr {
5436 err: Box::into_raw(Box::new(e)),
5442 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
5443 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
5444 impl Drop for CResult_COption_TypeZDecodeErrorZ {
5445 fn drop(&mut self) {
5447 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5448 let _ = unsafe { Box::from_raw(self.contents.result) };
5451 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5452 let _ = unsafe { Box::from_raw(self.contents.err) };
5457 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
5458 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5459 let contents = if o.result_ok {
5460 let result = unsafe { o.contents.result };
5461 unsafe { o.contents.result = std::ptr::null_mut() };
5462 CResult_COption_TypeZDecodeErrorZPtr { result }
5464 let err = unsafe { o.contents.err };
5465 unsafe { o.contents.err = std::ptr::null_mut(); }
5466 CResult_COption_TypeZDecodeErrorZPtr { err }
5470 result_ok: o.result_ok,
5475 /// The contents of CResult_SiPrefixNoneZ
5476 pub union CResult_SiPrefixNoneZPtr {
5477 /// A pointer to the contents in the success state.
5478 /// Reading from this pointer when `result_ok` is not set is undefined.
5479 pub result: *mut crate::lightning_invoice::SiPrefix,
5480 /// Note that this value is always NULL, as there are no contents in the Err variant
5481 pub err: *mut std::ffi::c_void,
5484 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5485 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5487 pub struct CResult_SiPrefixNoneZ {
5488 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
5489 /// `err` or `result` depending on the state of `result_ok`.
5490 pub contents: CResult_SiPrefixNoneZPtr,
5491 /// Whether this CResult_SiPrefixNoneZ represents a success state.
5492 pub result_ok: bool,
5495 /// Creates a new CResult_SiPrefixNoneZ in the success state.
5496 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
5497 CResult_SiPrefixNoneZ {
5498 contents: CResult_SiPrefixNoneZPtr {
5499 result: Box::into_raw(Box::new(o)),
5505 /// Creates a new CResult_SiPrefixNoneZ in the error state.
5506 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
5507 CResult_SiPrefixNoneZ {
5508 contents: CResult_SiPrefixNoneZPtr {
5509 err: std::ptr::null_mut(),
5515 /// Frees any resources used by the CResult_SiPrefixNoneZ.
5516 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
5517 impl Drop for CResult_SiPrefixNoneZ {
5518 fn drop(&mut self) {
5520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5521 let _ = unsafe { Box::from_raw(self.contents.result) };
5527 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
5528 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
5529 let contents = if o.result_ok {
5530 let result = unsafe { o.contents.result };
5531 unsafe { o.contents.result = std::ptr::null_mut() };
5532 CResult_SiPrefixNoneZPtr { result }
5534 let _ = unsafe { Box::from_raw(o.contents.err) };
5535 o.contents.err = std::ptr::null_mut();
5536 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
5540 result_ok: o.result_ok,
5544 impl Clone for CResult_SiPrefixNoneZ {
5545 fn clone(&self) -> Self {
5547 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
5548 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
5551 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
5552 err: std::ptr::null_mut()
5558 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
5559 /// but with all dynamically-allocated buffers duplicated in new buffers.
5560 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
5562 /// The contents of CResult_InvoiceNoneZ
5563 pub union CResult_InvoiceNoneZPtr {
5564 /// A pointer to the contents in the success state.
5565 /// Reading from this pointer when `result_ok` is not set is undefined.
5566 pub result: *mut crate::lightning_invoice::Invoice,
5567 /// Note that this value is always NULL, as there are no contents in the Err variant
5568 pub err: *mut std::ffi::c_void,
5571 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
5572 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
5573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5574 pub struct CResult_InvoiceNoneZ {
5575 /// The contents of this CResult_InvoiceNoneZ, accessible via either
5576 /// `err` or `result` depending on the state of `result_ok`.
5577 pub contents: CResult_InvoiceNoneZPtr,
5578 /// Whether this CResult_InvoiceNoneZ represents a success state.
5579 pub result_ok: bool,
5582 /// Creates a new CResult_InvoiceNoneZ in the success state.
5583 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
5584 CResult_InvoiceNoneZ {
5585 contents: CResult_InvoiceNoneZPtr {
5586 result: Box::into_raw(Box::new(o)),
5592 /// Creates a new CResult_InvoiceNoneZ in the error state.
5593 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
5594 CResult_InvoiceNoneZ {
5595 contents: CResult_InvoiceNoneZPtr {
5596 err: std::ptr::null_mut(),
5602 /// Frees any resources used by the CResult_InvoiceNoneZ.
5603 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
5604 impl Drop for CResult_InvoiceNoneZ {
5605 fn drop(&mut self) {
5607 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5608 let _ = unsafe { Box::from_raw(self.contents.result) };
5614 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
5615 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
5616 let contents = if o.result_ok {
5617 let result = unsafe { o.contents.result };
5618 unsafe { o.contents.result = std::ptr::null_mut() };
5619 CResult_InvoiceNoneZPtr { result }
5621 let _ = unsafe { Box::from_raw(o.contents.err) };
5622 o.contents.err = std::ptr::null_mut();
5623 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
5627 result_ok: o.result_ok,
5631 impl Clone for CResult_InvoiceNoneZ {
5632 fn clone(&self) -> Self {
5634 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
5635 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5638 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
5639 err: std::ptr::null_mut()
5645 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
5646 /// but with all dynamically-allocated buffers duplicated in new buffers.
5647 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
5649 /// The contents of CResult_SignedRawInvoiceNoneZ
5650 pub union CResult_SignedRawInvoiceNoneZPtr {
5651 /// A pointer to the contents in the success state.
5652 /// Reading from this pointer when `result_ok` is not set is undefined.
5653 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
5654 /// Note that this value is always NULL, as there are no contents in the Err variant
5655 pub err: *mut std::ffi::c_void,
5658 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5659 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5660 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5661 pub struct CResult_SignedRawInvoiceNoneZ {
5662 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5663 /// `err` or `result` depending on the state of `result_ok`.
5664 pub contents: CResult_SignedRawInvoiceNoneZPtr,
5665 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5666 pub result_ok: bool,
5669 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
5670 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
5671 CResult_SignedRawInvoiceNoneZ {
5672 contents: CResult_SignedRawInvoiceNoneZPtr {
5673 result: Box::into_raw(Box::new(o)),
5679 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
5680 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
5681 CResult_SignedRawInvoiceNoneZ {
5682 contents: CResult_SignedRawInvoiceNoneZPtr {
5683 err: std::ptr::null_mut(),
5689 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
5690 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
5691 impl Drop for CResult_SignedRawInvoiceNoneZ {
5692 fn drop(&mut self) {
5694 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5695 let _ = unsafe { Box::from_raw(self.contents.result) };
5701 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
5702 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
5703 let contents = if o.result_ok {
5704 let result = unsafe { o.contents.result };
5705 unsafe { o.contents.result = std::ptr::null_mut() };
5706 CResult_SignedRawInvoiceNoneZPtr { result }
5708 let _ = unsafe { Box::from_raw(o.contents.err) };
5709 o.contents.err = std::ptr::null_mut();
5710 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
5714 result_ok: o.result_ok,
5718 impl Clone for CResult_SignedRawInvoiceNoneZ {
5719 fn clone(&self) -> Self {
5721 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
5722 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
5725 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
5726 err: std::ptr::null_mut()
5732 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
5733 /// but with all dynamically-allocated buffers duplicated in new buffers.
5734 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
5736 /// A tuple of 3 elements. See the individual fields for the types contained.
5737 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5738 /// The element at position 0
5739 pub a: crate::lightning_invoice::RawInvoice,
5740 /// The element at position 1
5741 pub b: crate::c_types::ThirtyTwoBytes,
5742 /// The element at position 2
5743 pub c: crate::lightning_invoice::InvoiceSignature,
5745 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5746 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
5754 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5755 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
5756 (self.a, self.b, self.c)
5759 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5760 fn clone(&self) -> Self {
5762 a: Clone::clone(&self.a),
5763 b: Clone::clone(&self.b),
5764 c: Clone::clone(&self.c),
5769 /// Creates a new tuple which has the same data as `orig`
5770 /// but with all dynamically-allocated buffers duplicated in new buffers.
5771 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
5772 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
5774 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 {
5775 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
5779 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
5780 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
5782 /// The contents of CResult_PayeePubKeyErrorZ
5783 pub union CResult_PayeePubKeyErrorZPtr {
5784 /// A pointer to the contents in the success state.
5785 /// Reading from this pointer when `result_ok` is not set is undefined.
5786 pub result: *mut crate::lightning_invoice::PayeePubKey,
5787 /// A pointer to the contents in the error state.
5788 /// Reading from this pointer when `result_ok` is set is undefined.
5789 pub err: *mut crate::c_types::Secp256k1Error,
5792 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5793 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5795 pub struct CResult_PayeePubKeyErrorZ {
5796 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5797 /// `err` or `result` depending on the state of `result_ok`.
5798 pub contents: CResult_PayeePubKeyErrorZPtr,
5799 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
5800 pub result_ok: bool,
5803 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
5804 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
5805 CResult_PayeePubKeyErrorZ {
5806 contents: CResult_PayeePubKeyErrorZPtr {
5807 result: Box::into_raw(Box::new(o)),
5813 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
5814 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
5815 CResult_PayeePubKeyErrorZ {
5816 contents: CResult_PayeePubKeyErrorZPtr {
5817 err: Box::into_raw(Box::new(e)),
5823 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
5824 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
5825 impl Drop for CResult_PayeePubKeyErrorZ {
5826 fn drop(&mut self) {
5828 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5829 let _ = unsafe { Box::from_raw(self.contents.result) };
5832 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5833 let _ = unsafe { Box::from_raw(self.contents.err) };
5838 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
5839 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
5840 let contents = if o.result_ok {
5841 let result = unsafe { o.contents.result };
5842 unsafe { o.contents.result = std::ptr::null_mut() };
5843 CResult_PayeePubKeyErrorZPtr { result }
5845 let err = unsafe { o.contents.err };
5846 unsafe { o.contents.err = std::ptr::null_mut(); }
5847 CResult_PayeePubKeyErrorZPtr { err }
5851 result_ok: o.result_ok,
5855 impl Clone for CResult_PayeePubKeyErrorZ {
5856 fn clone(&self) -> Self {
5858 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
5859 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
5862 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
5863 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5869 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
5873 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5874 /// This corresponds to std::vector in C++
5875 pub struct CVec_PrivateRouteZ {
5876 /// The elements in the array.
5877 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5878 pub data: *mut crate::lightning_invoice::PrivateRoute,
5879 /// The number of elements pointed to by `data`.
5882 impl CVec_PrivateRouteZ {
5883 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5884 if self.datalen == 0 { return Vec::new(); }
5885 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5886 self.data = std::ptr::null_mut();
5890 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5891 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5894 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5895 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5896 let datalen = v.len();
5897 let data = Box::into_raw(v.into_boxed_slice());
5898 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5902 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5903 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5904 impl Drop for CVec_PrivateRouteZ {
5905 fn drop(&mut self) {
5906 if self.datalen == 0 { return; }
5907 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5910 impl Clone for CVec_PrivateRouteZ {
5911 fn clone(&self) -> Self {
5912 let mut res = Vec::new();
5913 if self.datalen == 0 { return Self::from(res); }
5914 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5919 /// The contents of CResult_PositiveTimestampCreationErrorZ
5920 pub union CResult_PositiveTimestampCreationErrorZPtr {
5921 /// A pointer to the contents in the success state.
5922 /// Reading from this pointer when `result_ok` is not set is undefined.
5923 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5924 /// A pointer to the contents in the error state.
5925 /// Reading from this pointer when `result_ok` is set is undefined.
5926 pub err: *mut crate::lightning_invoice::CreationError,
5929 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5930 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5931 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5932 pub struct CResult_PositiveTimestampCreationErrorZ {
5933 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5934 /// `err` or `result` depending on the state of `result_ok`.
5935 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5936 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5937 pub result_ok: bool,
5940 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5941 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5942 CResult_PositiveTimestampCreationErrorZ {
5943 contents: CResult_PositiveTimestampCreationErrorZPtr {
5944 result: Box::into_raw(Box::new(o)),
5950 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5951 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5952 CResult_PositiveTimestampCreationErrorZ {
5953 contents: CResult_PositiveTimestampCreationErrorZPtr {
5954 err: Box::into_raw(Box::new(e)),
5960 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5961 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5962 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5963 fn drop(&mut self) {
5965 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5966 let _ = unsafe { Box::from_raw(self.contents.result) };
5969 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5970 let _ = unsafe { Box::from_raw(self.contents.err) };
5975 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5976 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5977 let contents = if o.result_ok {
5978 let result = unsafe { o.contents.result };
5979 unsafe { o.contents.result = std::ptr::null_mut() };
5980 CResult_PositiveTimestampCreationErrorZPtr { result }
5982 let err = unsafe { o.contents.err };
5983 unsafe { o.contents.err = std::ptr::null_mut(); }
5984 CResult_PositiveTimestampCreationErrorZPtr { err }
5988 result_ok: o.result_ok,
5992 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5993 fn clone(&self) -> Self {
5995 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5996 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5999 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
6000 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6006 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
6007 /// but with all dynamically-allocated buffers duplicated in new buffers.
6008 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
6010 /// The contents of CResult_NoneSemanticErrorZ
6011 pub union CResult_NoneSemanticErrorZPtr {
6012 /// Note that this value is always NULL, as there are no contents in the OK variant
6013 pub result: *mut std::ffi::c_void,
6014 /// A pointer to the contents in the error state.
6015 /// Reading from this pointer when `result_ok` is set is undefined.
6016 pub err: *mut crate::lightning_invoice::SemanticError,
6019 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
6020 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
6021 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6022 pub struct CResult_NoneSemanticErrorZ {
6023 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
6024 /// `err` or `result` depending on the state of `result_ok`.
6025 pub contents: CResult_NoneSemanticErrorZPtr,
6026 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
6027 pub result_ok: bool,
6030 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
6031 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
6032 CResult_NoneSemanticErrorZ {
6033 contents: CResult_NoneSemanticErrorZPtr {
6034 result: std::ptr::null_mut(),
6040 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
6041 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
6042 CResult_NoneSemanticErrorZ {
6043 contents: CResult_NoneSemanticErrorZPtr {
6044 err: Box::into_raw(Box::new(e)),
6050 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
6051 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
6052 impl Drop for CResult_NoneSemanticErrorZ {
6053 fn drop(&mut self) {
6056 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6057 let _ = unsafe { Box::from_raw(self.contents.err) };
6062 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
6063 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
6064 let contents = if o.result_ok {
6065 let _ = unsafe { Box::from_raw(o.contents.result) };
6066 o.contents.result = std::ptr::null_mut();
6067 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
6069 let err = unsafe { o.contents.err };
6070 unsafe { o.contents.err = std::ptr::null_mut(); }
6071 CResult_NoneSemanticErrorZPtr { err }
6075 result_ok: o.result_ok,
6079 impl Clone for CResult_NoneSemanticErrorZ {
6080 fn clone(&self) -> Self {
6082 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
6083 result: std::ptr::null_mut()
6086 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
6087 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6093 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
6094 /// but with all dynamically-allocated buffers duplicated in new buffers.
6095 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
6097 /// The contents of CResult_InvoiceSemanticErrorZ
6098 pub union CResult_InvoiceSemanticErrorZPtr {
6099 /// A pointer to the contents in the success state.
6100 /// Reading from this pointer when `result_ok` is not set is undefined.
6101 pub result: *mut crate::lightning_invoice::Invoice,
6102 /// A pointer to the contents in the error state.
6103 /// Reading from this pointer when `result_ok` is set is undefined.
6104 pub err: *mut crate::lightning_invoice::SemanticError,
6107 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
6108 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
6109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6110 pub struct CResult_InvoiceSemanticErrorZ {
6111 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
6112 /// `err` or `result` depending on the state of `result_ok`.
6113 pub contents: CResult_InvoiceSemanticErrorZPtr,
6114 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
6115 pub result_ok: bool,
6118 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
6119 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
6120 CResult_InvoiceSemanticErrorZ {
6121 contents: CResult_InvoiceSemanticErrorZPtr {
6122 result: Box::into_raw(Box::new(o)),
6128 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
6129 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
6130 CResult_InvoiceSemanticErrorZ {
6131 contents: CResult_InvoiceSemanticErrorZPtr {
6132 err: Box::into_raw(Box::new(e)),
6138 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
6139 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
6140 impl Drop for CResult_InvoiceSemanticErrorZ {
6141 fn drop(&mut self) {
6143 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6144 let _ = unsafe { Box::from_raw(self.contents.result) };
6147 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6148 let _ = unsafe { Box::from_raw(self.contents.err) };
6153 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
6154 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
6155 let contents = if o.result_ok {
6156 let result = unsafe { o.contents.result };
6157 unsafe { o.contents.result = std::ptr::null_mut() };
6158 CResult_InvoiceSemanticErrorZPtr { result }
6160 let err = unsafe { o.contents.err };
6161 unsafe { o.contents.err = std::ptr::null_mut(); }
6162 CResult_InvoiceSemanticErrorZPtr { err }
6166 result_ok: o.result_ok,
6170 impl Clone for CResult_InvoiceSemanticErrorZ {
6171 fn clone(&self) -> Self {
6173 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
6174 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6177 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
6178 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6184 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
6185 /// but with all dynamically-allocated buffers duplicated in new buffers.
6186 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
6188 /// The contents of CResult_DescriptionCreationErrorZ
6189 pub union CResult_DescriptionCreationErrorZPtr {
6190 /// A pointer to the contents in the success state.
6191 /// Reading from this pointer when `result_ok` is not set is undefined.
6192 pub result: *mut crate::lightning_invoice::Description,
6193 /// A pointer to the contents in the error state.
6194 /// Reading from this pointer when `result_ok` is set is undefined.
6195 pub err: *mut crate::lightning_invoice::CreationError,
6198 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
6199 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
6200 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6201 pub struct CResult_DescriptionCreationErrorZ {
6202 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
6203 /// `err` or `result` depending on the state of `result_ok`.
6204 pub contents: CResult_DescriptionCreationErrorZPtr,
6205 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
6206 pub result_ok: bool,
6209 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
6210 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
6211 CResult_DescriptionCreationErrorZ {
6212 contents: CResult_DescriptionCreationErrorZPtr {
6213 result: Box::into_raw(Box::new(o)),
6219 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
6220 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
6221 CResult_DescriptionCreationErrorZ {
6222 contents: CResult_DescriptionCreationErrorZPtr {
6223 err: Box::into_raw(Box::new(e)),
6229 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
6230 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
6231 impl Drop for CResult_DescriptionCreationErrorZ {
6232 fn drop(&mut self) {
6234 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6235 let _ = unsafe { Box::from_raw(self.contents.result) };
6238 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6239 let _ = unsafe { Box::from_raw(self.contents.err) };
6244 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
6245 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
6246 let contents = if o.result_ok {
6247 let result = unsafe { o.contents.result };
6248 unsafe { o.contents.result = std::ptr::null_mut() };
6249 CResult_DescriptionCreationErrorZPtr { result }
6251 let err = unsafe { o.contents.err };
6252 unsafe { o.contents.err = std::ptr::null_mut(); }
6253 CResult_DescriptionCreationErrorZPtr { err }
6257 result_ok: o.result_ok,
6261 impl Clone for CResult_DescriptionCreationErrorZ {
6262 fn clone(&self) -> Self {
6264 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
6265 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
6268 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
6269 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6275 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
6276 /// but with all dynamically-allocated buffers duplicated in new buffers.
6277 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
6279 /// The contents of CResult_ExpiryTimeCreationErrorZ
6280 pub union CResult_ExpiryTimeCreationErrorZPtr {
6281 /// A pointer to the contents in the success state.
6282 /// Reading from this pointer when `result_ok` is not set is undefined.
6283 pub result: *mut crate::lightning_invoice::ExpiryTime,
6284 /// A pointer to the contents in the error state.
6285 /// Reading from this pointer when `result_ok` is set is undefined.
6286 pub err: *mut crate::lightning_invoice::CreationError,
6289 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6290 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6291 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6292 pub struct CResult_ExpiryTimeCreationErrorZ {
6293 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6294 /// `err` or `result` depending on the state of `result_ok`.
6295 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
6296 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6297 pub result_ok: bool,
6300 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
6301 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
6302 CResult_ExpiryTimeCreationErrorZ {
6303 contents: CResult_ExpiryTimeCreationErrorZPtr {
6304 result: Box::into_raw(Box::new(o)),
6310 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
6311 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
6312 CResult_ExpiryTimeCreationErrorZ {
6313 contents: CResult_ExpiryTimeCreationErrorZPtr {
6314 err: Box::into_raw(Box::new(e)),
6320 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
6321 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
6322 impl Drop for CResult_ExpiryTimeCreationErrorZ {
6323 fn drop(&mut self) {
6325 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6326 let _ = unsafe { Box::from_raw(self.contents.result) };
6329 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6330 let _ = unsafe { Box::from_raw(self.contents.err) };
6335 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
6336 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
6337 let contents = if o.result_ok {
6338 let result = unsafe { o.contents.result };
6339 unsafe { o.contents.result = std::ptr::null_mut() };
6340 CResult_ExpiryTimeCreationErrorZPtr { result }
6342 let err = unsafe { o.contents.err };
6343 unsafe { o.contents.err = std::ptr::null_mut(); }
6344 CResult_ExpiryTimeCreationErrorZPtr { err }
6348 result_ok: o.result_ok,
6352 impl Clone for CResult_ExpiryTimeCreationErrorZ {
6353 fn clone(&self) -> Self {
6355 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
6356 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
6359 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
6360 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6366 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
6367 /// but with all dynamically-allocated buffers duplicated in new buffers.
6368 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
6370 /// The contents of CResult_PrivateRouteCreationErrorZ
6371 pub union CResult_PrivateRouteCreationErrorZPtr {
6372 /// A pointer to the contents in the success state.
6373 /// Reading from this pointer when `result_ok` is not set is undefined.
6374 pub result: *mut crate::lightning_invoice::PrivateRoute,
6375 /// A pointer to the contents in the error state.
6376 /// Reading from this pointer when `result_ok` is set is undefined.
6377 pub err: *mut crate::lightning_invoice::CreationError,
6380 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6381 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6383 pub struct CResult_PrivateRouteCreationErrorZ {
6384 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6385 /// `err` or `result` depending on the state of `result_ok`.
6386 pub contents: CResult_PrivateRouteCreationErrorZPtr,
6387 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6388 pub result_ok: bool,
6391 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
6392 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
6393 CResult_PrivateRouteCreationErrorZ {
6394 contents: CResult_PrivateRouteCreationErrorZPtr {
6395 result: Box::into_raw(Box::new(o)),
6401 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
6402 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
6403 CResult_PrivateRouteCreationErrorZ {
6404 contents: CResult_PrivateRouteCreationErrorZPtr {
6405 err: Box::into_raw(Box::new(e)),
6411 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
6412 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
6413 impl Drop for CResult_PrivateRouteCreationErrorZ {
6414 fn drop(&mut self) {
6416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6417 let _ = unsafe { Box::from_raw(self.contents.result) };
6420 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6421 let _ = unsafe { Box::from_raw(self.contents.err) };
6426 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
6427 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
6428 let contents = if o.result_ok {
6429 let result = unsafe { o.contents.result };
6430 unsafe { o.contents.result = std::ptr::null_mut() };
6431 CResult_PrivateRouteCreationErrorZPtr { result }
6433 let err = unsafe { o.contents.err };
6434 unsafe { o.contents.err = std::ptr::null_mut(); }
6435 CResult_PrivateRouteCreationErrorZPtr { err }
6439 result_ok: o.result_ok,
6443 impl Clone for CResult_PrivateRouteCreationErrorZ {
6444 fn clone(&self) -> Self {
6446 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
6447 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
6450 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
6451 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6457 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
6458 /// but with all dynamically-allocated buffers duplicated in new buffers.
6459 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
6461 /// The contents of CResult_StringErrorZ
6462 pub union CResult_StringErrorZPtr {
6463 /// A pointer to the contents in the success state.
6464 /// Reading from this pointer when `result_ok` is not set is undefined.
6465 pub result: *mut crate::c_types::Str,
6466 /// A pointer to the contents in the error state.
6467 /// Reading from this pointer when `result_ok` is set is undefined.
6468 pub err: *mut crate::c_types::Secp256k1Error,
6471 /// A CResult_StringErrorZ represents the result of a fallible operation,
6472 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6474 pub struct CResult_StringErrorZ {
6475 /// The contents of this CResult_StringErrorZ, accessible via either
6476 /// `err` or `result` depending on the state of `result_ok`.
6477 pub contents: CResult_StringErrorZPtr,
6478 /// Whether this CResult_StringErrorZ represents a success state.
6479 pub result_ok: bool,
6482 /// Creates a new CResult_StringErrorZ in the success state.
6483 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
6484 CResult_StringErrorZ {
6485 contents: CResult_StringErrorZPtr {
6486 result: Box::into_raw(Box::new(o)),
6492 /// Creates a new CResult_StringErrorZ in the error state.
6493 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
6494 CResult_StringErrorZ {
6495 contents: CResult_StringErrorZPtr {
6496 err: Box::into_raw(Box::new(e)),
6502 /// Frees any resources used by the CResult_StringErrorZ.
6503 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
6504 impl Drop for CResult_StringErrorZ {
6505 fn drop(&mut self) {
6507 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6508 let _ = unsafe { Box::from_raw(self.contents.result) };
6511 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6512 let _ = unsafe { Box::from_raw(self.contents.err) };
6517 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
6518 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
6519 let contents = if o.result_ok {
6520 let result = unsafe { o.contents.result };
6521 unsafe { o.contents.result = std::ptr::null_mut() };
6522 CResult_StringErrorZPtr { result }
6524 let err = unsafe { o.contents.err };
6525 unsafe { o.contents.err = std::ptr::null_mut(); }
6526 CResult_StringErrorZPtr { err }
6530 result_ok: o.result_ok,
6535 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6536 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6537 /// A pointer to the contents in the success state.
6538 /// Reading from this pointer when `result_ok` is not set is undefined.
6539 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
6540 /// A pointer to the contents in the error state.
6541 /// Reading from this pointer when `result_ok` is set is undefined.
6542 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6545 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6546 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6548 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
6549 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6550 /// `err` or `result` depending on the state of `result_ok`.
6551 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
6552 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6553 pub result_ok: bool,
6556 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
6557 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6558 CResult_ChannelMonitorUpdateDecodeErrorZ {
6559 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6560 result: Box::into_raw(Box::new(o)),
6566 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
6567 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6568 CResult_ChannelMonitorUpdateDecodeErrorZ {
6569 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6570 err: Box::into_raw(Box::new(e)),
6576 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
6577 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
6578 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
6579 fn drop(&mut self) {
6581 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6582 let _ = unsafe { Box::from_raw(self.contents.result) };
6585 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6586 let _ = unsafe { Box::from_raw(self.contents.err) };
6591 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
6592 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6593 let contents = if o.result_ok {
6594 let result = unsafe { o.contents.result };
6595 unsafe { o.contents.result = std::ptr::null_mut() };
6596 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
6598 let err = unsafe { o.contents.err };
6599 unsafe { o.contents.err = std::ptr::null_mut(); }
6600 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
6604 result_ok: o.result_ok,
6608 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
6609 fn clone(&self) -> Self {
6611 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6612 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
6615 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6616 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6622 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
6623 /// but with all dynamically-allocated buffers duplicated in new buffers.
6624 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
6626 /// The contents of CResult_HTLCUpdateDecodeErrorZ
6627 pub union CResult_HTLCUpdateDecodeErrorZPtr {
6628 /// A pointer to the contents in the success state.
6629 /// Reading from this pointer when `result_ok` is not set is undefined.
6630 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
6631 /// A pointer to the contents in the error state.
6632 /// Reading from this pointer when `result_ok` is set is undefined.
6633 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6636 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6637 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6638 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6639 pub struct CResult_HTLCUpdateDecodeErrorZ {
6640 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6641 /// `err` or `result` depending on the state of `result_ok`.
6642 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
6643 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6644 pub result_ok: bool,
6647 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
6648 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
6649 CResult_HTLCUpdateDecodeErrorZ {
6650 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6651 result: Box::into_raw(Box::new(o)),
6657 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
6658 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
6659 CResult_HTLCUpdateDecodeErrorZ {
6660 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6661 err: Box::into_raw(Box::new(e)),
6667 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
6668 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
6669 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
6670 fn drop(&mut self) {
6672 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6673 let _ = unsafe { Box::from_raw(self.contents.result) };
6676 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6677 let _ = unsafe { Box::from_raw(self.contents.err) };
6682 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
6683 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6684 let contents = if o.result_ok {
6685 let result = unsafe { o.contents.result };
6686 unsafe { o.contents.result = std::ptr::null_mut() };
6687 CResult_HTLCUpdateDecodeErrorZPtr { result }
6689 let err = unsafe { o.contents.err };
6690 unsafe { o.contents.err = std::ptr::null_mut(); }
6691 CResult_HTLCUpdateDecodeErrorZPtr { err }
6695 result_ok: o.result_ok,
6699 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
6700 fn clone(&self) -> Self {
6702 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6703 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
6706 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6707 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6713 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
6714 /// but with all dynamically-allocated buffers duplicated in new buffers.
6715 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
6717 /// The contents of CResult_NoneMonitorUpdateErrorZ
6718 pub union CResult_NoneMonitorUpdateErrorZPtr {
6719 /// Note that this value is always NULL, as there are no contents in the OK variant
6720 pub result: *mut std::ffi::c_void,
6721 /// A pointer to the contents in the error state.
6722 /// Reading from this pointer when `result_ok` is set is undefined.
6723 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
6726 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6727 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6729 pub struct CResult_NoneMonitorUpdateErrorZ {
6730 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6731 /// `err` or `result` depending on the state of `result_ok`.
6732 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
6733 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6734 pub result_ok: bool,
6737 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
6738 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
6739 CResult_NoneMonitorUpdateErrorZ {
6740 contents: CResult_NoneMonitorUpdateErrorZPtr {
6741 result: std::ptr::null_mut(),
6747 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
6748 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
6749 CResult_NoneMonitorUpdateErrorZ {
6750 contents: CResult_NoneMonitorUpdateErrorZPtr {
6751 err: Box::into_raw(Box::new(e)),
6757 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
6758 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
6759 impl Drop for CResult_NoneMonitorUpdateErrorZ {
6760 fn drop(&mut self) {
6763 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6764 let _ = unsafe { Box::from_raw(self.contents.err) };
6769 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
6770 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
6771 let contents = if o.result_ok {
6772 let _ = unsafe { Box::from_raw(o.contents.result) };
6773 o.contents.result = std::ptr::null_mut();
6774 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
6776 let err = unsafe { o.contents.err };
6777 unsafe { o.contents.err = std::ptr::null_mut(); }
6778 CResult_NoneMonitorUpdateErrorZPtr { err }
6782 result_ok: o.result_ok,
6786 impl Clone for CResult_NoneMonitorUpdateErrorZ {
6787 fn clone(&self) -> Self {
6789 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
6790 result: std::ptr::null_mut()
6793 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
6794 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
6800 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
6801 /// but with all dynamically-allocated buffers duplicated in new buffers.
6802 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
6804 /// A tuple of 2 elements. See the individual fields for the types contained.
6805 pub struct C2Tuple_OutPointScriptZ {
6806 /// The element at position 0
6807 pub a: crate::lightning::chain::transaction::OutPoint,
6808 /// The element at position 1
6809 pub b: crate::c_types::derived::CVec_u8Z,
6811 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
6812 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
6819 impl C2Tuple_OutPointScriptZ {
6820 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
6824 impl Clone for C2Tuple_OutPointScriptZ {
6825 fn clone(&self) -> Self {
6827 a: Clone::clone(&self.a),
6828 b: Clone::clone(&self.b),
6833 /// Creates a new tuple which has the same data as `orig`
6834 /// but with all dynamically-allocated buffers duplicated in new buffers.
6835 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
6836 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
6838 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
6839 C2Tuple_OutPointScriptZ { a, b, }
6843 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
6844 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
6846 /// A tuple of 2 elements. See the individual fields for the types contained.
6847 pub struct C2Tuple_u32ScriptZ {
6848 /// The element at position 0
6850 /// The element at position 1
6851 pub b: crate::c_types::derived::CVec_u8Z,
6853 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
6854 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
6861 impl C2Tuple_u32ScriptZ {
6862 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
6866 impl Clone for C2Tuple_u32ScriptZ {
6867 fn clone(&self) -> Self {
6869 a: Clone::clone(&self.a),
6870 b: Clone::clone(&self.b),
6875 /// Creates a new tuple which has the same data as `orig`
6876 /// but with all dynamically-allocated buffers duplicated in new buffers.
6877 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
6878 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6880 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6881 C2Tuple_u32ScriptZ { a, b, }
6885 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6886 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6888 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6889 /// This corresponds to std::vector in C++
6890 pub struct CVec_C2Tuple_u32ScriptZZ {
6891 /// The elements in the array.
6892 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6893 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6894 /// The number of elements pointed to by `data`.
6897 impl CVec_C2Tuple_u32ScriptZZ {
6898 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6899 if self.datalen == 0 { return Vec::new(); }
6900 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6901 self.data = std::ptr::null_mut();
6905 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6906 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6909 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6910 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6911 let datalen = v.len();
6912 let data = Box::into_raw(v.into_boxed_slice());
6913 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6917 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6918 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6919 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6920 fn drop(&mut self) {
6921 if self.datalen == 0 { return; }
6922 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6925 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6926 fn clone(&self) -> Self {
6927 let mut res = Vec::new();
6928 if self.datalen == 0 { return Self::from(res); }
6929 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6934 /// A tuple of 2 elements. See the individual fields for the types contained.
6935 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6936 /// The element at position 0
6937 pub a: crate::c_types::ThirtyTwoBytes,
6938 /// The element at position 1
6939 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6941 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6942 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6949 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6950 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6954 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6955 fn clone(&self) -> Self {
6957 a: Clone::clone(&self.a),
6958 b: Clone::clone(&self.b),
6963 /// Creates a new tuple which has the same data as `orig`
6964 /// but with all dynamically-allocated buffers duplicated in new buffers.
6965 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
6966 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6968 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 {
6969 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6973 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6974 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6976 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6977 /// This corresponds to std::vector in C++
6978 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6979 /// The elements in the array.
6980 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6981 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6982 /// The number of elements pointed to by `data`.
6985 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6986 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6987 if self.datalen == 0 { return Vec::new(); }
6988 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6989 self.data = std::ptr::null_mut();
6993 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6994 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6997 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6998 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6999 let datalen = v.len();
7000 let data = Box::into_raw(v.into_boxed_slice());
7001 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7005 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7006 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
7007 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7008 fn drop(&mut self) {
7009 if self.datalen == 0 { return; }
7010 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7013 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7014 fn clone(&self) -> Self {
7015 let mut res = Vec::new();
7016 if self.datalen == 0 { return Self::from(res); }
7017 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7022 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7023 /// This corresponds to std::vector in C++
7024 pub struct CVec_EventZ {
7025 /// The elements in the array.
7026 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7027 pub data: *mut crate::lightning::util::events::Event,
7028 /// The number of elements pointed to by `data`.
7032 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
7033 if self.datalen == 0 { return Vec::new(); }
7034 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7035 self.data = std::ptr::null_mut();
7039 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
7040 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7043 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
7044 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
7045 let datalen = v.len();
7046 let data = Box::into_raw(v.into_boxed_slice());
7047 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7051 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7052 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
7053 impl Drop for CVec_EventZ {
7054 fn drop(&mut self) {
7055 if self.datalen == 0 { return; }
7056 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7059 impl Clone for CVec_EventZ {
7060 fn clone(&self) -> Self {
7061 let mut res = Vec::new();
7062 if self.datalen == 0 { return Self::from(res); }
7063 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7068 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7069 /// This corresponds to std::vector in C++
7070 pub struct CVec_TransactionZ {
7071 /// The elements in the array.
7072 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7073 pub data: *mut crate::c_types::Transaction,
7074 /// The number of elements pointed to by `data`.
7077 impl CVec_TransactionZ {
7078 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
7079 if self.datalen == 0 { return Vec::new(); }
7080 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7081 self.data = std::ptr::null_mut();
7085 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
7086 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7089 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
7090 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
7091 let datalen = v.len();
7092 let data = Box::into_raw(v.into_boxed_slice());
7093 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7097 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7098 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
7099 impl Drop for CVec_TransactionZ {
7100 fn drop(&mut self) {
7101 if self.datalen == 0 { return; }
7102 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7105 impl Clone for CVec_TransactionZ {
7106 fn clone(&self) -> Self {
7107 let mut res = Vec::new();
7108 if self.datalen == 0 { return Self::from(res); }
7109 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7114 /// A tuple of 2 elements. See the individual fields for the types contained.
7115 pub struct C2Tuple_u32TxOutZ {
7116 /// The element at position 0
7118 /// The element at position 1
7119 pub b: crate::c_types::TxOut,
7121 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
7122 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
7129 impl C2Tuple_u32TxOutZ {
7130 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
7134 impl Clone for C2Tuple_u32TxOutZ {
7135 fn clone(&self) -> Self {
7137 a: Clone::clone(&self.a),
7138 b: Clone::clone(&self.b),
7143 /// Creates a new tuple which has the same data as `orig`
7144 /// but with all dynamically-allocated buffers duplicated in new buffers.
7145 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
7146 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
7148 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
7149 C2Tuple_u32TxOutZ { a, b, }
7153 /// Frees any resources used by the C2Tuple_u32TxOutZ.
7154 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
7156 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7157 /// This corresponds to std::vector in C++
7158 pub struct CVec_C2Tuple_u32TxOutZZ {
7159 /// The elements in the array.
7160 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7161 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
7162 /// The number of elements pointed to by `data`.
7165 impl CVec_C2Tuple_u32TxOutZZ {
7166 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
7167 if self.datalen == 0 { return Vec::new(); }
7168 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7169 self.data = std::ptr::null_mut();
7173 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
7174 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7177 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
7178 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
7179 let datalen = v.len();
7180 let data = Box::into_raw(v.into_boxed_slice());
7181 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7185 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7186 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
7187 impl Drop for CVec_C2Tuple_u32TxOutZZ {
7188 fn drop(&mut self) {
7189 if self.datalen == 0 { return; }
7190 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7193 impl Clone for CVec_C2Tuple_u32TxOutZZ {
7194 fn clone(&self) -> Self {
7195 let mut res = Vec::new();
7196 if self.datalen == 0 { return Self::from(res); }
7197 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7202 /// A tuple of 2 elements. See the individual fields for the types contained.
7203 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7204 /// The element at position 0
7205 pub a: crate::c_types::ThirtyTwoBytes,
7206 /// The element at position 1
7207 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
7209 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7210 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
7217 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7218 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
7222 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7223 fn clone(&self) -> Self {
7225 a: Clone::clone(&self.a),
7226 b: Clone::clone(&self.b),
7231 /// Creates a new tuple which has the same data as `orig`
7232 /// but with all dynamically-allocated buffers duplicated in new buffers.
7233 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
7234 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
7236 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 {
7237 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
7241 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
7242 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
7244 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7245 /// This corresponds to std::vector in C++
7246 pub struct CVec_TransactionOutputsZ {
7247 /// The elements in the array.
7248 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7249 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
7250 /// The number of elements pointed to by `data`.
7253 impl CVec_TransactionOutputsZ {
7254 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
7255 if self.datalen == 0 { return Vec::new(); }
7256 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7257 self.data = std::ptr::null_mut();
7261 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
7262 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7265 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
7266 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
7267 let datalen = v.len();
7268 let data = Box::into_raw(v.into_boxed_slice());
7269 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7273 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7274 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
7275 impl Drop for CVec_TransactionOutputsZ {
7276 fn drop(&mut self) {
7277 if self.datalen == 0 { return; }
7278 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7281 impl Clone for CVec_TransactionOutputsZ {
7282 fn clone(&self) -> Self {
7283 let mut res = Vec::new();
7284 if self.datalen == 0 { return Self::from(res); }
7285 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7290 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7291 /// This corresponds to std::vector in C++
7292 pub struct CVec_BalanceZ {
7293 /// The elements in the array.
7294 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7295 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
7296 /// The number of elements pointed to by `data`.
7299 impl CVec_BalanceZ {
7300 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
7301 if self.datalen == 0 { return Vec::new(); }
7302 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7303 self.data = std::ptr::null_mut();
7307 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
7308 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7311 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
7312 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
7313 let datalen = v.len();
7314 let data = Box::into_raw(v.into_boxed_slice());
7315 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7319 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7320 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
7321 impl Drop for CVec_BalanceZ {
7322 fn drop(&mut self) {
7323 if self.datalen == 0 { return; }
7324 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7327 impl Clone for CVec_BalanceZ {
7328 fn clone(&self) -> Self {
7329 let mut res = Vec::new();
7330 if self.datalen == 0 { return Self::from(res); }
7331 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7336 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7337 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7338 /// A pointer to the contents in the success state.
7339 /// Reading from this pointer when `result_ok` is not set is undefined.
7340 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7341 /// A pointer to the contents in the error state.
7342 /// Reading from this pointer when `result_ok` is set is undefined.
7343 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7346 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7347 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7348 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7349 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7350 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7351 /// `err` or `result` depending on the state of `result_ok`.
7352 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
7353 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7354 pub result_ok: bool,
7357 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
7358 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7359 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7360 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7361 result: Box::into_raw(Box::new(o)),
7367 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
7368 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7369 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7370 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7371 err: Box::into_raw(Box::new(e)),
7377 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
7378 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
7379 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7380 fn drop(&mut self) {
7382 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7383 let _ = unsafe { Box::from_raw(self.contents.result) };
7386 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7387 let _ = unsafe { Box::from_raw(self.contents.err) };
7392 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7393 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7394 let contents = if o.result_ok {
7395 let result = unsafe { o.contents.result };
7396 unsafe { o.contents.result = std::ptr::null_mut() };
7397 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
7399 let err = unsafe { o.contents.err };
7400 unsafe { o.contents.err = std::ptr::null_mut(); }
7401 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
7405 result_ok: o.result_ok,
7410 /// The contents of CResult_NoneLightningErrorZ
7411 pub union CResult_NoneLightningErrorZPtr {
7412 /// Note that this value is always NULL, as there are no contents in the OK variant
7413 pub result: *mut std::ffi::c_void,
7414 /// A pointer to the contents in the error state.
7415 /// Reading from this pointer when `result_ok` is set is undefined.
7416 pub err: *mut crate::lightning::ln::msgs::LightningError,
7419 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7420 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7422 pub struct CResult_NoneLightningErrorZ {
7423 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7424 /// `err` or `result` depending on the state of `result_ok`.
7425 pub contents: CResult_NoneLightningErrorZPtr,
7426 /// Whether this CResult_NoneLightningErrorZ represents a success state.
7427 pub result_ok: bool,
7430 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7431 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7432 CResult_NoneLightningErrorZ {
7433 contents: CResult_NoneLightningErrorZPtr {
7434 result: std::ptr::null_mut(),
7440 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7441 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7442 CResult_NoneLightningErrorZ {
7443 contents: CResult_NoneLightningErrorZPtr {
7444 err: Box::into_raw(Box::new(e)),
7450 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7451 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7452 impl Drop for CResult_NoneLightningErrorZ {
7453 fn drop(&mut self) {
7456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7457 let _ = unsafe { Box::from_raw(self.contents.err) };
7462 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7463 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7464 let contents = if o.result_ok {
7465 let _ = unsafe { Box::from_raw(o.contents.result) };
7466 o.contents.result = std::ptr::null_mut();
7467 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
7469 let err = unsafe { o.contents.err };
7470 unsafe { o.contents.err = std::ptr::null_mut(); }
7471 CResult_NoneLightningErrorZPtr { err }
7475 result_ok: o.result_ok,
7479 impl Clone for CResult_NoneLightningErrorZ {
7480 fn clone(&self) -> Self {
7482 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7483 result: std::ptr::null_mut()
7486 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7487 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7493 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7494 /// but with all dynamically-allocated buffers duplicated in new buffers.
7495 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7497 /// A tuple of 2 elements. See the individual fields for the types contained.
7498 pub struct C2Tuple_PublicKeyTypeZ {
7499 /// The element at position 0
7500 pub a: crate::c_types::PublicKey,
7501 /// The element at position 1
7502 pub b: crate::lightning::ln::wire::Type,
7504 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
7505 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
7512 impl C2Tuple_PublicKeyTypeZ {
7513 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
7517 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
7519 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
7520 C2Tuple_PublicKeyTypeZ { a, b, }
7524 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
7525 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
7527 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7528 /// This corresponds to std::vector in C++
7529 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
7530 /// The elements in the array.
7531 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7532 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
7533 /// The number of elements pointed to by `data`.
7536 impl CVec_C2Tuple_PublicKeyTypeZZ {
7537 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
7538 if self.datalen == 0 { return Vec::new(); }
7539 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7540 self.data = std::ptr::null_mut();
7544 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
7545 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7548 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
7549 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
7550 let datalen = v.len();
7551 let data = Box::into_raw(v.into_boxed_slice());
7552 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7556 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7557 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
7558 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
7559 fn drop(&mut self) {
7560 if self.datalen == 0 { return; }
7561 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7565 /// The contents of CResult_boolLightningErrorZ
7566 pub union CResult_boolLightningErrorZPtr {
7567 /// A pointer to the contents in the success state.
7568 /// Reading from this pointer when `result_ok` is not set is undefined.
7569 pub result: *mut bool,
7570 /// A pointer to the contents in the error state.
7571 /// Reading from this pointer when `result_ok` is set is undefined.
7572 pub err: *mut crate::lightning::ln::msgs::LightningError,
7575 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7576 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7578 pub struct CResult_boolLightningErrorZ {
7579 /// The contents of this CResult_boolLightningErrorZ, accessible via either
7580 /// `err` or `result` depending on the state of `result_ok`.
7581 pub contents: CResult_boolLightningErrorZPtr,
7582 /// Whether this CResult_boolLightningErrorZ represents a success state.
7583 pub result_ok: bool,
7586 /// Creates a new CResult_boolLightningErrorZ in the success state.
7587 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7588 CResult_boolLightningErrorZ {
7589 contents: CResult_boolLightningErrorZPtr {
7590 result: Box::into_raw(Box::new(o)),
7596 /// Creates a new CResult_boolLightningErrorZ in the error state.
7597 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
7598 CResult_boolLightningErrorZ {
7599 contents: CResult_boolLightningErrorZPtr {
7600 err: Box::into_raw(Box::new(e)),
7606 /// Frees any resources used by the CResult_boolLightningErrorZ.
7607 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
7608 impl Drop for CResult_boolLightningErrorZ {
7609 fn drop(&mut self) {
7611 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7612 let _ = unsafe { Box::from_raw(self.contents.result) };
7615 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7616 let _ = unsafe { Box::from_raw(self.contents.err) };
7621 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
7622 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
7623 let contents = if o.result_ok {
7624 let result = unsafe { o.contents.result };
7625 unsafe { o.contents.result = std::ptr::null_mut() };
7626 CResult_boolLightningErrorZPtr { result }
7628 let err = unsafe { o.contents.err };
7629 unsafe { o.contents.err = std::ptr::null_mut(); }
7630 CResult_boolLightningErrorZPtr { err }
7634 result_ok: o.result_ok,
7638 impl Clone for CResult_boolLightningErrorZ {
7639 fn clone(&self) -> Self {
7641 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
7642 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7645 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
7646 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7652 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7653 /// but with all dynamically-allocated buffers duplicated in new buffers.
7654 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
7656 /// A tuple of 3 elements. See the individual fields for the types contained.
7657 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7658 /// The element at position 0
7659 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
7660 /// The element at position 1
7661 pub b: crate::lightning::ln::msgs::ChannelUpdate,
7662 /// The element at position 2
7663 pub c: crate::lightning::ln::msgs::ChannelUpdate,
7665 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7666 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
7674 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7675 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
7676 (self.a, self.b, self.c)
7679 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7680 fn clone(&self) -> Self {
7682 a: Clone::clone(&self.a),
7683 b: Clone::clone(&self.b),
7684 c: Clone::clone(&self.c),
7689 /// Creates a new tuple which has the same data as `orig`
7690 /// but with all dynamically-allocated buffers duplicated in new buffers.
7691 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
7692 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7694 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 {
7695 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
7699 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7700 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
7702 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
7703 /// This corresponds to std::vector in C++
7704 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7705 /// The elements in the array.
7706 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7707 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
7708 /// The number of elements pointed to by `data`.
7711 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7712 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
7713 if self.datalen == 0 { return Vec::new(); }
7714 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7715 self.data = std::ptr::null_mut();
7719 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
7720 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7723 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7724 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
7725 let datalen = v.len();
7726 let data = Box::into_raw(v.into_boxed_slice());
7727 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7731 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7732 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
7733 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7734 fn drop(&mut self) {
7735 if self.datalen == 0 { return; }
7736 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7739 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7740 fn clone(&self) -> Self {
7741 let mut res = Vec::new();
7742 if self.datalen == 0 { return Self::from(res); }
7743 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7748 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
7749 /// This corresponds to std::vector in C++
7750 pub struct CVec_NodeAnnouncementZ {
7751 /// The elements in the array.
7752 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7753 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
7754 /// The number of elements pointed to by `data`.
7757 impl CVec_NodeAnnouncementZ {
7758 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
7759 if self.datalen == 0 { return Vec::new(); }
7760 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7761 self.data = std::ptr::null_mut();
7765 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
7766 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7769 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
7770 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
7771 let datalen = v.len();
7772 let data = Box::into_raw(v.into_boxed_slice());
7773 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7777 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7778 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
7779 impl Drop for CVec_NodeAnnouncementZ {
7780 fn drop(&mut self) {
7781 if self.datalen == 0 { return; }
7782 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7785 impl Clone for CVec_NodeAnnouncementZ {
7786 fn clone(&self) -> Self {
7787 let mut res = Vec::new();
7788 if self.datalen == 0 { return Self::from(res); }
7789 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7794 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7795 /// This corresponds to std::vector in C++
7796 pub struct CVec_PublicKeyZ {
7797 /// The elements in the array.
7798 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7799 pub data: *mut crate::c_types::PublicKey,
7800 /// The number of elements pointed to by `data`.
7803 impl CVec_PublicKeyZ {
7804 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
7805 if self.datalen == 0 { return Vec::new(); }
7806 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7807 self.data = std::ptr::null_mut();
7811 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
7812 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7815 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
7816 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
7817 let datalen = v.len();
7818 let data = Box::into_raw(v.into_boxed_slice());
7819 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7823 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7824 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
7825 impl Drop for CVec_PublicKeyZ {
7826 fn drop(&mut self) {
7827 if self.datalen == 0 { return; }
7828 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7831 impl Clone for CVec_PublicKeyZ {
7832 fn clone(&self) -> Self {
7833 let mut res = Vec::new();
7834 if self.datalen == 0 { return Self::from(res); }
7835 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7840 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
7841 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
7842 /// A pointer to the contents in the success state.
7843 /// Reading from this pointer when `result_ok` is not set is undefined.
7844 pub result: *mut crate::c_types::derived::CVec_u8Z,
7845 /// A pointer to the contents in the error state.
7846 /// Reading from this pointer when `result_ok` is set is undefined.
7847 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7850 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7851 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7853 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
7854 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7855 /// `err` or `result` depending on the state of `result_ok`.
7856 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
7857 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7858 pub result_ok: bool,
7861 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
7862 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
7863 CResult_CVec_u8ZPeerHandleErrorZ {
7864 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7865 result: Box::into_raw(Box::new(o)),
7871 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
7872 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
7873 CResult_CVec_u8ZPeerHandleErrorZ {
7874 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7875 err: Box::into_raw(Box::new(e)),
7881 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
7882 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
7883 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
7884 fn drop(&mut self) {
7886 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7887 let _ = unsafe { Box::from_raw(self.contents.result) };
7890 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7891 let _ = unsafe { Box::from_raw(self.contents.err) };
7896 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
7897 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7898 let contents = if o.result_ok {
7899 let result = unsafe { o.contents.result };
7900 unsafe { o.contents.result = std::ptr::null_mut() };
7901 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
7903 let err = unsafe { o.contents.err };
7904 unsafe { o.contents.err = std::ptr::null_mut(); }
7905 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
7909 result_ok: o.result_ok,
7913 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
7914 fn clone(&self) -> Self {
7916 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7917 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
7920 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7921 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7927 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
7928 /// but with all dynamically-allocated buffers duplicated in new buffers.
7929 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
7931 /// The contents of CResult_NonePeerHandleErrorZ
7932 pub union CResult_NonePeerHandleErrorZPtr {
7933 /// Note that this value is always NULL, as there are no contents in the OK variant
7934 pub result: *mut std::ffi::c_void,
7935 /// A pointer to the contents in the error state.
7936 /// Reading from this pointer when `result_ok` is set is undefined.
7937 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7940 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7941 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7942 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7943 pub struct CResult_NonePeerHandleErrorZ {
7944 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7945 /// `err` or `result` depending on the state of `result_ok`.
7946 pub contents: CResult_NonePeerHandleErrorZPtr,
7947 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
7948 pub result_ok: bool,
7951 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
7952 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
7953 CResult_NonePeerHandleErrorZ {
7954 contents: CResult_NonePeerHandleErrorZPtr {
7955 result: std::ptr::null_mut(),
7961 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
7962 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
7963 CResult_NonePeerHandleErrorZ {
7964 contents: CResult_NonePeerHandleErrorZPtr {
7965 err: Box::into_raw(Box::new(e)),
7971 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
7972 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
7973 impl Drop for CResult_NonePeerHandleErrorZ {
7974 fn drop(&mut self) {
7977 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7978 let _ = unsafe { Box::from_raw(self.contents.err) };
7983 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
7984 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7985 let contents = if o.result_ok {
7986 let _ = unsafe { Box::from_raw(o.contents.result) };
7987 o.contents.result = std::ptr::null_mut();
7988 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
7990 let err = unsafe { o.contents.err };
7991 unsafe { o.contents.err = std::ptr::null_mut(); }
7992 CResult_NonePeerHandleErrorZPtr { err }
7996 result_ok: o.result_ok,
8000 impl Clone for CResult_NonePeerHandleErrorZ {
8001 fn clone(&self) -> Self {
8003 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
8004 result: std::ptr::null_mut()
8007 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
8008 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8014 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8015 /// but with all dynamically-allocated buffers duplicated in new buffers.
8016 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
8018 /// The contents of CResult_boolPeerHandleErrorZ
8019 pub union CResult_boolPeerHandleErrorZPtr {
8020 /// A pointer to the contents in the success state.
8021 /// Reading from this pointer when `result_ok` is not set is undefined.
8022 pub result: *mut bool,
8023 /// A pointer to the contents in the error state.
8024 /// Reading from this pointer when `result_ok` is set is undefined.
8025 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8028 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8029 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8031 pub struct CResult_boolPeerHandleErrorZ {
8032 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8033 /// `err` or `result` depending on the state of `result_ok`.
8034 pub contents: CResult_boolPeerHandleErrorZPtr,
8035 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
8036 pub result_ok: bool,
8039 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
8040 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
8041 CResult_boolPeerHandleErrorZ {
8042 contents: CResult_boolPeerHandleErrorZPtr {
8043 result: Box::into_raw(Box::new(o)),
8049 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
8050 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
8051 CResult_boolPeerHandleErrorZ {
8052 contents: CResult_boolPeerHandleErrorZPtr {
8053 err: Box::into_raw(Box::new(e)),
8059 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
8060 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
8061 impl Drop for CResult_boolPeerHandleErrorZ {
8062 fn drop(&mut self) {
8064 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8065 let _ = unsafe { Box::from_raw(self.contents.result) };
8068 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8069 let _ = unsafe { Box::from_raw(self.contents.err) };
8074 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
8075 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8076 let contents = if o.result_ok {
8077 let result = unsafe { o.contents.result };
8078 unsafe { o.contents.result = std::ptr::null_mut() };
8079 CResult_boolPeerHandleErrorZPtr { result }
8081 let err = unsafe { o.contents.err };
8082 unsafe { o.contents.err = std::ptr::null_mut(); }
8083 CResult_boolPeerHandleErrorZPtr { err }
8087 result_ok: o.result_ok,
8091 impl Clone for CResult_boolPeerHandleErrorZ {
8092 fn clone(&self) -> Self {
8094 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
8095 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8098 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
8099 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8105 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8106 /// but with all dynamically-allocated buffers duplicated in new buffers.
8107 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
8109 /// The contents of CResult_NodeIdDecodeErrorZ
8110 pub union CResult_NodeIdDecodeErrorZPtr {
8111 /// A pointer to the contents in the success state.
8112 /// Reading from this pointer when `result_ok` is not set is undefined.
8113 pub result: *mut crate::lightning::routing::network_graph::NodeId,
8114 /// A pointer to the contents in the error state.
8115 /// Reading from this pointer when `result_ok` is set is undefined.
8116 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8119 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8120 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8122 pub struct CResult_NodeIdDecodeErrorZ {
8123 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8124 /// `err` or `result` depending on the state of `result_ok`.
8125 pub contents: CResult_NodeIdDecodeErrorZPtr,
8126 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8127 pub result_ok: bool,
8130 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
8131 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
8132 CResult_NodeIdDecodeErrorZ {
8133 contents: CResult_NodeIdDecodeErrorZPtr {
8134 result: Box::into_raw(Box::new(o)),
8140 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
8141 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
8142 CResult_NodeIdDecodeErrorZ {
8143 contents: CResult_NodeIdDecodeErrorZPtr {
8144 err: Box::into_raw(Box::new(e)),
8150 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
8151 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
8152 impl Drop for CResult_NodeIdDecodeErrorZ {
8153 fn drop(&mut self) {
8155 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8156 let _ = unsafe { Box::from_raw(self.contents.result) };
8159 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8160 let _ = unsafe { Box::from_raw(self.contents.err) };
8165 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
8166 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
8167 let contents = if o.result_ok {
8168 let result = unsafe { o.contents.result };
8169 unsafe { o.contents.result = std::ptr::null_mut() };
8170 CResult_NodeIdDecodeErrorZPtr { result }
8172 let err = unsafe { o.contents.err };
8173 unsafe { o.contents.err = std::ptr::null_mut(); }
8174 CResult_NodeIdDecodeErrorZPtr { err }
8178 result_ok: o.result_ok,
8182 impl Clone for CResult_NodeIdDecodeErrorZ {
8183 fn clone(&self) -> Self {
8185 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
8186 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
8189 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
8190 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8196 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
8197 /// but with all dynamically-allocated buffers duplicated in new buffers.
8198 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
8200 /// An enum which can either contain a crate::lightning::chain::Access or not
8201 pub enum COption_AccessZ {
8202 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8203 Some(crate::lightning::chain::Access),
8204 /// When we're in this state, this COption_AccessZ contains nothing
8207 impl COption_AccessZ {
8208 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8209 if let Self::Some(_) = self { true } else { false }
8211 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8214 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
8215 if let Self::Some(v) = self { v } else { unreachable!() }
8219 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
8220 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
8221 COption_AccessZ::Some(o)
8224 /// Constructs a new COption_AccessZ containing nothing
8225 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
8226 COption_AccessZ::None
8229 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
8230 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
8232 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
8233 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
8234 /// A pointer to the contents in the success state.
8235 /// Reading from this pointer when `result_ok` is not set is undefined.
8236 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
8237 /// A pointer to the contents in the error state.
8238 /// Reading from this pointer when `result_ok` is set is undefined.
8239 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8242 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
8243 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8244 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8245 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
8246 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
8247 /// `err` or `result` depending on the state of `result_ok`.
8248 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
8249 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
8250 pub result_ok: bool,
8253 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8254 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8255 CResult_DirectionalChannelInfoDecodeErrorZ {
8256 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8257 result: Box::into_raw(Box::new(o)),
8263 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8264 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8265 CResult_DirectionalChannelInfoDecodeErrorZ {
8266 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8267 err: Box::into_raw(Box::new(e)),
8273 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8274 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
8275 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
8276 fn drop(&mut self) {
8278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8279 let _ = unsafe { Box::from_raw(self.contents.result) };
8282 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8283 let _ = unsafe { Box::from_raw(self.contents.err) };
8288 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
8289 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8290 let contents = if o.result_ok {
8291 let result = unsafe { o.contents.result };
8292 unsafe { o.contents.result = std::ptr::null_mut() };
8293 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
8295 let err = unsafe { o.contents.err };
8296 unsafe { o.contents.err = std::ptr::null_mut(); }
8297 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
8301 result_ok: o.result_ok,
8305 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
8306 fn clone(&self) -> Self {
8308 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8309 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
8312 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8313 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8319 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8320 /// but with all dynamically-allocated buffers duplicated in new buffers.
8321 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8323 /// The contents of CResult_ChannelInfoDecodeErrorZ
8324 pub union CResult_ChannelInfoDecodeErrorZPtr {
8325 /// A pointer to the contents in the success state.
8326 /// Reading from this pointer when `result_ok` is not set is undefined.
8327 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
8328 /// A pointer to the contents in the error state.
8329 /// Reading from this pointer when `result_ok` is set is undefined.
8330 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8333 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8334 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8336 pub struct CResult_ChannelInfoDecodeErrorZ {
8337 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8338 /// `err` or `result` depending on the state of `result_ok`.
8339 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8340 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8341 pub result_ok: bool,
8344 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8345 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8346 CResult_ChannelInfoDecodeErrorZ {
8347 contents: CResult_ChannelInfoDecodeErrorZPtr {
8348 result: Box::into_raw(Box::new(o)),
8354 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8355 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8356 CResult_ChannelInfoDecodeErrorZ {
8357 contents: CResult_ChannelInfoDecodeErrorZPtr {
8358 err: Box::into_raw(Box::new(e)),
8364 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8365 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8366 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8367 fn drop(&mut self) {
8369 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8370 let _ = unsafe { Box::from_raw(self.contents.result) };
8373 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8374 let _ = unsafe { Box::from_raw(self.contents.err) };
8379 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8380 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8381 let contents = if o.result_ok {
8382 let result = unsafe { o.contents.result };
8383 unsafe { o.contents.result = std::ptr::null_mut() };
8384 CResult_ChannelInfoDecodeErrorZPtr { result }
8386 let err = unsafe { o.contents.err };
8387 unsafe { o.contents.err = std::ptr::null_mut(); }
8388 CResult_ChannelInfoDecodeErrorZPtr { err }
8392 result_ok: o.result_ok,
8396 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8397 fn clone(&self) -> Self {
8399 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8400 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8403 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8404 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8410 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8411 /// but with all dynamically-allocated buffers duplicated in new buffers.
8412 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8414 /// The contents of CResult_RoutingFeesDecodeErrorZ
8415 pub union CResult_RoutingFeesDecodeErrorZPtr {
8416 /// A pointer to the contents in the success state.
8417 /// Reading from this pointer when `result_ok` is not set is undefined.
8418 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
8419 /// A pointer to the contents in the error state.
8420 /// Reading from this pointer when `result_ok` is set is undefined.
8421 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8424 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8425 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8427 pub struct CResult_RoutingFeesDecodeErrorZ {
8428 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8429 /// `err` or `result` depending on the state of `result_ok`.
8430 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8431 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8432 pub result_ok: bool,
8435 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8436 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8437 CResult_RoutingFeesDecodeErrorZ {
8438 contents: CResult_RoutingFeesDecodeErrorZPtr {
8439 result: Box::into_raw(Box::new(o)),
8445 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8446 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8447 CResult_RoutingFeesDecodeErrorZ {
8448 contents: CResult_RoutingFeesDecodeErrorZPtr {
8449 err: Box::into_raw(Box::new(e)),
8455 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8456 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8457 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8458 fn drop(&mut self) {
8460 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8461 let _ = unsafe { Box::from_raw(self.contents.result) };
8464 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8465 let _ = unsafe { Box::from_raw(self.contents.err) };
8470 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8471 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8472 let contents = if o.result_ok {
8473 let result = unsafe { o.contents.result };
8474 unsafe { o.contents.result = std::ptr::null_mut() };
8475 CResult_RoutingFeesDecodeErrorZPtr { result }
8477 let err = unsafe { o.contents.err };
8478 unsafe { o.contents.err = std::ptr::null_mut(); }
8479 CResult_RoutingFeesDecodeErrorZPtr { err }
8483 result_ok: o.result_ok,
8487 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8488 fn clone(&self) -> Self {
8490 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8491 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
8494 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8495 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8501 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8502 /// but with all dynamically-allocated buffers duplicated in new buffers.
8503 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8505 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8506 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8507 /// A pointer to the contents in the success state.
8508 /// Reading from this pointer when `result_ok` is not set is undefined.
8509 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
8510 /// A pointer to the contents in the error state.
8511 /// Reading from this pointer when `result_ok` is set is undefined.
8512 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8515 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8516 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8518 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8519 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8520 /// `err` or `result` depending on the state of `result_ok`.
8521 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8522 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8523 pub result_ok: bool,
8526 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8527 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8528 CResult_NodeAnnouncementInfoDecodeErrorZ {
8529 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8530 result: Box::into_raw(Box::new(o)),
8536 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8537 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8538 CResult_NodeAnnouncementInfoDecodeErrorZ {
8539 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8540 err: Box::into_raw(Box::new(e)),
8546 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8547 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8548 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8549 fn drop(&mut self) {
8551 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8552 let _ = unsafe { Box::from_raw(self.contents.result) };
8555 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8556 let _ = unsafe { Box::from_raw(self.contents.err) };
8561 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8562 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8563 let contents = if o.result_ok {
8564 let result = unsafe { o.contents.result };
8565 unsafe { o.contents.result = std::ptr::null_mut() };
8566 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8568 let err = unsafe { o.contents.err };
8569 unsafe { o.contents.err = std::ptr::null_mut(); }
8570 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8574 result_ok: o.result_ok,
8578 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8579 fn clone(&self) -> Self {
8581 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8582 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8585 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8586 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8592 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8593 /// but with all dynamically-allocated buffers duplicated in new buffers.
8594 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
8596 /// A dynamically-allocated array of u64s of arbitrary size.
8597 /// This corresponds to std::vector in C++
8598 pub struct CVec_u64Z {
8599 /// The elements in the array.
8600 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8602 /// The number of elements pointed to by `data`.
8606 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
8607 if self.datalen == 0 { return Vec::new(); }
8608 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8609 self.data = std::ptr::null_mut();
8613 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
8614 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8617 impl From<Vec<u64>> for CVec_u64Z {
8618 fn from(v: Vec<u64>) -> Self {
8619 let datalen = v.len();
8620 let data = Box::into_raw(v.into_boxed_slice());
8621 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8625 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8626 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
8627 impl Drop for CVec_u64Z {
8628 fn drop(&mut self) {
8629 if self.datalen == 0 { return; }
8630 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8633 impl Clone for CVec_u64Z {
8634 fn clone(&self) -> Self {
8635 let mut res = Vec::new();
8636 if self.datalen == 0 { return Self::from(res); }
8637 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8642 /// The contents of CResult_NodeInfoDecodeErrorZ
8643 pub union CResult_NodeInfoDecodeErrorZPtr {
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::NodeInfo,
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_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8653 /// containing a crate::lightning::routing::network_graph::NodeInfo 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_NodeInfoDecodeErrorZ {
8656 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8657 /// `err` or `result` depending on the state of `result_ok`.
8658 pub contents: CResult_NodeInfoDecodeErrorZPtr,
8659 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8660 pub result_ok: bool,
8663 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8664 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
8665 CResult_NodeInfoDecodeErrorZ {
8666 contents: CResult_NodeInfoDecodeErrorZPtr {
8667 result: Box::into_raw(Box::new(o)),
8673 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8674 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
8675 CResult_NodeInfoDecodeErrorZ {
8676 contents: CResult_NodeInfoDecodeErrorZPtr {
8677 err: Box::into_raw(Box::new(e)),
8683 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8684 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
8685 impl Drop for CResult_NodeInfoDecodeErrorZ {
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::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
8699 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, 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_NodeInfoDecodeErrorZPtr { result }
8705 let err = unsafe { o.contents.err };
8706 unsafe { o.contents.err = std::ptr::null_mut(); }
8707 CResult_NodeInfoDecodeErrorZPtr { err }
8711 result_ok: o.result_ok,
8715 impl Clone for CResult_NodeInfoDecodeErrorZ {
8716 fn clone(&self) -> Self {
8718 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
8719 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
8722 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
8723 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8729 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8730 /// but with all dynamically-allocated buffers duplicated in new buffers.
8731 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
8733 /// The contents of CResult_NetworkGraphDecodeErrorZ
8734 pub union CResult_NetworkGraphDecodeErrorZPtr {
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::NetworkGraph,
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_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8744 /// containing a crate::lightning::routing::network_graph::NetworkGraph 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_NetworkGraphDecodeErrorZ {
8747 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8748 /// `err` or `result` depending on the state of `result_ok`.
8749 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
8750 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8751 pub result_ok: bool,
8754 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8755 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
8756 CResult_NetworkGraphDecodeErrorZ {
8757 contents: CResult_NetworkGraphDecodeErrorZPtr {
8758 result: Box::into_raw(Box::new(o)),
8764 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8765 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
8766 CResult_NetworkGraphDecodeErrorZ {
8767 contents: CResult_NetworkGraphDecodeErrorZPtr {
8768 err: Box::into_raw(Box::new(e)),
8774 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8775 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
8776 impl Drop for CResult_NetworkGraphDecodeErrorZ {
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::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
8790 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, 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_NetworkGraphDecodeErrorZPtr { result }
8796 let err = unsafe { o.contents.err };
8797 unsafe { o.contents.err = std::ptr::null_mut(); }
8798 CResult_NetworkGraphDecodeErrorZPtr { err }
8802 result_ok: o.result_ok,
8806 impl Clone for CResult_NetworkGraphDecodeErrorZ {
8807 fn clone(&self) -> Self {
8809 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
8810 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
8813 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
8814 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8820 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8821 /// but with all dynamically-allocated buffers duplicated in new buffers.
8822 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
8825 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
8826 pub enum COption_CVec_NetAddressZZ {
8827 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
8828 Some(crate::c_types::derived::CVec_NetAddressZ),
8829 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
8832 impl COption_CVec_NetAddressZZ {
8833 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8834 if let Self::Some(_) = self { true } else { false }
8836 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8839 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
8840 if let Self::Some(v) = self { v } else { unreachable!() }
8844 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
8845 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
8846 COption_CVec_NetAddressZZ::Some(o)
8849 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
8850 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
8851 COption_CVec_NetAddressZZ::None
8854 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
8855 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
8857 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
8858 /// but with all dynamically-allocated buffers duplicated in new buffers.
8859 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
8861 /// The contents of CResult_NetAddressu8Z
8862 pub union CResult_NetAddressu8ZPtr {
8863 /// A pointer to the contents in the success state.
8864 /// Reading from this pointer when `result_ok` is not set is undefined.
8865 pub result: *mut crate::lightning::ln::msgs::NetAddress,
8866 /// A pointer to the contents in the error state.
8867 /// Reading from this pointer when `result_ok` is set is undefined.
8871 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
8872 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
8873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8874 pub struct CResult_NetAddressu8Z {
8875 /// The contents of this CResult_NetAddressu8Z, accessible via either
8876 /// `err` or `result` depending on the state of `result_ok`.
8877 pub contents: CResult_NetAddressu8ZPtr,
8878 /// Whether this CResult_NetAddressu8Z represents a success state.
8879 pub result_ok: bool,
8882 /// Creates a new CResult_NetAddressu8Z in the success state.
8883 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
8884 CResult_NetAddressu8Z {
8885 contents: CResult_NetAddressu8ZPtr {
8886 result: Box::into_raw(Box::new(o)),
8892 /// Creates a new CResult_NetAddressu8Z in the error state.
8893 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
8894 CResult_NetAddressu8Z {
8895 contents: CResult_NetAddressu8ZPtr {
8896 err: Box::into_raw(Box::new(e)),
8902 /// Frees any resources used by the CResult_NetAddressu8Z.
8903 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
8904 impl Drop for CResult_NetAddressu8Z {
8905 fn drop(&mut self) {
8907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8908 let _ = unsafe { Box::from_raw(self.contents.result) };
8911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8912 let _ = unsafe { Box::from_raw(self.contents.err) };
8917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
8918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
8919 let contents = if o.result_ok {
8920 let result = unsafe { o.contents.result };
8921 unsafe { o.contents.result = std::ptr::null_mut() };
8922 CResult_NetAddressu8ZPtr { result }
8924 let err = unsafe { o.contents.err };
8925 unsafe { o.contents.err = std::ptr::null_mut(); }
8926 CResult_NetAddressu8ZPtr { err }
8930 result_ok: o.result_ok,
8934 impl Clone for CResult_NetAddressu8Z {
8935 fn clone(&self) -> Self {
8937 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
8938 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8941 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
8942 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
8948 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8949 /// but with all dynamically-allocated buffers duplicated in new buffers.
8950 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { Clone::clone(&orig) }
8952 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
8953 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8954 /// A pointer to the contents in the success state.
8955 /// Reading from this pointer when `result_ok` is not set is undefined.
8956 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
8957 /// A pointer to the contents in the error state.
8958 /// Reading from this pointer when `result_ok` is set is undefined.
8959 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8962 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
8963 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
8964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8965 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
8966 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
8967 /// `err` or `result` depending on the state of `result_ok`.
8968 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
8969 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
8970 pub result_ok: bool,
8973 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8974 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8975 CResult_CResult_NetAddressu8ZDecodeErrorZ {
8976 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8977 result: Box::into_raw(Box::new(o)),
8983 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8984 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8985 CResult_CResult_NetAddressu8ZDecodeErrorZ {
8986 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8987 err: Box::into_raw(Box::new(e)),
8993 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8994 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
8995 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8996 fn drop(&mut self) {
8998 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8999 let _ = unsafe { Box::from_raw(self.contents.result) };
9002 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9003 let _ = unsafe { Box::from_raw(self.contents.err) };
9008 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
9009 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
9010 let contents = if o.result_ok {
9011 let result = unsafe { o.contents.result };
9012 unsafe { o.contents.result = std::ptr::null_mut() };
9013 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
9015 let err = unsafe { o.contents.err };
9016 unsafe { o.contents.err = std::ptr::null_mut(); }
9017 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
9021 result_ok: o.result_ok,
9025 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
9026 fn clone(&self) -> Self {
9028 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
9029 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
9032 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
9033 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9039 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
9040 /// but with all dynamically-allocated buffers duplicated in new buffers.
9041 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { Clone::clone(&orig) }
9043 /// The contents of CResult_NetAddressDecodeErrorZ
9044 pub union CResult_NetAddressDecodeErrorZPtr {
9045 /// A pointer to the contents in the success state.
9046 /// Reading from this pointer when `result_ok` is not set is undefined.
9047 pub result: *mut crate::lightning::ln::msgs::NetAddress,
9048 /// A pointer to the contents in the error state.
9049 /// Reading from this pointer when `result_ok` is set is undefined.
9050 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9053 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9054 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9056 pub struct CResult_NetAddressDecodeErrorZ {
9057 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9058 /// `err` or `result` depending on the state of `result_ok`.
9059 pub contents: CResult_NetAddressDecodeErrorZPtr,
9060 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9061 pub result_ok: bool,
9064 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
9065 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
9066 CResult_NetAddressDecodeErrorZ {
9067 contents: CResult_NetAddressDecodeErrorZPtr {
9068 result: Box::into_raw(Box::new(o)),
9074 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
9075 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
9076 CResult_NetAddressDecodeErrorZ {
9077 contents: CResult_NetAddressDecodeErrorZPtr {
9078 err: Box::into_raw(Box::new(e)),
9084 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
9085 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
9086 impl Drop for CResult_NetAddressDecodeErrorZ {
9087 fn drop(&mut self) {
9089 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9090 let _ = unsafe { Box::from_raw(self.contents.result) };
9093 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9094 let _ = unsafe { Box::from_raw(self.contents.err) };
9099 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
9100 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
9101 let contents = if o.result_ok {
9102 let result = unsafe { o.contents.result };
9103 unsafe { o.contents.result = std::ptr::null_mut() };
9104 CResult_NetAddressDecodeErrorZPtr { result }
9106 let err = unsafe { o.contents.err };
9107 unsafe { o.contents.err = std::ptr::null_mut(); }
9108 CResult_NetAddressDecodeErrorZPtr { err }
9112 result_ok: o.result_ok,
9116 impl Clone for CResult_NetAddressDecodeErrorZ {
9117 fn clone(&self) -> Self {
9119 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
9120 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
9123 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
9124 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9130 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
9131 /// but with all dynamically-allocated buffers duplicated in new buffers.
9132 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
9134 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9135 /// This corresponds to std::vector in C++
9136 pub struct CVec_UpdateAddHTLCZ {
9137 /// The elements in the array.
9138 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9139 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9140 /// The number of elements pointed to by `data`.
9143 impl CVec_UpdateAddHTLCZ {
9144 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
9145 if self.datalen == 0 { return Vec::new(); }
9146 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9147 self.data = std::ptr::null_mut();
9151 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
9152 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9155 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
9156 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
9157 let datalen = v.len();
9158 let data = Box::into_raw(v.into_boxed_slice());
9159 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9163 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9164 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
9165 impl Drop for CVec_UpdateAddHTLCZ {
9166 fn drop(&mut self) {
9167 if self.datalen == 0 { return; }
9168 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9171 impl Clone for CVec_UpdateAddHTLCZ {
9172 fn clone(&self) -> Self {
9173 let mut res = Vec::new();
9174 if self.datalen == 0 { return Self::from(res); }
9175 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9180 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9181 /// This corresponds to std::vector in C++
9182 pub struct CVec_UpdateFulfillHTLCZ {
9183 /// The elements in the array.
9184 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9185 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9186 /// The number of elements pointed to by `data`.
9189 impl CVec_UpdateFulfillHTLCZ {
9190 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
9191 if self.datalen == 0 { return Vec::new(); }
9192 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9193 self.data = std::ptr::null_mut();
9197 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
9198 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9201 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
9202 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
9203 let datalen = v.len();
9204 let data = Box::into_raw(v.into_boxed_slice());
9205 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9209 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9210 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
9211 impl Drop for CVec_UpdateFulfillHTLCZ {
9212 fn drop(&mut self) {
9213 if self.datalen == 0 { return; }
9214 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9217 impl Clone for CVec_UpdateFulfillHTLCZ {
9218 fn clone(&self) -> Self {
9219 let mut res = Vec::new();
9220 if self.datalen == 0 { return Self::from(res); }
9221 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9226 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9227 /// This corresponds to std::vector in C++
9228 pub struct CVec_UpdateFailHTLCZ {
9229 /// The elements in the array.
9230 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9231 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9232 /// The number of elements pointed to by `data`.
9235 impl CVec_UpdateFailHTLCZ {
9236 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
9237 if self.datalen == 0 { return Vec::new(); }
9238 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9239 self.data = std::ptr::null_mut();
9243 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
9244 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9247 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
9248 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
9249 let datalen = v.len();
9250 let data = Box::into_raw(v.into_boxed_slice());
9251 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9255 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9256 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
9257 impl Drop for CVec_UpdateFailHTLCZ {
9258 fn drop(&mut self) {
9259 if self.datalen == 0 { return; }
9260 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9263 impl Clone for CVec_UpdateFailHTLCZ {
9264 fn clone(&self) -> Self {
9265 let mut res = Vec::new();
9266 if self.datalen == 0 { return Self::from(res); }
9267 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9272 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9273 /// This corresponds to std::vector in C++
9274 pub struct CVec_UpdateFailMalformedHTLCZ {
9275 /// The elements in the array.
9276 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9277 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9278 /// The number of elements pointed to by `data`.
9281 impl CVec_UpdateFailMalformedHTLCZ {
9282 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
9283 if self.datalen == 0 { return Vec::new(); }
9284 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9285 self.data = std::ptr::null_mut();
9289 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
9290 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9293 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
9294 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
9295 let datalen = v.len();
9296 let data = Box::into_raw(v.into_boxed_slice());
9297 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9301 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9302 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
9303 impl Drop for CVec_UpdateFailMalformedHTLCZ {
9304 fn drop(&mut self) {
9305 if self.datalen == 0 { return; }
9306 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9309 impl Clone for CVec_UpdateFailMalformedHTLCZ {
9310 fn clone(&self) -> Self {
9311 let mut res = Vec::new();
9312 if self.datalen == 0 { return Self::from(res); }
9313 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9318 /// The contents of CResult_AcceptChannelDecodeErrorZ
9319 pub union CResult_AcceptChannelDecodeErrorZPtr {
9320 /// A pointer to the contents in the success state.
9321 /// Reading from this pointer when `result_ok` is not set is undefined.
9322 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
9323 /// A pointer to the contents in the error state.
9324 /// Reading from this pointer when `result_ok` is set is undefined.
9325 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9328 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9329 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9331 pub struct CResult_AcceptChannelDecodeErrorZ {
9332 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9333 /// `err` or `result` depending on the state of `result_ok`.
9334 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
9335 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9336 pub result_ok: bool,
9339 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
9340 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
9341 CResult_AcceptChannelDecodeErrorZ {
9342 contents: CResult_AcceptChannelDecodeErrorZPtr {
9343 result: Box::into_raw(Box::new(o)),
9349 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
9350 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
9351 CResult_AcceptChannelDecodeErrorZ {
9352 contents: CResult_AcceptChannelDecodeErrorZPtr {
9353 err: Box::into_raw(Box::new(e)),
9359 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
9360 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
9361 impl Drop for CResult_AcceptChannelDecodeErrorZ {
9362 fn drop(&mut self) {
9364 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9365 let _ = unsafe { Box::from_raw(self.contents.result) };
9368 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9369 let _ = unsafe { Box::from_raw(self.contents.err) };
9374 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
9375 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9376 let contents = if o.result_ok {
9377 let result = unsafe { o.contents.result };
9378 unsafe { o.contents.result = std::ptr::null_mut() };
9379 CResult_AcceptChannelDecodeErrorZPtr { result }
9381 let err = unsafe { o.contents.err };
9382 unsafe { o.contents.err = std::ptr::null_mut(); }
9383 CResult_AcceptChannelDecodeErrorZPtr { err }
9387 result_ok: o.result_ok,
9391 impl Clone for CResult_AcceptChannelDecodeErrorZ {
9392 fn clone(&self) -> Self {
9394 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
9395 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
9398 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
9399 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9405 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
9406 /// but with all dynamically-allocated buffers duplicated in new buffers.
9407 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
9409 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9410 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
9411 /// A pointer to the contents in the success state.
9412 /// Reading from this pointer when `result_ok` is not set is undefined.
9413 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
9414 /// A pointer to the contents in the error state.
9415 /// Reading from this pointer when `result_ok` is set is undefined.
9416 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9419 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9420 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9422 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
9423 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9424 /// `err` or `result` depending on the state of `result_ok`.
9425 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
9426 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9427 pub result_ok: bool,
9430 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
9431 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9432 CResult_AnnouncementSignaturesDecodeErrorZ {
9433 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9434 result: Box::into_raw(Box::new(o)),
9440 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
9441 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9442 CResult_AnnouncementSignaturesDecodeErrorZ {
9443 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9444 err: Box::into_raw(Box::new(e)),
9450 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
9451 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
9452 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
9453 fn drop(&mut self) {
9455 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9456 let _ = unsafe { Box::from_raw(self.contents.result) };
9459 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9460 let _ = unsafe { Box::from_raw(self.contents.err) };
9465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9466 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
9467 let contents = if o.result_ok {
9468 let result = unsafe { o.contents.result };
9469 unsafe { o.contents.result = std::ptr::null_mut() };
9470 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
9472 let err = unsafe { o.contents.err };
9473 unsafe { o.contents.err = std::ptr::null_mut(); }
9474 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9478 result_ok: o.result_ok,
9482 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9483 fn clone(&self) -> Self {
9485 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9486 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9489 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9490 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9496 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9497 /// but with all dynamically-allocated buffers duplicated in new buffers.
9498 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9500 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9501 pub union CResult_ChannelReestablishDecodeErrorZPtr {
9502 /// A pointer to the contents in the success state.
9503 /// Reading from this pointer when `result_ok` is not set is undefined.
9504 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
9505 /// A pointer to the contents in the error state.
9506 /// Reading from this pointer when `result_ok` is set is undefined.
9507 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9510 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9511 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9513 pub struct CResult_ChannelReestablishDecodeErrorZ {
9514 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9515 /// `err` or `result` depending on the state of `result_ok`.
9516 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9517 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9518 pub result_ok: bool,
9521 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9522 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9523 CResult_ChannelReestablishDecodeErrorZ {
9524 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9525 result: Box::into_raw(Box::new(o)),
9531 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9532 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9533 CResult_ChannelReestablishDecodeErrorZ {
9534 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9535 err: Box::into_raw(Box::new(e)),
9541 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
9542 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9543 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
9544 fn drop(&mut self) {
9546 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9547 let _ = unsafe { Box::from_raw(self.contents.result) };
9550 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9551 let _ = unsafe { Box::from_raw(self.contents.err) };
9556 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9557 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
9558 let contents = if o.result_ok {
9559 let result = unsafe { o.contents.result };
9560 unsafe { o.contents.result = std::ptr::null_mut() };
9561 CResult_ChannelReestablishDecodeErrorZPtr { result }
9563 let err = unsafe { o.contents.err };
9564 unsafe { o.contents.err = std::ptr::null_mut(); }
9565 CResult_ChannelReestablishDecodeErrorZPtr { err }
9569 result_ok: o.result_ok,
9573 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9574 fn clone(&self) -> Self {
9576 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9577 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9580 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9581 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9587 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9588 /// but with all dynamically-allocated buffers duplicated in new buffers.
9589 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9591 /// The contents of CResult_ClosingSignedDecodeErrorZ
9592 pub union CResult_ClosingSignedDecodeErrorZPtr {
9593 /// A pointer to the contents in the success state.
9594 /// Reading from this pointer when `result_ok` is not set is undefined.
9595 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
9596 /// A pointer to the contents in the error state.
9597 /// Reading from this pointer when `result_ok` is set is undefined.
9598 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9601 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9602 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9604 pub struct CResult_ClosingSignedDecodeErrorZ {
9605 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9606 /// `err` or `result` depending on the state of `result_ok`.
9607 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9608 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9609 pub result_ok: bool,
9612 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9613 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9614 CResult_ClosingSignedDecodeErrorZ {
9615 contents: CResult_ClosingSignedDecodeErrorZPtr {
9616 result: Box::into_raw(Box::new(o)),
9622 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9623 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
9624 CResult_ClosingSignedDecodeErrorZ {
9625 contents: CResult_ClosingSignedDecodeErrorZPtr {
9626 err: Box::into_raw(Box::new(e)),
9632 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
9633 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
9634 impl Drop for CResult_ClosingSignedDecodeErrorZ {
9635 fn drop(&mut self) {
9637 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9638 let _ = unsafe { Box::from_raw(self.contents.result) };
9641 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9642 let _ = unsafe { Box::from_raw(self.contents.err) };
9647 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
9648 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9649 let contents = if o.result_ok {
9650 let result = unsafe { o.contents.result };
9651 unsafe { o.contents.result = std::ptr::null_mut() };
9652 CResult_ClosingSignedDecodeErrorZPtr { result }
9654 let err = unsafe { o.contents.err };
9655 unsafe { o.contents.err = std::ptr::null_mut(); }
9656 CResult_ClosingSignedDecodeErrorZPtr { err }
9660 result_ok: o.result_ok,
9664 impl Clone for CResult_ClosingSignedDecodeErrorZ {
9665 fn clone(&self) -> Self {
9667 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
9668 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
9671 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
9672 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9678 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
9679 /// but with all dynamically-allocated buffers duplicated in new buffers.
9680 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
9682 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9683 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9684 /// A pointer to the contents in the success state.
9685 /// Reading from this pointer when `result_ok` is not set is undefined.
9686 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
9687 /// A pointer to the contents in the error state.
9688 /// Reading from this pointer when `result_ok` is set is undefined.
9689 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9692 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9693 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9695 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
9696 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9697 /// `err` or `result` depending on the state of `result_ok`.
9698 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
9699 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9700 pub result_ok: bool,
9703 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
9704 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9705 CResult_ClosingSignedFeeRangeDecodeErrorZ {
9706 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9707 result: Box::into_raw(Box::new(o)),
9713 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
9714 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9715 CResult_ClosingSignedFeeRangeDecodeErrorZ {
9716 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9717 err: Box::into_raw(Box::new(e)),
9723 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
9724 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
9725 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9726 fn drop(&mut self) {
9728 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9729 let _ = unsafe { Box::from_raw(self.contents.result) };
9732 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9733 let _ = unsafe { Box::from_raw(self.contents.err) };
9738 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9739 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
9740 let contents = if o.result_ok {
9741 let result = unsafe { o.contents.result };
9742 unsafe { o.contents.result = std::ptr::null_mut() };
9743 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
9745 let err = unsafe { o.contents.err };
9746 unsafe { o.contents.err = std::ptr::null_mut(); }
9747 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
9751 result_ok: o.result_ok,
9755 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9756 fn clone(&self) -> Self {
9758 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9759 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
9762 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9763 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9769 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
9770 /// but with all dynamically-allocated buffers duplicated in new buffers.
9771 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
9773 /// The contents of CResult_CommitmentSignedDecodeErrorZ
9774 pub union CResult_CommitmentSignedDecodeErrorZPtr {
9775 /// A pointer to the contents in the success state.
9776 /// Reading from this pointer when `result_ok` is not set is undefined.
9777 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
9778 /// A pointer to the contents in the error state.
9779 /// Reading from this pointer when `result_ok` is set is undefined.
9780 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9783 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9784 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9786 pub struct CResult_CommitmentSignedDecodeErrorZ {
9787 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9788 /// `err` or `result` depending on the state of `result_ok`.
9789 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
9790 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9791 pub result_ok: bool,
9794 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
9795 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
9796 CResult_CommitmentSignedDecodeErrorZ {
9797 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9798 result: Box::into_raw(Box::new(o)),
9804 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
9805 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
9806 CResult_CommitmentSignedDecodeErrorZ {
9807 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9808 err: Box::into_raw(Box::new(e)),
9814 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
9815 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
9816 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
9817 fn drop(&mut self) {
9819 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9820 let _ = unsafe { Box::from_raw(self.contents.result) };
9823 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9824 let _ = unsafe { Box::from_raw(self.contents.err) };
9829 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
9830 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9831 let contents = if o.result_ok {
9832 let result = unsafe { o.contents.result };
9833 unsafe { o.contents.result = std::ptr::null_mut() };
9834 CResult_CommitmentSignedDecodeErrorZPtr { result }
9836 let err = unsafe { o.contents.err };
9837 unsafe { o.contents.err = std::ptr::null_mut(); }
9838 CResult_CommitmentSignedDecodeErrorZPtr { err }
9842 result_ok: o.result_ok,
9846 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
9847 fn clone(&self) -> Self {
9849 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9850 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
9853 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9854 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9860 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
9861 /// but with all dynamically-allocated buffers duplicated in new buffers.
9862 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
9864 /// The contents of CResult_FundingCreatedDecodeErrorZ
9865 pub union CResult_FundingCreatedDecodeErrorZPtr {
9866 /// A pointer to the contents in the success state.
9867 /// Reading from this pointer when `result_ok` is not set is undefined.
9868 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
9869 /// A pointer to the contents in the error state.
9870 /// Reading from this pointer when `result_ok` is set is undefined.
9871 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9874 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9875 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9877 pub struct CResult_FundingCreatedDecodeErrorZ {
9878 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9879 /// `err` or `result` depending on the state of `result_ok`.
9880 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
9881 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9882 pub result_ok: bool,
9885 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
9886 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
9887 CResult_FundingCreatedDecodeErrorZ {
9888 contents: CResult_FundingCreatedDecodeErrorZPtr {
9889 result: Box::into_raw(Box::new(o)),
9895 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
9896 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
9897 CResult_FundingCreatedDecodeErrorZ {
9898 contents: CResult_FundingCreatedDecodeErrorZPtr {
9899 err: Box::into_raw(Box::new(e)),
9905 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
9906 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
9907 impl Drop for CResult_FundingCreatedDecodeErrorZ {
9908 fn drop(&mut self) {
9910 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9911 let _ = unsafe { Box::from_raw(self.contents.result) };
9914 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9915 let _ = unsafe { Box::from_raw(self.contents.err) };
9920 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
9921 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
9922 let contents = if o.result_ok {
9923 let result = unsafe { o.contents.result };
9924 unsafe { o.contents.result = std::ptr::null_mut() };
9925 CResult_FundingCreatedDecodeErrorZPtr { result }
9927 let err = unsafe { o.contents.err };
9928 unsafe { o.contents.err = std::ptr::null_mut(); }
9929 CResult_FundingCreatedDecodeErrorZPtr { err }
9933 result_ok: o.result_ok,
9937 impl Clone for CResult_FundingCreatedDecodeErrorZ {
9938 fn clone(&self) -> Self {
9940 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
9941 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
9944 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
9945 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9951 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
9952 /// but with all dynamically-allocated buffers duplicated in new buffers.
9953 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
9955 /// The contents of CResult_FundingSignedDecodeErrorZ
9956 pub union CResult_FundingSignedDecodeErrorZPtr {
9957 /// A pointer to the contents in the success state.
9958 /// Reading from this pointer when `result_ok` is not set is undefined.
9959 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
9960 /// A pointer to the contents in the error state.
9961 /// Reading from this pointer when `result_ok` is set is undefined.
9962 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9965 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9966 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9968 pub struct CResult_FundingSignedDecodeErrorZ {
9969 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9970 /// `err` or `result` depending on the state of `result_ok`.
9971 pub contents: CResult_FundingSignedDecodeErrorZPtr,
9972 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9973 pub result_ok: bool,
9976 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
9977 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
9978 CResult_FundingSignedDecodeErrorZ {
9979 contents: CResult_FundingSignedDecodeErrorZPtr {
9980 result: Box::into_raw(Box::new(o)),
9986 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
9987 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
9988 CResult_FundingSignedDecodeErrorZ {
9989 contents: CResult_FundingSignedDecodeErrorZPtr {
9990 err: Box::into_raw(Box::new(e)),
9996 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
9997 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
9998 impl Drop for CResult_FundingSignedDecodeErrorZ {
9999 fn drop(&mut self) {
10000 if self.result_ok {
10001 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10002 let _ = unsafe { Box::from_raw(self.contents.result) };
10005 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10006 let _ = unsafe { Box::from_raw(self.contents.err) };
10011 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
10012 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10013 let contents = if o.result_ok {
10014 let result = unsafe { o.contents.result };
10015 unsafe { o.contents.result = std::ptr::null_mut() };
10016 CResult_FundingSignedDecodeErrorZPtr { result }
10018 let err = unsafe { o.contents.err };
10019 unsafe { o.contents.err = std::ptr::null_mut(); }
10020 CResult_FundingSignedDecodeErrorZPtr { err }
10024 result_ok: o.result_ok,
10028 impl Clone for CResult_FundingSignedDecodeErrorZ {
10029 fn clone(&self) -> Self {
10030 if self.result_ok {
10031 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
10032 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
10035 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
10036 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10042 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10043 /// but with all dynamically-allocated buffers duplicated in new buffers.
10044 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
10046 /// The contents of CResult_FundingLockedDecodeErrorZ
10047 pub union CResult_FundingLockedDecodeErrorZPtr {
10048 /// A pointer to the contents in the success state.
10049 /// Reading from this pointer when `result_ok` is not set is undefined.
10050 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
10051 /// A pointer to the contents in the error state.
10052 /// Reading from this pointer when `result_ok` is set is undefined.
10053 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10056 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
10057 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
10058 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10059 pub struct CResult_FundingLockedDecodeErrorZ {
10060 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
10061 /// `err` or `result` depending on the state of `result_ok`.
10062 pub contents: CResult_FundingLockedDecodeErrorZPtr,
10063 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
10064 pub result_ok: bool,
10067 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10068 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
10069 CResult_FundingLockedDecodeErrorZ {
10070 contents: CResult_FundingLockedDecodeErrorZPtr {
10071 result: Box::into_raw(Box::new(o)),
10077 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10078 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
10079 CResult_FundingLockedDecodeErrorZ {
10080 contents: CResult_FundingLockedDecodeErrorZPtr {
10081 err: Box::into_raw(Box::new(e)),
10087 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10088 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
10089 impl Drop for CResult_FundingLockedDecodeErrorZ {
10090 fn drop(&mut self) {
10091 if self.result_ok {
10092 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10093 let _ = unsafe { Box::from_raw(self.contents.result) };
10096 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10097 let _ = unsafe { Box::from_raw(self.contents.err) };
10102 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
10103 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
10104 let contents = if o.result_ok {
10105 let result = unsafe { o.contents.result };
10106 unsafe { o.contents.result = std::ptr::null_mut() };
10107 CResult_FundingLockedDecodeErrorZPtr { result }
10109 let err = unsafe { o.contents.err };
10110 unsafe { o.contents.err = std::ptr::null_mut(); }
10111 CResult_FundingLockedDecodeErrorZPtr { err }
10115 result_ok: o.result_ok,
10119 impl Clone for CResult_FundingLockedDecodeErrorZ {
10120 fn clone(&self) -> Self {
10121 if self.result_ok {
10122 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
10123 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
10126 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
10127 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10133 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10134 /// but with all dynamically-allocated buffers duplicated in new buffers.
10135 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
10137 /// The contents of CResult_InitDecodeErrorZ
10138 pub union CResult_InitDecodeErrorZPtr {
10139 /// A pointer to the contents in the success state.
10140 /// Reading from this pointer when `result_ok` is not set is undefined.
10141 pub result: *mut crate::lightning::ln::msgs::Init,
10142 /// A pointer to the contents in the error state.
10143 /// Reading from this pointer when `result_ok` is set is undefined.
10144 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10147 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
10148 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
10149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10150 pub struct CResult_InitDecodeErrorZ {
10151 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
10152 /// `err` or `result` depending on the state of `result_ok`.
10153 pub contents: CResult_InitDecodeErrorZPtr,
10154 /// Whether this CResult_InitDecodeErrorZ represents a success state.
10155 pub result_ok: bool,
10158 /// Creates a new CResult_InitDecodeErrorZ in the success state.
10159 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
10160 CResult_InitDecodeErrorZ {
10161 contents: CResult_InitDecodeErrorZPtr {
10162 result: Box::into_raw(Box::new(o)),
10168 /// Creates a new CResult_InitDecodeErrorZ in the error state.
10169 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
10170 CResult_InitDecodeErrorZ {
10171 contents: CResult_InitDecodeErrorZPtr {
10172 err: Box::into_raw(Box::new(e)),
10178 /// Frees any resources used by the CResult_InitDecodeErrorZ.
10179 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
10180 impl Drop for CResult_InitDecodeErrorZ {
10181 fn drop(&mut self) {
10182 if self.result_ok {
10183 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10184 let _ = unsafe { Box::from_raw(self.contents.result) };
10187 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10188 let _ = unsafe { Box::from_raw(self.contents.err) };
10193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
10194 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
10195 let contents = if o.result_ok {
10196 let result = unsafe { o.contents.result };
10197 unsafe { o.contents.result = std::ptr::null_mut() };
10198 CResult_InitDecodeErrorZPtr { result }
10200 let err = unsafe { o.contents.err };
10201 unsafe { o.contents.err = std::ptr::null_mut(); }
10202 CResult_InitDecodeErrorZPtr { err }
10206 result_ok: o.result_ok,
10210 impl Clone for CResult_InitDecodeErrorZ {
10211 fn clone(&self) -> Self {
10212 if self.result_ok {
10213 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
10214 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
10217 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
10218 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10224 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10225 /// but with all dynamically-allocated buffers duplicated in new buffers.
10226 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
10228 /// The contents of CResult_OpenChannelDecodeErrorZ
10229 pub union CResult_OpenChannelDecodeErrorZPtr {
10230 /// A pointer to the contents in the success state.
10231 /// Reading from this pointer when `result_ok` is not set is undefined.
10232 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
10233 /// A pointer to the contents in the error state.
10234 /// Reading from this pointer when `result_ok` is set is undefined.
10235 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10238 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10239 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10241 pub struct CResult_OpenChannelDecodeErrorZ {
10242 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10243 /// `err` or `result` depending on the state of `result_ok`.
10244 pub contents: CResult_OpenChannelDecodeErrorZPtr,
10245 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10246 pub result_ok: bool,
10249 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10250 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
10251 CResult_OpenChannelDecodeErrorZ {
10252 contents: CResult_OpenChannelDecodeErrorZPtr {
10253 result: Box::into_raw(Box::new(o)),
10259 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10260 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
10261 CResult_OpenChannelDecodeErrorZ {
10262 contents: CResult_OpenChannelDecodeErrorZPtr {
10263 err: Box::into_raw(Box::new(e)),
10269 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10270 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
10271 impl Drop for CResult_OpenChannelDecodeErrorZ {
10272 fn drop(&mut self) {
10273 if self.result_ok {
10274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10275 let _ = unsafe { Box::from_raw(self.contents.result) };
10278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10279 let _ = unsafe { Box::from_raw(self.contents.err) };
10284 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
10285 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
10286 let contents = if o.result_ok {
10287 let result = unsafe { o.contents.result };
10288 unsafe { o.contents.result = std::ptr::null_mut() };
10289 CResult_OpenChannelDecodeErrorZPtr { result }
10291 let err = unsafe { o.contents.err };
10292 unsafe { o.contents.err = std::ptr::null_mut(); }
10293 CResult_OpenChannelDecodeErrorZPtr { err }
10297 result_ok: o.result_ok,
10301 impl Clone for CResult_OpenChannelDecodeErrorZ {
10302 fn clone(&self) -> Self {
10303 if self.result_ok {
10304 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
10305 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
10308 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
10309 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10315 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10316 /// but with all dynamically-allocated buffers duplicated in new buffers.
10317 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
10319 /// The contents of CResult_RevokeAndACKDecodeErrorZ
10320 pub union CResult_RevokeAndACKDecodeErrorZPtr {
10321 /// A pointer to the contents in the success state.
10322 /// Reading from this pointer when `result_ok` is not set is undefined.
10323 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
10324 /// A pointer to the contents in the error state.
10325 /// Reading from this pointer when `result_ok` is set is undefined.
10326 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10329 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10330 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
10331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10332 pub struct CResult_RevokeAndACKDecodeErrorZ {
10333 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10334 /// `err` or `result` depending on the state of `result_ok`.
10335 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
10336 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10337 pub result_ok: bool,
10340 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10341 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
10342 CResult_RevokeAndACKDecodeErrorZ {
10343 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10344 result: Box::into_raw(Box::new(o)),
10350 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10351 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
10352 CResult_RevokeAndACKDecodeErrorZ {
10353 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10354 err: Box::into_raw(Box::new(e)),
10360 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10361 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
10362 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
10363 fn drop(&mut self) {
10364 if self.result_ok {
10365 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10366 let _ = unsafe { Box::from_raw(self.contents.result) };
10369 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10370 let _ = unsafe { Box::from_raw(self.contents.err) };
10375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
10376 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
10377 let contents = if o.result_ok {
10378 let result = unsafe { o.contents.result };
10379 unsafe { o.contents.result = std::ptr::null_mut() };
10380 CResult_RevokeAndACKDecodeErrorZPtr { result }
10382 let err = unsafe { o.contents.err };
10383 unsafe { o.contents.err = std::ptr::null_mut(); }
10384 CResult_RevokeAndACKDecodeErrorZPtr { err }
10388 result_ok: o.result_ok,
10392 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
10393 fn clone(&self) -> Self {
10394 if self.result_ok {
10395 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10396 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
10399 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10400 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10406 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10407 /// but with all dynamically-allocated buffers duplicated in new buffers.
10408 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
10410 /// The contents of CResult_ShutdownDecodeErrorZ
10411 pub union CResult_ShutdownDecodeErrorZPtr {
10412 /// A pointer to the contents in the success state.
10413 /// Reading from this pointer when `result_ok` is not set is undefined.
10414 pub result: *mut crate::lightning::ln::msgs::Shutdown,
10415 /// A pointer to the contents in the error state.
10416 /// Reading from this pointer when `result_ok` is set is undefined.
10417 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10420 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
10421 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
10422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10423 pub struct CResult_ShutdownDecodeErrorZ {
10424 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10425 /// `err` or `result` depending on the state of `result_ok`.
10426 pub contents: CResult_ShutdownDecodeErrorZPtr,
10427 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10428 pub result_ok: bool,
10431 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10432 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
10433 CResult_ShutdownDecodeErrorZ {
10434 contents: CResult_ShutdownDecodeErrorZPtr {
10435 result: Box::into_raw(Box::new(o)),
10441 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10442 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
10443 CResult_ShutdownDecodeErrorZ {
10444 contents: CResult_ShutdownDecodeErrorZPtr {
10445 err: Box::into_raw(Box::new(e)),
10451 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10452 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
10453 impl Drop for CResult_ShutdownDecodeErrorZ {
10454 fn drop(&mut self) {
10455 if self.result_ok {
10456 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10457 let _ = unsafe { Box::from_raw(self.contents.result) };
10460 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10461 let _ = unsafe { Box::from_raw(self.contents.err) };
10466 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10467 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
10468 let contents = if o.result_ok {
10469 let result = unsafe { o.contents.result };
10470 unsafe { o.contents.result = std::ptr::null_mut() };
10471 CResult_ShutdownDecodeErrorZPtr { result }
10473 let err = unsafe { o.contents.err };
10474 unsafe { o.contents.err = std::ptr::null_mut(); }
10475 CResult_ShutdownDecodeErrorZPtr { err }
10479 result_ok: o.result_ok,
10483 impl Clone for CResult_ShutdownDecodeErrorZ {
10484 fn clone(&self) -> Self {
10485 if self.result_ok {
10486 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10487 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10490 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
10491 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10497 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10498 /// but with all dynamically-allocated buffers duplicated in new buffers.
10499 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10501 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10502 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
10503 /// A pointer to the contents in the success state.
10504 /// Reading from this pointer when `result_ok` is not set is undefined.
10505 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10506 /// A pointer to the contents in the error state.
10507 /// Reading from this pointer when `result_ok` is set is undefined.
10508 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10511 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10512 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10513 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10514 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
10515 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10516 /// `err` or `result` depending on the state of `result_ok`.
10517 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10518 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10519 pub result_ok: bool,
10522 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10523 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10524 CResult_UpdateFailHTLCDecodeErrorZ {
10525 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10526 result: Box::into_raw(Box::new(o)),
10532 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10533 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10534 CResult_UpdateFailHTLCDecodeErrorZ {
10535 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10536 err: Box::into_raw(Box::new(e)),
10542 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10543 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10544 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
10545 fn drop(&mut self) {
10546 if self.result_ok {
10547 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10548 let _ = unsafe { Box::from_raw(self.contents.result) };
10551 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10552 let _ = unsafe { Box::from_raw(self.contents.err) };
10557 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10558 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10559 let contents = if o.result_ok {
10560 let result = unsafe { o.contents.result };
10561 unsafe { o.contents.result = std::ptr::null_mut() };
10562 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
10564 let err = unsafe { o.contents.err };
10565 unsafe { o.contents.err = std::ptr::null_mut(); }
10566 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10570 result_ok: o.result_ok,
10574 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10575 fn clone(&self) -> Self {
10576 if self.result_ok {
10577 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10578 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10581 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10582 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10588 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10589 /// but with all dynamically-allocated buffers duplicated in new buffers.
10590 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10592 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10593 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10594 /// A pointer to the contents in the success state.
10595 /// Reading from this pointer when `result_ok` is not set is undefined.
10596 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10597 /// A pointer to the contents in the error state.
10598 /// Reading from this pointer when `result_ok` is set is undefined.
10599 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10602 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10603 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10605 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10606 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10607 /// `err` or `result` depending on the state of `result_ok`.
10608 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10609 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10610 pub result_ok: bool,
10613 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10614 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10615 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10616 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10617 result: Box::into_raw(Box::new(o)),
10623 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10624 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10625 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10626 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10627 err: Box::into_raw(Box::new(e)),
10633 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10634 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
10635 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10636 fn drop(&mut self) {
10637 if self.result_ok {
10638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10639 let _ = unsafe { Box::from_raw(self.contents.result) };
10642 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10643 let _ = unsafe { Box::from_raw(self.contents.err) };
10648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10649 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10650 let contents = if o.result_ok {
10651 let result = unsafe { o.contents.result };
10652 unsafe { o.contents.result = std::ptr::null_mut() };
10653 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
10655 let err = unsafe { o.contents.err };
10656 unsafe { o.contents.err = std::ptr::null_mut(); }
10657 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
10661 result_ok: o.result_ok,
10665 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10666 fn clone(&self) -> Self {
10667 if self.result_ok {
10668 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10669 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
10672 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10673 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10679 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10680 /// but with all dynamically-allocated buffers duplicated in new buffers.
10681 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
10683 /// The contents of CResult_UpdateFeeDecodeErrorZ
10684 pub union CResult_UpdateFeeDecodeErrorZPtr {
10685 /// A pointer to the contents in the success state.
10686 /// Reading from this pointer when `result_ok` is not set is undefined.
10687 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
10688 /// A pointer to the contents in the error state.
10689 /// Reading from this pointer when `result_ok` is set is undefined.
10690 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10693 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10694 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10696 pub struct CResult_UpdateFeeDecodeErrorZ {
10697 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10698 /// `err` or `result` depending on the state of `result_ok`.
10699 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
10700 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10701 pub result_ok: bool,
10704 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10705 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
10706 CResult_UpdateFeeDecodeErrorZ {
10707 contents: CResult_UpdateFeeDecodeErrorZPtr {
10708 result: Box::into_raw(Box::new(o)),
10714 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10715 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
10716 CResult_UpdateFeeDecodeErrorZ {
10717 contents: CResult_UpdateFeeDecodeErrorZPtr {
10718 err: Box::into_raw(Box::new(e)),
10724 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10725 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
10726 impl Drop for CResult_UpdateFeeDecodeErrorZ {
10727 fn drop(&mut self) {
10728 if self.result_ok {
10729 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10730 let _ = unsafe { Box::from_raw(self.contents.result) };
10733 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10734 let _ = unsafe { Box::from_raw(self.contents.err) };
10739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
10740 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
10741 let contents = if o.result_ok {
10742 let result = unsafe { o.contents.result };
10743 unsafe { o.contents.result = std::ptr::null_mut() };
10744 CResult_UpdateFeeDecodeErrorZPtr { result }
10746 let err = unsafe { o.contents.err };
10747 unsafe { o.contents.err = std::ptr::null_mut(); }
10748 CResult_UpdateFeeDecodeErrorZPtr { err }
10752 result_ok: o.result_ok,
10756 impl Clone for CResult_UpdateFeeDecodeErrorZ {
10757 fn clone(&self) -> Self {
10758 if self.result_ok {
10759 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
10760 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
10763 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
10764 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10770 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10771 /// but with all dynamically-allocated buffers duplicated in new buffers.
10772 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
10774 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10775 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10776 /// A pointer to the contents in the success state.
10777 /// Reading from this pointer when `result_ok` is not set is undefined.
10778 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10779 /// A pointer to the contents in the error state.
10780 /// Reading from this pointer when `result_ok` is set is undefined.
10781 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10784 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10785 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10787 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
10788 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10789 /// `err` or `result` depending on the state of `result_ok`.
10790 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
10791 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10792 pub result_ok: bool,
10795 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10796 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10797 CResult_UpdateFulfillHTLCDecodeErrorZ {
10798 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10799 result: Box::into_raw(Box::new(o)),
10805 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10806 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10807 CResult_UpdateFulfillHTLCDecodeErrorZ {
10808 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10809 err: Box::into_raw(Box::new(e)),
10815 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10816 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
10817 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
10818 fn drop(&mut self) {
10819 if self.result_ok {
10820 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10821 let _ = unsafe { Box::from_raw(self.contents.result) };
10824 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10825 let _ = unsafe { Box::from_raw(self.contents.err) };
10830 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
10831 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10832 let contents = if o.result_ok {
10833 let result = unsafe { o.contents.result };
10834 unsafe { o.contents.result = std::ptr::null_mut() };
10835 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
10837 let err = unsafe { o.contents.err };
10838 unsafe { o.contents.err = std::ptr::null_mut(); }
10839 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
10843 result_ok: o.result_ok,
10847 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
10848 fn clone(&self) -> Self {
10849 if self.result_ok {
10850 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10851 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
10854 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10855 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10861 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10862 /// but with all dynamically-allocated buffers duplicated in new buffers.
10863 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
10865 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
10866 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
10867 /// A pointer to the contents in the success state.
10868 /// Reading from this pointer when `result_ok` is not set is undefined.
10869 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10870 /// A pointer to the contents in the error state.
10871 /// Reading from this pointer when `result_ok` is set is undefined.
10872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10875 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10876 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10878 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
10879 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10880 /// `err` or `result` depending on the state of `result_ok`.
10881 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
10882 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10883 pub result_ok: bool,
10886 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10887 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
10888 CResult_UpdateAddHTLCDecodeErrorZ {
10889 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10890 result: Box::into_raw(Box::new(o)),
10896 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10897 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
10898 CResult_UpdateAddHTLCDecodeErrorZ {
10899 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10900 err: Box::into_raw(Box::new(e)),
10906 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10907 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
10908 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
10909 fn drop(&mut self) {
10910 if self.result_ok {
10911 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10912 let _ = unsafe { Box::from_raw(self.contents.result) };
10915 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10916 let _ = unsafe { Box::from_raw(self.contents.err) };
10921 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
10922 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10923 let contents = if o.result_ok {
10924 let result = unsafe { o.contents.result };
10925 unsafe { o.contents.result = std::ptr::null_mut() };
10926 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
10928 let err = unsafe { o.contents.err };
10929 unsafe { o.contents.err = std::ptr::null_mut(); }
10930 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
10934 result_ok: o.result_ok,
10938 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
10939 fn clone(&self) -> Self {
10940 if self.result_ok {
10941 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10942 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
10945 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10946 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10952 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10953 /// but with all dynamically-allocated buffers duplicated in new buffers.
10954 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
10956 /// The contents of CResult_PingDecodeErrorZ
10957 pub union CResult_PingDecodeErrorZPtr {
10958 /// A pointer to the contents in the success state.
10959 /// Reading from this pointer when `result_ok` is not set is undefined.
10960 pub result: *mut crate::lightning::ln::msgs::Ping,
10961 /// A pointer to the contents in the error state.
10962 /// Reading from this pointer when `result_ok` is set is undefined.
10963 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10966 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10967 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10969 pub struct CResult_PingDecodeErrorZ {
10970 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
10971 /// `err` or `result` depending on the state of `result_ok`.
10972 pub contents: CResult_PingDecodeErrorZPtr,
10973 /// Whether this CResult_PingDecodeErrorZ represents a success state.
10974 pub result_ok: bool,
10977 /// Creates a new CResult_PingDecodeErrorZ in the success state.
10978 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
10979 CResult_PingDecodeErrorZ {
10980 contents: CResult_PingDecodeErrorZPtr {
10981 result: Box::into_raw(Box::new(o)),
10987 /// Creates a new CResult_PingDecodeErrorZ in the error state.
10988 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
10989 CResult_PingDecodeErrorZ {
10990 contents: CResult_PingDecodeErrorZPtr {
10991 err: Box::into_raw(Box::new(e)),
10997 /// Frees any resources used by the CResult_PingDecodeErrorZ.
10998 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
10999 impl Drop for CResult_PingDecodeErrorZ {
11000 fn drop(&mut self) {
11001 if self.result_ok {
11002 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11003 let _ = unsafe { Box::from_raw(self.contents.result) };
11006 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11007 let _ = unsafe { Box::from_raw(self.contents.err) };
11012 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
11013 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
11014 let contents = if o.result_ok {
11015 let result = unsafe { o.contents.result };
11016 unsafe { o.contents.result = std::ptr::null_mut() };
11017 CResult_PingDecodeErrorZPtr { result }
11019 let err = unsafe { o.contents.err };
11020 unsafe { o.contents.err = std::ptr::null_mut(); }
11021 CResult_PingDecodeErrorZPtr { err }
11025 result_ok: o.result_ok,
11029 impl Clone for CResult_PingDecodeErrorZ {
11030 fn clone(&self) -> Self {
11031 if self.result_ok {
11032 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
11033 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
11036 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
11037 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11043 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11044 /// but with all dynamically-allocated buffers duplicated in new buffers.
11045 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
11047 /// The contents of CResult_PongDecodeErrorZ
11048 pub union CResult_PongDecodeErrorZPtr {
11049 /// A pointer to the contents in the success state.
11050 /// Reading from this pointer when `result_ok` is not set is undefined.
11051 pub result: *mut crate::lightning::ln::msgs::Pong,
11052 /// A pointer to the contents in the error state.
11053 /// Reading from this pointer when `result_ok` is set is undefined.
11054 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11057 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11058 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11059 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11060 pub struct CResult_PongDecodeErrorZ {
11061 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
11062 /// `err` or `result` depending on the state of `result_ok`.
11063 pub contents: CResult_PongDecodeErrorZPtr,
11064 /// Whether this CResult_PongDecodeErrorZ represents a success state.
11065 pub result_ok: bool,
11068 /// Creates a new CResult_PongDecodeErrorZ in the success state.
11069 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
11070 CResult_PongDecodeErrorZ {
11071 contents: CResult_PongDecodeErrorZPtr {
11072 result: Box::into_raw(Box::new(o)),
11078 /// Creates a new CResult_PongDecodeErrorZ in the error state.
11079 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
11080 CResult_PongDecodeErrorZ {
11081 contents: CResult_PongDecodeErrorZPtr {
11082 err: Box::into_raw(Box::new(e)),
11088 /// Frees any resources used by the CResult_PongDecodeErrorZ.
11089 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
11090 impl Drop for CResult_PongDecodeErrorZ {
11091 fn drop(&mut self) {
11092 if self.result_ok {
11093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11094 let _ = unsafe { Box::from_raw(self.contents.result) };
11097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11098 let _ = unsafe { Box::from_raw(self.contents.err) };
11103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
11104 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
11105 let contents = if o.result_ok {
11106 let result = unsafe { o.contents.result };
11107 unsafe { o.contents.result = std::ptr::null_mut() };
11108 CResult_PongDecodeErrorZPtr { result }
11110 let err = unsafe { o.contents.err };
11111 unsafe { o.contents.err = std::ptr::null_mut(); }
11112 CResult_PongDecodeErrorZPtr { err }
11116 result_ok: o.result_ok,
11120 impl Clone for CResult_PongDecodeErrorZ {
11121 fn clone(&self) -> Self {
11122 if self.result_ok {
11123 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
11124 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
11127 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
11128 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11134 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11135 /// but with all dynamically-allocated buffers duplicated in new buffers.
11136 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
11138 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11139 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11140 /// A pointer to the contents in the success state.
11141 /// Reading from this pointer when `result_ok` is not set is undefined.
11142 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
11143 /// A pointer to the contents in the error state.
11144 /// Reading from this pointer when `result_ok` is set is undefined.
11145 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11148 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11149 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11151 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11152 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11153 /// `err` or `result` depending on the state of `result_ok`.
11154 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
11155 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11156 pub result_ok: bool,
11159 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11160 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11161 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11162 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11163 result: Box::into_raw(Box::new(o)),
11169 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11170 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11171 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11172 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11173 err: Box::into_raw(Box::new(e)),
11179 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11180 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
11181 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11182 fn drop(&mut self) {
11183 if self.result_ok {
11184 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11185 let _ = unsafe { Box::from_raw(self.contents.result) };
11188 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11189 let _ = unsafe { Box::from_raw(self.contents.err) };
11194 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11195 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11196 let contents = if o.result_ok {
11197 let result = unsafe { o.contents.result };
11198 unsafe { o.contents.result = std::ptr::null_mut() };
11199 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
11201 let err = unsafe { o.contents.err };
11202 unsafe { o.contents.err = std::ptr::null_mut(); }
11203 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
11207 result_ok: o.result_ok,
11211 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11212 fn clone(&self) -> Self {
11213 if self.result_ok {
11214 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11215 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11218 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11219 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11225 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11226 /// but with all dynamically-allocated buffers duplicated in new buffers.
11227 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11229 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
11230 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
11231 /// A pointer to the contents in the success state.
11232 /// Reading from this pointer when `result_ok` is not set is undefined.
11233 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
11234 /// A pointer to the contents in the error state.
11235 /// Reading from this pointer when `result_ok` is set is undefined.
11236 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11239 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11240 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11241 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11242 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
11243 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11244 /// `err` or `result` depending on the state of `result_ok`.
11245 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
11246 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11247 pub result_ok: bool,
11250 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11251 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
11252 CResult_ChannelAnnouncementDecodeErrorZ {
11253 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11254 result: Box::into_raw(Box::new(o)),
11260 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11261 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
11262 CResult_ChannelAnnouncementDecodeErrorZ {
11263 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11264 err: Box::into_raw(Box::new(e)),
11270 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11271 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
11272 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
11273 fn drop(&mut self) {
11274 if self.result_ok {
11275 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11276 let _ = unsafe { Box::from_raw(self.contents.result) };
11279 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11280 let _ = unsafe { Box::from_raw(self.contents.err) };
11285 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
11286 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11287 let contents = if o.result_ok {
11288 let result = unsafe { o.contents.result };
11289 unsafe { o.contents.result = std::ptr::null_mut() };
11290 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
11292 let err = unsafe { o.contents.err };
11293 unsafe { o.contents.err = std::ptr::null_mut(); }
11294 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
11298 result_ok: o.result_ok,
11302 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
11303 fn clone(&self) -> Self {
11304 if self.result_ok {
11305 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11306 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11309 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11310 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11316 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11317 /// but with all dynamically-allocated buffers duplicated in new buffers.
11318 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11320 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11321 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11322 /// A pointer to the contents in the success state.
11323 /// Reading from this pointer when `result_ok` is not set is undefined.
11324 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
11325 /// A pointer to the contents in the error state.
11326 /// Reading from this pointer when `result_ok` is set is undefined.
11327 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11330 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11331 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11332 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11333 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
11334 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11335 /// `err` or `result` depending on the state of `result_ok`.
11336 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
11337 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11338 pub result_ok: bool,
11341 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11342 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11343 CResult_UnsignedChannelUpdateDecodeErrorZ {
11344 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11345 result: Box::into_raw(Box::new(o)),
11351 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11352 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11353 CResult_UnsignedChannelUpdateDecodeErrorZ {
11354 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11355 err: Box::into_raw(Box::new(e)),
11361 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11362 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
11363 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
11364 fn drop(&mut self) {
11365 if self.result_ok {
11366 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11367 let _ = unsafe { Box::from_raw(self.contents.result) };
11370 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11371 let _ = unsafe { Box::from_raw(self.contents.err) };
11376 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
11377 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11378 let contents = if o.result_ok {
11379 let result = unsafe { o.contents.result };
11380 unsafe { o.contents.result = std::ptr::null_mut() };
11381 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
11383 let err = unsafe { o.contents.err };
11384 unsafe { o.contents.err = std::ptr::null_mut(); }
11385 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
11389 result_ok: o.result_ok,
11393 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
11394 fn clone(&self) -> Self {
11395 if self.result_ok {
11396 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11397 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
11400 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11401 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11407 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11408 /// but with all dynamically-allocated buffers duplicated in new buffers.
11409 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11411 /// The contents of CResult_ChannelUpdateDecodeErrorZ
11412 pub union CResult_ChannelUpdateDecodeErrorZPtr {
11413 /// A pointer to the contents in the success state.
11414 /// Reading from this pointer when `result_ok` is not set is undefined.
11415 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
11416 /// A pointer to the contents in the error state.
11417 /// Reading from this pointer when `result_ok` is set is undefined.
11418 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11421 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11422 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11424 pub struct CResult_ChannelUpdateDecodeErrorZ {
11425 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11426 /// `err` or `result` depending on the state of `result_ok`.
11427 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
11428 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11429 pub result_ok: bool,
11432 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11433 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
11434 CResult_ChannelUpdateDecodeErrorZ {
11435 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11436 result: Box::into_raw(Box::new(o)),
11442 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11443 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
11444 CResult_ChannelUpdateDecodeErrorZ {
11445 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11446 err: Box::into_raw(Box::new(e)),
11452 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11453 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
11454 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
11455 fn drop(&mut self) {
11456 if self.result_ok {
11457 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11458 let _ = unsafe { Box::from_raw(self.contents.result) };
11461 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11462 let _ = unsafe { Box::from_raw(self.contents.err) };
11467 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11468 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11469 let contents = if o.result_ok {
11470 let result = unsafe { o.contents.result };
11471 unsafe { o.contents.result = std::ptr::null_mut() };
11472 CResult_ChannelUpdateDecodeErrorZPtr { result }
11474 let err = unsafe { o.contents.err };
11475 unsafe { o.contents.err = std::ptr::null_mut(); }
11476 CResult_ChannelUpdateDecodeErrorZPtr { err }
11480 result_ok: o.result_ok,
11484 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11485 fn clone(&self) -> Self {
11486 if self.result_ok {
11487 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11488 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11491 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11492 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11498 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11499 /// but with all dynamically-allocated buffers duplicated in new buffers.
11500 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11502 /// The contents of CResult_ErrorMessageDecodeErrorZ
11503 pub union CResult_ErrorMessageDecodeErrorZPtr {
11504 /// A pointer to the contents in the success state.
11505 /// Reading from this pointer when `result_ok` is not set is undefined.
11506 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11507 /// A pointer to the contents in the error state.
11508 /// Reading from this pointer when `result_ok` is set is undefined.
11509 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11512 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11513 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11515 pub struct CResult_ErrorMessageDecodeErrorZ {
11516 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11517 /// `err` or `result` depending on the state of `result_ok`.
11518 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11519 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11520 pub result_ok: bool,
11523 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11524 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11525 CResult_ErrorMessageDecodeErrorZ {
11526 contents: CResult_ErrorMessageDecodeErrorZPtr {
11527 result: Box::into_raw(Box::new(o)),
11533 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11534 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11535 CResult_ErrorMessageDecodeErrorZ {
11536 contents: CResult_ErrorMessageDecodeErrorZPtr {
11537 err: Box::into_raw(Box::new(e)),
11543 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11544 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11545 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11546 fn drop(&mut self) {
11547 if self.result_ok {
11548 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11549 let _ = unsafe { Box::from_raw(self.contents.result) };
11552 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11553 let _ = unsafe { Box::from_raw(self.contents.err) };
11558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11559 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11560 let contents = if o.result_ok {
11561 let result = unsafe { o.contents.result };
11562 unsafe { o.contents.result = std::ptr::null_mut() };
11563 CResult_ErrorMessageDecodeErrorZPtr { result }
11565 let err = unsafe { o.contents.err };
11566 unsafe { o.contents.err = std::ptr::null_mut(); }
11567 CResult_ErrorMessageDecodeErrorZPtr { err }
11571 result_ok: o.result_ok,
11575 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11576 fn clone(&self) -> Self {
11577 if self.result_ok {
11578 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11579 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11582 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11583 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11589 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11590 /// but with all dynamically-allocated buffers duplicated in new buffers.
11591 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11593 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11594 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11595 /// A pointer to the contents in the success state.
11596 /// Reading from this pointer when `result_ok` is not set is undefined.
11597 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11598 /// A pointer to the contents in the error state.
11599 /// Reading from this pointer when `result_ok` is set is undefined.
11600 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11603 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11604 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11606 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11607 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11608 /// `err` or `result` depending on the state of `result_ok`.
11609 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11610 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11611 pub result_ok: bool,
11614 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11615 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11616 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11617 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11618 result: Box::into_raw(Box::new(o)),
11624 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11625 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11626 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11627 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11628 err: Box::into_raw(Box::new(e)),
11634 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11635 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
11636 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11637 fn drop(&mut self) {
11638 if self.result_ok {
11639 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11640 let _ = unsafe { Box::from_raw(self.contents.result) };
11643 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11644 let _ = unsafe { Box::from_raw(self.contents.err) };
11649 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11650 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11651 let contents = if o.result_ok {
11652 let result = unsafe { o.contents.result };
11653 unsafe { o.contents.result = std::ptr::null_mut() };
11654 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
11656 let err = unsafe { o.contents.err };
11657 unsafe { o.contents.err = std::ptr::null_mut(); }
11658 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
11662 result_ok: o.result_ok,
11666 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11667 fn clone(&self) -> Self {
11668 if self.result_ok {
11669 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11670 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11673 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11674 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11680 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11681 /// but with all dynamically-allocated buffers duplicated in new buffers.
11682 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11684 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
11685 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
11686 /// A pointer to the contents in the success state.
11687 /// Reading from this pointer when `result_ok` is not set is undefined.
11688 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
11689 /// A pointer to the contents in the error state.
11690 /// Reading from this pointer when `result_ok` is set is undefined.
11691 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11694 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11695 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11696 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11697 pub struct CResult_NodeAnnouncementDecodeErrorZ {
11698 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11699 /// `err` or `result` depending on the state of `result_ok`.
11700 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
11701 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11702 pub result_ok: bool,
11705 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11706 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
11707 CResult_NodeAnnouncementDecodeErrorZ {
11708 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11709 result: Box::into_raw(Box::new(o)),
11715 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11716 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
11717 CResult_NodeAnnouncementDecodeErrorZ {
11718 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11719 err: Box::into_raw(Box::new(e)),
11725 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11726 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
11727 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
11728 fn drop(&mut self) {
11729 if self.result_ok {
11730 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11731 let _ = unsafe { Box::from_raw(self.contents.result) };
11734 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11735 let _ = unsafe { Box::from_raw(self.contents.err) };
11740 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
11741 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11742 let contents = if o.result_ok {
11743 let result = unsafe { o.contents.result };
11744 unsafe { o.contents.result = std::ptr::null_mut() };
11745 CResult_NodeAnnouncementDecodeErrorZPtr { result }
11747 let err = unsafe { o.contents.err };
11748 unsafe { o.contents.err = std::ptr::null_mut(); }
11749 CResult_NodeAnnouncementDecodeErrorZPtr { err }
11753 result_ok: o.result_ok,
11757 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
11758 fn clone(&self) -> Self {
11759 if self.result_ok {
11760 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11761 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11764 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11765 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11771 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11772 /// but with all dynamically-allocated buffers duplicated in new buffers.
11773 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11775 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
11776 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
11777 /// A pointer to the contents in the success state.
11778 /// Reading from this pointer when `result_ok` is not set is undefined.
11779 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
11780 /// A pointer to the contents in the error state.
11781 /// Reading from this pointer when `result_ok` is set is undefined.
11782 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11785 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
11786 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
11787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11788 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
11789 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
11790 /// `err` or `result` depending on the state of `result_ok`.
11791 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
11792 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
11793 pub result_ok: bool,
11796 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11797 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11798 CResult_QueryShortChannelIdsDecodeErrorZ {
11799 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11800 result: Box::into_raw(Box::new(o)),
11806 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11807 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11808 CResult_QueryShortChannelIdsDecodeErrorZ {
11809 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11810 err: Box::into_raw(Box::new(e)),
11816 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11817 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
11818 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
11819 fn drop(&mut self) {
11820 if self.result_ok {
11821 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11822 let _ = unsafe { Box::from_raw(self.contents.result) };
11825 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11826 let _ = unsafe { Box::from_raw(self.contents.err) };
11831 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
11832 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
11833 let contents = if o.result_ok {
11834 let result = unsafe { o.contents.result };
11835 unsafe { o.contents.result = std::ptr::null_mut() };
11836 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
11838 let err = unsafe { o.contents.err };
11839 unsafe { o.contents.err = std::ptr::null_mut(); }
11840 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
11844 result_ok: o.result_ok,
11848 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
11849 fn clone(&self) -> Self {
11850 if self.result_ok {
11851 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11852 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
11855 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11856 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11862 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11863 /// but with all dynamically-allocated buffers duplicated in new buffers.
11864 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
11866 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
11867 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11868 /// A pointer to the contents in the success state.
11869 /// Reading from this pointer when `result_ok` is not set is undefined.
11870 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
11871 /// A pointer to the contents in the error state.
11872 /// Reading from this pointer when `result_ok` is set is undefined.
11873 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11876 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
11877 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
11878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11879 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11880 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
11881 /// `err` or `result` depending on the state of `result_ok`.
11882 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
11883 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
11884 pub result_ok: bool,
11887 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11888 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11889 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11890 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11891 result: Box::into_raw(Box::new(o)),
11897 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11898 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11899 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11900 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11901 err: Box::into_raw(Box::new(e)),
11907 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11908 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
11909 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11910 fn drop(&mut self) {
11911 if self.result_ok {
11912 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11913 let _ = unsafe { Box::from_raw(self.contents.result) };
11916 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11917 let _ = unsafe { Box::from_raw(self.contents.err) };
11922 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11923 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
11924 let contents = if o.result_ok {
11925 let result = unsafe { o.contents.result };
11926 unsafe { o.contents.result = std::ptr::null_mut() };
11927 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
11929 let err = unsafe { o.contents.err };
11930 unsafe { o.contents.err = std::ptr::null_mut(); }
11931 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
11935 result_ok: o.result_ok,
11939 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11940 fn clone(&self) -> Self {
11941 if self.result_ok {
11942 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11943 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
11946 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11947 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11953 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11954 /// but with all dynamically-allocated buffers duplicated in new buffers.
11955 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
11957 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
11958 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
11959 /// A pointer to the contents in the success state.
11960 /// Reading from this pointer when `result_ok` is not set is undefined.
11961 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
11962 /// A pointer to the contents in the error state.
11963 /// Reading from this pointer when `result_ok` is set is undefined.
11964 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11967 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11968 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11969 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11970 pub struct CResult_QueryChannelRangeDecodeErrorZ {
11971 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11972 /// `err` or `result` depending on the state of `result_ok`.
11973 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
11974 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11975 pub result_ok: bool,
11978 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11979 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
11980 CResult_QueryChannelRangeDecodeErrorZ {
11981 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11982 result: Box::into_raw(Box::new(o)),
11988 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11989 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
11990 CResult_QueryChannelRangeDecodeErrorZ {
11991 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11992 err: Box::into_raw(Box::new(e)),
11998 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11999 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
12000 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
12001 fn drop(&mut self) {
12002 if self.result_ok {
12003 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12004 let _ = unsafe { Box::from_raw(self.contents.result) };
12007 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12008 let _ = unsafe { Box::from_raw(self.contents.err) };
12013 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
12014 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12015 let contents = if o.result_ok {
12016 let result = unsafe { o.contents.result };
12017 unsafe { o.contents.result = std::ptr::null_mut() };
12018 CResult_QueryChannelRangeDecodeErrorZPtr { result }
12020 let err = unsafe { o.contents.err };
12021 unsafe { o.contents.err = std::ptr::null_mut(); }
12022 CResult_QueryChannelRangeDecodeErrorZPtr { err }
12026 result_ok: o.result_ok,
12030 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
12031 fn clone(&self) -> Self {
12032 if self.result_ok {
12033 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12034 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
12037 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12038 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12044 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
12045 /// but with all dynamically-allocated buffers duplicated in new buffers.
12046 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12048 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
12049 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
12050 /// A pointer to the contents in the success state.
12051 /// Reading from this pointer when `result_ok` is not set is undefined.
12052 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
12053 /// A pointer to the contents in the error state.
12054 /// Reading from this pointer when `result_ok` is set is undefined.
12055 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12058 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12059 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12061 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
12062 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12063 /// `err` or `result` depending on the state of `result_ok`.
12064 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
12065 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12066 pub result_ok: bool,
12069 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
12070 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
12071 CResult_ReplyChannelRangeDecodeErrorZ {
12072 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12073 result: Box::into_raw(Box::new(o)),
12079 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
12080 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
12081 CResult_ReplyChannelRangeDecodeErrorZ {
12082 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12083 err: Box::into_raw(Box::new(e)),
12089 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
12090 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
12091 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
12092 fn drop(&mut self) {
12093 if self.result_ok {
12094 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12095 let _ = unsafe { Box::from_raw(self.contents.result) };
12098 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12099 let _ = unsafe { Box::from_raw(self.contents.err) };
12104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
12105 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12106 let contents = if o.result_ok {
12107 let result = unsafe { o.contents.result };
12108 unsafe { o.contents.result = std::ptr::null_mut() };
12109 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
12111 let err = unsafe { o.contents.err };
12112 unsafe { o.contents.err = std::ptr::null_mut(); }
12113 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
12117 result_ok: o.result_ok,
12121 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
12122 fn clone(&self) -> Self {
12123 if self.result_ok {
12124 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12125 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
12128 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12129 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12135 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
12136 /// but with all dynamically-allocated buffers duplicated in new buffers.
12137 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12139 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
12140 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
12141 /// A pointer to the contents in the success state.
12142 /// Reading from this pointer when `result_ok` is not set is undefined.
12143 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
12144 /// A pointer to the contents in the error state.
12145 /// Reading from this pointer when `result_ok` is set is undefined.
12146 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12149 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12150 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12152 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
12153 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12154 /// `err` or `result` depending on the state of `result_ok`.
12155 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
12156 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12157 pub result_ok: bool,
12160 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
12161 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
12162 CResult_GossipTimestampFilterDecodeErrorZ {
12163 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12164 result: Box::into_raw(Box::new(o)),
12170 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
12171 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
12172 CResult_GossipTimestampFilterDecodeErrorZ {
12173 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12174 err: Box::into_raw(Box::new(e)),
12180 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
12181 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
12182 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
12183 fn drop(&mut self) {
12184 if self.result_ok {
12185 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12186 let _ = unsafe { Box::from_raw(self.contents.result) };
12189 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12190 let _ = unsafe { Box::from_raw(self.contents.err) };
12195 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
12196 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
12197 let contents = if o.result_ok {
12198 let result = unsafe { o.contents.result };
12199 unsafe { o.contents.result = std::ptr::null_mut() };
12200 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
12202 let err = unsafe { o.contents.err };
12203 unsafe { o.contents.err = std::ptr::null_mut(); }
12204 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
12208 result_ok: o.result_ok,
12212 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
12213 fn clone(&self) -> Self {
12214 if self.result_ok {
12215 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12216 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
12219 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12220 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12226 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
12227 /// but with all dynamically-allocated buffers duplicated in new buffers.
12228 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
12230 /// The contents of CResult_InvoiceSignOrCreationErrorZ
12231 pub union CResult_InvoiceSignOrCreationErrorZPtr {
12232 /// A pointer to the contents in the success state.
12233 /// Reading from this pointer when `result_ok` is not set is undefined.
12234 pub result: *mut crate::lightning_invoice::Invoice,
12235 /// A pointer to the contents in the error state.
12236 /// Reading from this pointer when `result_ok` is set is undefined.
12237 pub err: *mut crate::lightning_invoice::SignOrCreationError,
12240 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12241 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12243 pub struct CResult_InvoiceSignOrCreationErrorZ {
12244 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
12245 /// `err` or `result` depending on the state of `result_ok`.
12246 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
12247 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
12248 pub result_ok: bool,
12251 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
12252 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
12253 CResult_InvoiceSignOrCreationErrorZ {
12254 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12255 result: Box::into_raw(Box::new(o)),
12261 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
12262 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
12263 CResult_InvoiceSignOrCreationErrorZ {
12264 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12265 err: Box::into_raw(Box::new(e)),
12271 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
12272 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
12273 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
12274 fn drop(&mut self) {
12275 if self.result_ok {
12276 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12277 let _ = unsafe { Box::from_raw(self.contents.result) };
12280 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12281 let _ = unsafe { Box::from_raw(self.contents.err) };
12286 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
12287 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
12288 let contents = if o.result_ok {
12289 let result = unsafe { o.contents.result };
12290 unsafe { o.contents.result = std::ptr::null_mut() };
12291 CResult_InvoiceSignOrCreationErrorZPtr { result }
12293 let err = unsafe { o.contents.err };
12294 unsafe { o.contents.err = std::ptr::null_mut(); }
12295 CResult_InvoiceSignOrCreationErrorZPtr { err }
12299 result_ok: o.result_ok,
12303 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
12304 fn clone(&self) -> Self {
12305 if self.result_ok {
12306 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12307 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12310 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12311 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
12317 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
12318 /// but with all dynamically-allocated buffers duplicated in new buffers.
12319 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
12321 /// An enum which can either contain a crate::lightning::chain::Filter or not
12322 pub enum COption_FilterZ {
12323 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
12324 Some(crate::lightning::chain::Filter),
12325 /// When we're in this state, this COption_FilterZ contains nothing
12328 impl COption_FilterZ {
12329 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12330 if let Self::Some(_) = self { true } else { false }
12332 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12335 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
12336 if let Self::Some(v) = self { v } else { unreachable!() }
12340 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
12341 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
12342 COption_FilterZ::Some(o)
12345 /// Constructs a new COption_FilterZ containing nothing
12346 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
12347 COption_FilterZ::None
12350 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
12351 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
12353 /// The contents of CResult_LockedChannelMonitorNoneZ
12354 pub union CResult_LockedChannelMonitorNoneZPtr {
12355 /// A pointer to the contents in the success state.
12356 /// Reading from this pointer when `result_ok` is not set is undefined.
12357 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
12358 /// Note that this value is always NULL, as there are no contents in the Err variant
12359 pub err: *mut std::ffi::c_void,
12362 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
12363 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
12364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12365 pub struct CResult_LockedChannelMonitorNoneZ {
12366 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
12367 /// `err` or `result` depending on the state of `result_ok`.
12368 pub contents: CResult_LockedChannelMonitorNoneZPtr,
12369 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
12370 pub result_ok: bool,
12373 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
12374 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
12375 CResult_LockedChannelMonitorNoneZ {
12376 contents: CResult_LockedChannelMonitorNoneZPtr {
12377 result: Box::into_raw(Box::new(o)),
12383 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
12384 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
12385 CResult_LockedChannelMonitorNoneZ {
12386 contents: CResult_LockedChannelMonitorNoneZPtr {
12387 err: std::ptr::null_mut(),
12393 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
12394 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
12395 impl Drop for CResult_LockedChannelMonitorNoneZ {
12396 fn drop(&mut self) {
12397 if self.result_ok {
12398 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12399 let _ = unsafe { Box::from_raw(self.contents.result) };
12405 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
12406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
12407 let contents = if o.result_ok {
12408 let result = unsafe { o.contents.result };
12409 unsafe { o.contents.result = std::ptr::null_mut() };
12410 CResult_LockedChannelMonitorNoneZPtr { result }
12412 let _ = unsafe { Box::from_raw(o.contents.err) };
12413 o.contents.err = std::ptr::null_mut();
12414 CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
12418 result_ok: o.result_ok,
12423 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
12424 /// This corresponds to std::vector in C++
12425 pub struct CVec_OutPointZ {
12426 /// The elements in the array.
12427 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12428 pub data: *mut crate::lightning::chain::transaction::OutPoint,
12429 /// The number of elements pointed to by `data`.
12432 impl CVec_OutPointZ {
12433 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
12434 if self.datalen == 0 { return Vec::new(); }
12435 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12436 self.data = std::ptr::null_mut();
12440 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
12441 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
12444 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
12445 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
12446 let datalen = v.len();
12447 let data = Box::into_raw(v.into_boxed_slice());
12448 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12452 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12453 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
12454 impl Drop for CVec_OutPointZ {
12455 fn drop(&mut self) {
12456 if self.datalen == 0 { return; }
12457 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
12460 impl Clone for CVec_OutPointZ {
12461 fn clone(&self) -> Self {
12462 let mut res = Vec::new();
12463 if self.datalen == 0 { return Self::from(res); }
12464 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });