2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4 /// A pointer to the contents in the success state.
5 /// Reading from this pointer when `result_ok` is not set is undefined.
6 pub result: *mut crate::c_types::SecretKey,
7 /// A pointer to the contents in the error state.
8 /// Reading from this pointer when `result_ok` is set is undefined.
9 pub err: *mut crate::c_types::Secp256k1Error,
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17 /// `err` or `result` depending on the state of `result_ok`.
18 pub contents: CResult_SecretKeyErrorZPtr,
19 /// Whether this CResult_SecretKeyErrorZ represents a success state.
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25 CResult_SecretKeyErrorZ {
26 contents: CResult_SecretKeyErrorZPtr {
27 result: Box::into_raw(Box::new(o)),
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35 CResult_SecretKeyErrorZ {
36 contents: CResult_SecretKeyErrorZPtr {
37 err: Box::into_raw(Box::new(e)),
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
48 if unsafe { !(self.contents.result as *mut ()).is_null() } {
49 let _ = unsafe { Box::from_raw(self.contents.result) };
52 if unsafe { !(self.contents.err as *mut ()).is_null() } {
53 let _ = unsafe { Box::from_raw(self.contents.err) };
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60 let contents = if o.result_ok {
61 let result = unsafe { o.contents.result };
62 unsafe { o.contents.result = std::ptr::null_mut() };
63 CResult_SecretKeyErrorZPtr { result }
65 let err = unsafe { o.contents.err };
66 unsafe { o.contents.err = std::ptr::null_mut(); }
67 CResult_SecretKeyErrorZPtr { err }
71 result_ok: o.result_ok,
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78 /// A pointer to the contents in the success state.
79 /// Reading from this pointer when `result_ok` is not set is undefined.
80 pub result: *mut crate::c_types::PublicKey,
81 /// A pointer to the contents in the error state.
82 /// Reading from this pointer when `result_ok` is set is undefined.
83 pub err: *mut crate::c_types::Secp256k1Error,
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91 /// `err` or `result` depending on the state of `result_ok`.
92 pub contents: CResult_PublicKeyErrorZPtr,
93 /// Whether this CResult_PublicKeyErrorZ represents a success state.
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99 CResult_PublicKeyErrorZ {
100 contents: CResult_PublicKeyErrorZPtr {
101 result: Box::into_raw(Box::new(o)),
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109 CResult_PublicKeyErrorZ {
110 contents: CResult_PublicKeyErrorZPtr {
111 err: Box::into_raw(Box::new(e)),
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
123 let _ = unsafe { Box::from_raw(self.contents.result) };
126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
127 let _ = unsafe { Box::from_raw(self.contents.err) };
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134 let contents = if o.result_ok {
135 let result = unsafe { o.contents.result };
136 unsafe { o.contents.result = std::ptr::null_mut() };
137 CResult_PublicKeyErrorZPtr { result }
139 let err = unsafe { o.contents.err };
140 unsafe { o.contents.err = std::ptr::null_mut(); }
141 CResult_PublicKeyErrorZPtr { err }
145 result_ok: o.result_ok,
149 impl Clone for CResult_PublicKeyErrorZ {
150 fn clone(&self) -> Self {
152 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
153 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
156 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
157 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
163 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
164 /// but with all dynamically-allocated buffers duplicated in new buffers.
165 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
167 /// The contents of CResult_TxCreationKeysDecodeErrorZ
168 pub union CResult_TxCreationKeysDecodeErrorZPtr {
169 /// A pointer to the contents in the success state.
170 /// Reading from this pointer when `result_ok` is not set is undefined.
171 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
172 /// A pointer to the contents in the error state.
173 /// Reading from this pointer when `result_ok` is set is undefined.
174 pub err: *mut crate::lightning::ln::msgs::DecodeError,
177 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
178 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
180 pub struct CResult_TxCreationKeysDecodeErrorZ {
181 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
182 /// `err` or `result` depending on the state of `result_ok`.
183 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
184 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
188 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
189 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
190 CResult_TxCreationKeysDecodeErrorZ {
191 contents: CResult_TxCreationKeysDecodeErrorZPtr {
192 result: Box::into_raw(Box::new(o)),
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
200 CResult_TxCreationKeysDecodeErrorZ {
201 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202 err: Box::into_raw(Box::new(e)),
208 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
210 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
214 let _ = unsafe { Box::from_raw(self.contents.result) };
217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
218 let _ = unsafe { Box::from_raw(self.contents.err) };
223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
225 let contents = if o.result_ok {
226 let result = unsafe { o.contents.result };
227 unsafe { o.contents.result = std::ptr::null_mut() };
228 CResult_TxCreationKeysDecodeErrorZPtr { result }
230 let err = unsafe { o.contents.err };
231 unsafe { o.contents.err = std::ptr::null_mut(); }
232 CResult_TxCreationKeysDecodeErrorZPtr { err }
236 result_ok: o.result_ok,
240 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
241 fn clone(&self) -> Self {
243 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
244 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
247 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
254 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
255 /// but with all dynamically-allocated buffers duplicated in new buffers.
256 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
258 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
259 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
260 /// A pointer to the contents in the success state.
261 /// Reading from this pointer when `result_ok` is not set is undefined.
262 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
263 /// A pointer to the contents in the error state.
264 /// Reading from this pointer when `result_ok` is set is undefined.
265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
268 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
269 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
272 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
273 /// `err` or `result` depending on the state of `result_ok`.
274 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
275 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
279 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
280 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
281 CResult_ChannelPublicKeysDecodeErrorZ {
282 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
283 result: Box::into_raw(Box::new(o)),
289 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
290 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
291 CResult_ChannelPublicKeysDecodeErrorZ {
292 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
293 err: Box::into_raw(Box::new(e)),
299 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
300 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
301 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
305 let _ = unsafe { Box::from_raw(self.contents.result) };
308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
309 let _ = unsafe { Box::from_raw(self.contents.err) };
314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
315 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
316 let contents = if o.result_ok {
317 let result = unsafe { o.contents.result };
318 unsafe { o.contents.result = std::ptr::null_mut() };
319 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
321 let err = unsafe { o.contents.err };
322 unsafe { o.contents.err = std::ptr::null_mut(); }
323 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
327 result_ok: o.result_ok,
331 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
332 fn clone(&self) -> Self {
334 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
335 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
338 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
345 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
346 /// but with all dynamically-allocated buffers duplicated in new buffers.
347 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
349 /// The contents of CResult_TxCreationKeysErrorZ
350 pub union CResult_TxCreationKeysErrorZPtr {
351 /// A pointer to the contents in the success state.
352 /// Reading from this pointer when `result_ok` is not set is undefined.
353 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
354 /// A pointer to the contents in the error state.
355 /// Reading from this pointer when `result_ok` is set is undefined.
356 pub err: *mut crate::c_types::Secp256k1Error,
359 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
360 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
362 pub struct CResult_TxCreationKeysErrorZ {
363 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
364 /// `err` or `result` depending on the state of `result_ok`.
365 pub contents: CResult_TxCreationKeysErrorZPtr,
366 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
370 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
371 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
372 CResult_TxCreationKeysErrorZ {
373 contents: CResult_TxCreationKeysErrorZPtr {
374 result: Box::into_raw(Box::new(o)),
380 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
381 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
382 CResult_TxCreationKeysErrorZ {
383 contents: CResult_TxCreationKeysErrorZPtr {
384 err: Box::into_raw(Box::new(e)),
390 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
392 impl Drop for CResult_TxCreationKeysErrorZ {
395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
396 let _ = unsafe { Box::from_raw(self.contents.result) };
399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
400 let _ = unsafe { Box::from_raw(self.contents.err) };
405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
407 let contents = if o.result_ok {
408 let result = unsafe { o.contents.result };
409 unsafe { o.contents.result = std::ptr::null_mut() };
410 CResult_TxCreationKeysErrorZPtr { result }
412 let err = unsafe { o.contents.err };
413 unsafe { o.contents.err = std::ptr::null_mut(); }
414 CResult_TxCreationKeysErrorZPtr { err }
418 result_ok: o.result_ok,
422 impl Clone for CResult_TxCreationKeysErrorZ {
423 fn clone(&self) -> Self {
425 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
426 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
429 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
430 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
436 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
437 /// but with all dynamically-allocated buffers duplicated in new buffers.
438 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
441 /// An enum which can either contain a u32 or not
442 pub enum COption_u32Z {
443 /// When we're in this state, this COption_u32Z contains a u32
445 /// When we're in this state, this COption_u32Z contains nothing
449 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
450 if let Self::Some(_) = self { true } else { false }
452 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
455 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
456 if let Self::Some(v) = self { v } else { unreachable!() }
460 /// Constructs a new COption_u32Z containing a u32
461 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
462 COption_u32Z::Some(o)
465 /// Constructs a new COption_u32Z containing nothing
466 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
470 /// Frees any resources associated with the u32, if we are in the Some state
471 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
473 /// Creates a new COption_u32Z which has the same data as `orig`
474 /// but with all dynamically-allocated buffers duplicated in new buffers.
475 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
477 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
478 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
479 /// A pointer to the contents in the success state.
480 /// Reading from this pointer when `result_ok` is not set is undefined.
481 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
482 /// A pointer to the contents in the error state.
483 /// Reading from this pointer when `result_ok` is set is undefined.
484 pub err: *mut crate::lightning::ln::msgs::DecodeError,
487 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
488 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
490 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
491 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
492 /// `err` or `result` depending on the state of `result_ok`.
493 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
494 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
498 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
499 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
500 CResult_HTLCOutputInCommitmentDecodeErrorZ {
501 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
502 result: Box::into_raw(Box::new(o)),
508 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
509 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
510 CResult_HTLCOutputInCommitmentDecodeErrorZ {
511 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
512 err: Box::into_raw(Box::new(e)),
518 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
519 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
520 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
523 if unsafe { !(self.contents.result as *mut ()).is_null() } {
524 let _ = unsafe { Box::from_raw(self.contents.result) };
527 if unsafe { !(self.contents.err as *mut ()).is_null() } {
528 let _ = unsafe { Box::from_raw(self.contents.err) };
533 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
534 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
535 let contents = if o.result_ok {
536 let result = unsafe { o.contents.result };
537 unsafe { o.contents.result = std::ptr::null_mut() };
538 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
540 let err = unsafe { o.contents.err };
541 unsafe { o.contents.err = std::ptr::null_mut(); }
542 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
546 result_ok: o.result_ok,
550 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
551 fn clone(&self) -> Self {
553 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
554 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
557 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
558 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
564 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
565 /// but with all dynamically-allocated buffers duplicated in new buffers.
566 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
568 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
569 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
570 /// A pointer to the contents in the success state.
571 /// Reading from this pointer when `result_ok` is not set is undefined.
572 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
573 /// A pointer to the contents in the error state.
574 /// Reading from this pointer when `result_ok` is set is undefined.
575 pub err: *mut crate::lightning::ln::msgs::DecodeError,
578 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
579 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
581 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
582 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
583 /// `err` or `result` depending on the state of `result_ok`.
584 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
585 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
589 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
590 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
591 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
592 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
593 result: Box::into_raw(Box::new(o)),
599 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
600 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
601 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
602 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
603 err: Box::into_raw(Box::new(e)),
609 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
610 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
611 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
614 if unsafe { !(self.contents.result as *mut ()).is_null() } {
615 let _ = unsafe { Box::from_raw(self.contents.result) };
618 if unsafe { !(self.contents.err as *mut ()).is_null() } {
619 let _ = unsafe { Box::from_raw(self.contents.err) };
624 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
625 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
626 let contents = if o.result_ok {
627 let result = unsafe { o.contents.result };
628 unsafe { o.contents.result = std::ptr::null_mut() };
629 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
631 let err = unsafe { o.contents.err };
632 unsafe { o.contents.err = std::ptr::null_mut(); }
633 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
637 result_ok: o.result_ok,
641 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
642 fn clone(&self) -> Self {
644 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
645 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
648 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
649 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
655 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
656 /// but with all dynamically-allocated buffers duplicated in new buffers.
657 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
659 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
660 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
661 /// A pointer to the contents in the success state.
662 /// Reading from this pointer when `result_ok` is not set is undefined.
663 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
664 /// A pointer to the contents in the error state.
665 /// Reading from this pointer when `result_ok` is set is undefined.
666 pub err: *mut crate::lightning::ln::msgs::DecodeError,
669 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
670 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
672 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
673 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
674 /// `err` or `result` depending on the state of `result_ok`.
675 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
676 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
680 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
681 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
682 CResult_ChannelTransactionParametersDecodeErrorZ {
683 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
684 result: Box::into_raw(Box::new(o)),
690 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
691 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
692 CResult_ChannelTransactionParametersDecodeErrorZ {
693 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
694 err: Box::into_raw(Box::new(e)),
700 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
701 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
702 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
705 if unsafe { !(self.contents.result as *mut ()).is_null() } {
706 let _ = unsafe { Box::from_raw(self.contents.result) };
709 if unsafe { !(self.contents.err as *mut ()).is_null() } {
710 let _ = unsafe { Box::from_raw(self.contents.err) };
715 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
716 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
717 let contents = if o.result_ok {
718 let result = unsafe { o.contents.result };
719 unsafe { o.contents.result = std::ptr::null_mut() };
720 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
722 let err = unsafe { o.contents.err };
723 unsafe { o.contents.err = std::ptr::null_mut(); }
724 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
728 result_ok: o.result_ok,
732 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
733 fn clone(&self) -> Self {
735 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
736 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
739 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
740 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
746 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
747 /// but with all dynamically-allocated buffers duplicated in new buffers.
748 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
750 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
751 /// This corresponds to std::vector in C++
752 pub struct CVec_SignatureZ {
753 /// The elements in the array.
754 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
755 pub data: *mut crate::c_types::Signature,
756 /// The number of elements pointed to by `data`.
759 impl CVec_SignatureZ {
760 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
761 if self.datalen == 0 { return Vec::new(); }
762 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
763 self.data = std::ptr::null_mut();
767 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
768 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
771 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
772 fn from(v: Vec<crate::c_types::Signature>) -> Self {
773 let datalen = v.len();
774 let data = Box::into_raw(v.into_boxed_slice());
775 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
779 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
780 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
781 impl Drop for CVec_SignatureZ {
783 if self.datalen == 0 { return; }
784 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
787 impl Clone for CVec_SignatureZ {
788 fn clone(&self) -> Self {
789 let mut res = Vec::new();
790 if self.datalen == 0 { return Self::from(res); }
791 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
796 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
797 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
798 /// A pointer to the contents in the success state.
799 /// Reading from this pointer when `result_ok` is not set is undefined.
800 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
801 /// A pointer to the contents in the error state.
802 /// Reading from this pointer when `result_ok` is set is undefined.
803 pub err: *mut crate::lightning::ln::msgs::DecodeError,
806 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
807 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
809 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
810 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
811 /// `err` or `result` depending on the state of `result_ok`.
812 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
813 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
817 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
818 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
819 CResult_HolderCommitmentTransactionDecodeErrorZ {
820 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
821 result: Box::into_raw(Box::new(o)),
827 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
828 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
829 CResult_HolderCommitmentTransactionDecodeErrorZ {
830 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
831 err: Box::into_raw(Box::new(e)),
837 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
838 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
839 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
843 let _ = unsafe { Box::from_raw(self.contents.result) };
846 if unsafe { !(self.contents.err as *mut ()).is_null() } {
847 let _ = unsafe { Box::from_raw(self.contents.err) };
852 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
853 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
854 let contents = if o.result_ok {
855 let result = unsafe { o.contents.result };
856 unsafe { o.contents.result = std::ptr::null_mut() };
857 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
859 let err = unsafe { o.contents.err };
860 unsafe { o.contents.err = std::ptr::null_mut(); }
861 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
865 result_ok: o.result_ok,
869 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
870 fn clone(&self) -> Self {
872 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
873 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
876 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
877 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
883 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
884 /// but with all dynamically-allocated buffers duplicated in new buffers.
885 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
887 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
888 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
889 /// A pointer to the contents in the success state.
890 /// Reading from this pointer when `result_ok` is not set is undefined.
891 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
892 /// A pointer to the contents in the error state.
893 /// Reading from this pointer when `result_ok` is set is undefined.
894 pub err: *mut crate::lightning::ln::msgs::DecodeError,
897 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
898 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
900 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
901 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
902 /// `err` or `result` depending on the state of `result_ok`.
903 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
904 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
908 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
909 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
910 CResult_BuiltCommitmentTransactionDecodeErrorZ {
911 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
912 result: Box::into_raw(Box::new(o)),
918 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
919 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
920 CResult_BuiltCommitmentTransactionDecodeErrorZ {
921 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
922 err: Box::into_raw(Box::new(e)),
928 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
929 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
930 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
934 let _ = unsafe { Box::from_raw(self.contents.result) };
937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
938 let _ = unsafe { Box::from_raw(self.contents.err) };
943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
944 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
945 let contents = if o.result_ok {
946 let result = unsafe { o.contents.result };
947 unsafe { o.contents.result = std::ptr::null_mut() };
948 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
950 let err = unsafe { o.contents.err };
951 unsafe { o.contents.err = std::ptr::null_mut(); }
952 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
956 result_ok: o.result_ok,
960 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
961 fn clone(&self) -> Self {
963 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
964 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
967 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
968 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
974 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
975 /// but with all dynamically-allocated buffers duplicated in new buffers.
976 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
978 /// The contents of CResult_TrustedClosingTransactionNoneZ
979 pub union CResult_TrustedClosingTransactionNoneZPtr {
980 /// A pointer to the contents in the success state.
981 /// Reading from this pointer when `result_ok` is not set is undefined.
982 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
983 /// Note that this value is always NULL, as there are no contents in the Err variant
984 pub err: *mut std::ffi::c_void,
987 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
988 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
990 pub struct CResult_TrustedClosingTransactionNoneZ {
991 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
992 /// `err` or `result` depending on the state of `result_ok`.
993 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
994 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
998 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
999 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1000 CResult_TrustedClosingTransactionNoneZ {
1001 contents: CResult_TrustedClosingTransactionNoneZPtr {
1002 result: Box::into_raw(Box::new(o)),
1008 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1009 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1010 CResult_TrustedClosingTransactionNoneZ {
1011 contents: CResult_TrustedClosingTransactionNoneZPtr {
1012 err: std::ptr::null_mut(),
1018 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1019 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1020 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1021 fn drop(&mut self) {
1023 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1024 let _ = unsafe { Box::from_raw(self.contents.result) };
1030 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1031 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1032 let contents = if o.result_ok {
1033 let result = unsafe { o.contents.result };
1034 unsafe { o.contents.result = std::ptr::null_mut() };
1035 CResult_TrustedClosingTransactionNoneZPtr { result }
1037 let _ = unsafe { Box::from_raw(o.contents.err) };
1038 o.contents.err = std::ptr::null_mut();
1039 CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1043 result_ok: o.result_ok,
1048 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1049 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1050 /// A pointer to the contents in the success state.
1051 /// Reading from this pointer when `result_ok` is not set is undefined.
1052 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1053 /// A pointer to the contents in the error state.
1054 /// Reading from this pointer when `result_ok` is set is undefined.
1055 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1058 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1059 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1061 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1062 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1063 /// `err` or `result` depending on the state of `result_ok`.
1064 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1065 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1066 pub result_ok: bool,
1069 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1070 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1071 CResult_CommitmentTransactionDecodeErrorZ {
1072 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1073 result: Box::into_raw(Box::new(o)),
1079 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1080 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1081 CResult_CommitmentTransactionDecodeErrorZ {
1082 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1083 err: Box::into_raw(Box::new(e)),
1089 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1090 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1091 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1092 fn drop(&mut self) {
1094 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1095 let _ = unsafe { Box::from_raw(self.contents.result) };
1098 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1099 let _ = unsafe { Box::from_raw(self.contents.err) };
1104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1105 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1106 let contents = if o.result_ok {
1107 let result = unsafe { o.contents.result };
1108 unsafe { o.contents.result = std::ptr::null_mut() };
1109 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1111 let err = unsafe { o.contents.err };
1112 unsafe { o.contents.err = std::ptr::null_mut(); }
1113 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1117 result_ok: o.result_ok,
1121 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1122 fn clone(&self) -> Self {
1124 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1125 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1128 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1129 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1135 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1136 /// but with all dynamically-allocated buffers duplicated in new buffers.
1137 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1139 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1140 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1141 /// A pointer to the contents in the success state.
1142 /// Reading from this pointer when `result_ok` is not set is undefined.
1143 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1144 /// Note that this value is always NULL, as there are no contents in the Err variant
1145 pub err: *mut std::ffi::c_void,
1148 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1149 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1151 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1152 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1153 /// `err` or `result` depending on the state of `result_ok`.
1154 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1155 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1156 pub result_ok: bool,
1159 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1160 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1161 CResult_TrustedCommitmentTransactionNoneZ {
1162 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1163 result: Box::into_raw(Box::new(o)),
1169 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1170 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1171 CResult_TrustedCommitmentTransactionNoneZ {
1172 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1173 err: std::ptr::null_mut(),
1179 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1180 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1181 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1182 fn drop(&mut self) {
1184 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1185 let _ = unsafe { Box::from_raw(self.contents.result) };
1191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1192 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1193 let contents = if o.result_ok {
1194 let result = unsafe { o.contents.result };
1195 unsafe { o.contents.result = std::ptr::null_mut() };
1196 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1198 let _ = unsafe { Box::from_raw(o.contents.err) };
1199 o.contents.err = std::ptr::null_mut();
1200 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1204 result_ok: o.result_ok,
1209 /// The contents of CResult_CVec_SignatureZNoneZ
1210 pub union CResult_CVec_SignatureZNoneZPtr {
1211 /// A pointer to the contents in the success state.
1212 /// Reading from this pointer when `result_ok` is not set is undefined.
1213 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1214 /// Note that this value is always NULL, as there are no contents in the Err variant
1215 pub err: *mut std::ffi::c_void,
1218 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1219 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1220 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1221 pub struct CResult_CVec_SignatureZNoneZ {
1222 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1223 /// `err` or `result` depending on the state of `result_ok`.
1224 pub contents: CResult_CVec_SignatureZNoneZPtr,
1225 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1226 pub result_ok: bool,
1229 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1230 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1231 CResult_CVec_SignatureZNoneZ {
1232 contents: CResult_CVec_SignatureZNoneZPtr {
1233 result: Box::into_raw(Box::new(o)),
1239 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1240 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1241 CResult_CVec_SignatureZNoneZ {
1242 contents: CResult_CVec_SignatureZNoneZPtr {
1243 err: std::ptr::null_mut(),
1249 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1250 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1251 impl Drop for CResult_CVec_SignatureZNoneZ {
1252 fn drop(&mut self) {
1254 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1255 let _ = unsafe { Box::from_raw(self.contents.result) };
1261 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1262 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1263 let contents = if o.result_ok {
1264 let result = unsafe { o.contents.result };
1265 unsafe { o.contents.result = std::ptr::null_mut() };
1266 CResult_CVec_SignatureZNoneZPtr { result }
1268 let _ = unsafe { Box::from_raw(o.contents.err) };
1269 o.contents.err = std::ptr::null_mut();
1270 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1274 result_ok: o.result_ok,
1278 impl Clone for CResult_CVec_SignatureZNoneZ {
1279 fn clone(&self) -> Self {
1281 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1282 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1285 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1286 err: std::ptr::null_mut()
1292 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1293 /// but with all dynamically-allocated buffers duplicated in new buffers.
1294 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1296 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1297 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1298 /// A pointer to the contents in the success state.
1299 /// Reading from this pointer when `result_ok` is not set is undefined.
1300 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1301 /// A pointer to the contents in the error state.
1302 /// Reading from this pointer when `result_ok` is set is undefined.
1303 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1306 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1307 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1309 pub struct CResult_ShutdownScriptDecodeErrorZ {
1310 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1311 /// `err` or `result` depending on the state of `result_ok`.
1312 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1313 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1314 pub result_ok: bool,
1317 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1318 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1319 CResult_ShutdownScriptDecodeErrorZ {
1320 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1321 result: Box::into_raw(Box::new(o)),
1327 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1328 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1329 CResult_ShutdownScriptDecodeErrorZ {
1330 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1331 err: Box::into_raw(Box::new(e)),
1337 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1338 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1339 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1340 fn drop(&mut self) {
1342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1343 let _ = unsafe { Box::from_raw(self.contents.result) };
1346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1347 let _ = unsafe { Box::from_raw(self.contents.err) };
1352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1353 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1354 let contents = if o.result_ok {
1355 let result = unsafe { o.contents.result };
1356 unsafe { o.contents.result = std::ptr::null_mut() };
1357 CResult_ShutdownScriptDecodeErrorZPtr { result }
1359 let err = unsafe { o.contents.err };
1360 unsafe { o.contents.err = std::ptr::null_mut(); }
1361 CResult_ShutdownScriptDecodeErrorZPtr { err }
1365 result_ok: o.result_ok,
1369 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1370 fn clone(&self) -> Self {
1372 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1373 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1376 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1377 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1383 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1384 /// but with all dynamically-allocated buffers duplicated in new buffers.
1385 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1387 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1388 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1389 /// A pointer to the contents in the success state.
1390 /// Reading from this pointer when `result_ok` is not set is undefined.
1391 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1392 /// A pointer to the contents in the error state.
1393 /// Reading from this pointer when `result_ok` is set is undefined.
1394 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1397 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1398 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1400 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1401 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1402 /// `err` or `result` depending on the state of `result_ok`.
1403 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1404 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1405 pub result_ok: bool,
1408 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1409 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1410 CResult_ShutdownScriptInvalidShutdownScriptZ {
1411 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1412 result: Box::into_raw(Box::new(o)),
1418 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1419 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1420 CResult_ShutdownScriptInvalidShutdownScriptZ {
1421 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1422 err: Box::into_raw(Box::new(e)),
1428 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1429 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1430 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1431 fn drop(&mut self) {
1433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1434 let _ = unsafe { Box::from_raw(self.contents.result) };
1437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1438 let _ = unsafe { Box::from_raw(self.contents.err) };
1443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1444 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1445 let contents = if o.result_ok {
1446 let result = unsafe { o.contents.result };
1447 unsafe { o.contents.result = std::ptr::null_mut() };
1448 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1450 let err = unsafe { o.contents.err };
1451 unsafe { o.contents.err = std::ptr::null_mut(); }
1452 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1456 result_ok: o.result_ok,
1461 /// The contents of CResult_NoneErrorZ
1462 pub union CResult_NoneErrorZPtr {
1463 /// Note that this value is always NULL, as there are no contents in the OK variant
1464 pub result: *mut std::ffi::c_void,
1465 /// A pointer to the contents in the error state.
1466 /// Reading from this pointer when `result_ok` is set is undefined.
1467 pub err: *mut crate::c_types::IOError,
1470 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1471 /// containing a () on success and a crate::c_types::IOError on failure.
1472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1473 pub struct CResult_NoneErrorZ {
1474 /// The contents of this CResult_NoneErrorZ, accessible via either
1475 /// `err` or `result` depending on the state of `result_ok`.
1476 pub contents: CResult_NoneErrorZPtr,
1477 /// Whether this CResult_NoneErrorZ represents a success state.
1478 pub result_ok: bool,
1481 /// Creates a new CResult_NoneErrorZ in the success state.
1482 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1483 CResult_NoneErrorZ {
1484 contents: CResult_NoneErrorZPtr {
1485 result: std::ptr::null_mut(),
1491 /// Creates a new CResult_NoneErrorZ in the error state.
1492 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1493 CResult_NoneErrorZ {
1494 contents: CResult_NoneErrorZPtr {
1495 err: Box::into_raw(Box::new(e)),
1501 /// Frees any resources used by the CResult_NoneErrorZ.
1502 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1503 impl Drop for CResult_NoneErrorZ {
1504 fn drop(&mut self) {
1507 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1508 let _ = unsafe { Box::from_raw(self.contents.err) };
1513 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1514 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1515 let contents = if o.result_ok {
1516 let _ = unsafe { Box::from_raw(o.contents.result) };
1517 o.contents.result = std::ptr::null_mut();
1518 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1520 let err = unsafe { o.contents.err };
1521 unsafe { o.contents.err = std::ptr::null_mut(); }
1522 CResult_NoneErrorZPtr { err }
1526 result_ok: o.result_ok,
1530 impl Clone for CResult_NoneErrorZ {
1531 fn clone(&self) -> Self {
1533 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1534 result: std::ptr::null_mut()
1537 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1538 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1544 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1545 /// but with all dynamically-allocated buffers duplicated in new buffers.
1546 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1548 /// The contents of CResult_RouteHopDecodeErrorZ
1549 pub union CResult_RouteHopDecodeErrorZPtr {
1550 /// A pointer to the contents in the success state.
1551 /// Reading from this pointer when `result_ok` is not set is undefined.
1552 pub result: *mut crate::lightning::routing::router::RouteHop,
1553 /// A pointer to the contents in the error state.
1554 /// Reading from this pointer when `result_ok` is set is undefined.
1555 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1558 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1559 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1561 pub struct CResult_RouteHopDecodeErrorZ {
1562 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1563 /// `err` or `result` depending on the state of `result_ok`.
1564 pub contents: CResult_RouteHopDecodeErrorZPtr,
1565 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1566 pub result_ok: bool,
1569 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1570 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1571 CResult_RouteHopDecodeErrorZ {
1572 contents: CResult_RouteHopDecodeErrorZPtr {
1573 result: Box::into_raw(Box::new(o)),
1579 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1580 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1581 CResult_RouteHopDecodeErrorZ {
1582 contents: CResult_RouteHopDecodeErrorZPtr {
1583 err: Box::into_raw(Box::new(e)),
1589 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1590 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1591 impl Drop for CResult_RouteHopDecodeErrorZ {
1592 fn drop(&mut self) {
1594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1595 let _ = unsafe { Box::from_raw(self.contents.result) };
1598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1599 let _ = unsafe { Box::from_raw(self.contents.err) };
1604 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1606 let contents = if o.result_ok {
1607 let result = unsafe { o.contents.result };
1608 unsafe { o.contents.result = std::ptr::null_mut() };
1609 CResult_RouteHopDecodeErrorZPtr { result }
1611 let err = unsafe { o.contents.err };
1612 unsafe { o.contents.err = std::ptr::null_mut(); }
1613 CResult_RouteHopDecodeErrorZPtr { err }
1617 result_ok: o.result_ok,
1621 impl Clone for CResult_RouteHopDecodeErrorZ {
1622 fn clone(&self) -> Self {
1624 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1625 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1628 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1635 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1636 /// but with all dynamically-allocated buffers duplicated in new buffers.
1637 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1639 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1640 /// This corresponds to std::vector in C++
1641 pub struct CVec_RouteHopZ {
1642 /// The elements in the array.
1643 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1644 pub data: *mut crate::lightning::routing::router::RouteHop,
1645 /// The number of elements pointed to by `data`.
1648 impl CVec_RouteHopZ {
1649 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1650 if self.datalen == 0 { return Vec::new(); }
1651 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1652 self.data = std::ptr::null_mut();
1656 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1657 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1660 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1661 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1662 let datalen = v.len();
1663 let data = Box::into_raw(v.into_boxed_slice());
1664 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1668 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1669 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1670 impl Drop for CVec_RouteHopZ {
1671 fn drop(&mut self) {
1672 if self.datalen == 0 { return; }
1673 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1676 impl Clone for CVec_RouteHopZ {
1677 fn clone(&self) -> Self {
1678 let mut res = Vec::new();
1679 if self.datalen == 0 { return Self::from(res); }
1680 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1685 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1686 /// This corresponds to std::vector in C++
1687 pub struct CVec_CVec_RouteHopZZ {
1688 /// The elements in the array.
1689 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1690 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1691 /// The number of elements pointed to by `data`.
1694 impl CVec_CVec_RouteHopZZ {
1695 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1696 if self.datalen == 0 { return Vec::new(); }
1697 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1698 self.data = std::ptr::null_mut();
1702 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1703 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1706 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1707 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1708 let datalen = v.len();
1709 let data = Box::into_raw(v.into_boxed_slice());
1710 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1714 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1715 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1716 impl Drop for CVec_CVec_RouteHopZZ {
1717 fn drop(&mut self) {
1718 if self.datalen == 0 { return; }
1719 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1722 impl Clone for CVec_CVec_RouteHopZZ {
1723 fn clone(&self) -> Self {
1724 let mut res = Vec::new();
1725 if self.datalen == 0 { return Self::from(res); }
1726 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1731 /// The contents of CResult_RouteDecodeErrorZ
1732 pub union CResult_RouteDecodeErrorZPtr {
1733 /// A pointer to the contents in the success state.
1734 /// Reading from this pointer when `result_ok` is not set is undefined.
1735 pub result: *mut crate::lightning::routing::router::Route,
1736 /// A pointer to the contents in the error state.
1737 /// Reading from this pointer when `result_ok` is set is undefined.
1738 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1741 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1742 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1744 pub struct CResult_RouteDecodeErrorZ {
1745 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1746 /// `err` or `result` depending on the state of `result_ok`.
1747 pub contents: CResult_RouteDecodeErrorZPtr,
1748 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1749 pub result_ok: bool,
1752 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1753 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1754 CResult_RouteDecodeErrorZ {
1755 contents: CResult_RouteDecodeErrorZPtr {
1756 result: Box::into_raw(Box::new(o)),
1762 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1763 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1764 CResult_RouteDecodeErrorZ {
1765 contents: CResult_RouteDecodeErrorZPtr {
1766 err: Box::into_raw(Box::new(e)),
1772 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1773 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1774 impl Drop for CResult_RouteDecodeErrorZ {
1775 fn drop(&mut self) {
1777 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1778 let _ = unsafe { Box::from_raw(self.contents.result) };
1781 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1782 let _ = unsafe { Box::from_raw(self.contents.err) };
1787 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1788 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1789 let contents = if o.result_ok {
1790 let result = unsafe { o.contents.result };
1791 unsafe { o.contents.result = std::ptr::null_mut() };
1792 CResult_RouteDecodeErrorZPtr { result }
1794 let err = unsafe { o.contents.err };
1795 unsafe { o.contents.err = std::ptr::null_mut(); }
1796 CResult_RouteDecodeErrorZPtr { err }
1800 result_ok: o.result_ok,
1804 impl Clone for CResult_RouteDecodeErrorZ {
1805 fn clone(&self) -> Self {
1807 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1808 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1811 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1812 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1818 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1819 /// but with all dynamically-allocated buffers duplicated in new buffers.
1820 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1822 /// The contents of CResult_RouteParametersDecodeErrorZ
1823 pub union CResult_RouteParametersDecodeErrorZPtr {
1824 /// A pointer to the contents in the success state.
1825 /// Reading from this pointer when `result_ok` is not set is undefined.
1826 pub result: *mut crate::lightning::routing::router::RouteParameters,
1827 /// A pointer to the contents in the error state.
1828 /// Reading from this pointer when `result_ok` is set is undefined.
1829 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1832 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1833 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1835 pub struct CResult_RouteParametersDecodeErrorZ {
1836 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1837 /// `err` or `result` depending on the state of `result_ok`.
1838 pub contents: CResult_RouteParametersDecodeErrorZPtr,
1839 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1840 pub result_ok: bool,
1843 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1844 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1845 CResult_RouteParametersDecodeErrorZ {
1846 contents: CResult_RouteParametersDecodeErrorZPtr {
1847 result: Box::into_raw(Box::new(o)),
1853 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
1854 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
1855 CResult_RouteParametersDecodeErrorZ {
1856 contents: CResult_RouteParametersDecodeErrorZPtr {
1857 err: Box::into_raw(Box::new(e)),
1863 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
1864 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
1865 impl Drop for CResult_RouteParametersDecodeErrorZ {
1866 fn drop(&mut self) {
1868 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1869 let _ = unsafe { Box::from_raw(self.contents.result) };
1872 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1873 let _ = unsafe { Box::from_raw(self.contents.err) };
1878 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
1879 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1880 let contents = if o.result_ok {
1881 let result = unsafe { o.contents.result };
1882 unsafe { o.contents.result = std::ptr::null_mut() };
1883 CResult_RouteParametersDecodeErrorZPtr { result }
1885 let err = unsafe { o.contents.err };
1886 unsafe { o.contents.err = std::ptr::null_mut(); }
1887 CResult_RouteParametersDecodeErrorZPtr { err }
1891 result_ok: o.result_ok,
1895 impl Clone for CResult_RouteParametersDecodeErrorZ {
1896 fn clone(&self) -> Self {
1898 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
1899 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
1902 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
1903 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1909 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
1910 /// but with all dynamically-allocated buffers duplicated in new buffers.
1911 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
1913 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1914 /// This corresponds to std::vector in C++
1915 pub struct CVec_RouteHintZ {
1916 /// The elements in the array.
1917 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1918 pub data: *mut crate::lightning::routing::router::RouteHint,
1919 /// The number of elements pointed to by `data`.
1922 impl CVec_RouteHintZ {
1923 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1924 if self.datalen == 0 { return Vec::new(); }
1925 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1926 self.data = std::ptr::null_mut();
1930 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1931 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1934 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1935 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1936 let datalen = v.len();
1937 let data = Box::into_raw(v.into_boxed_slice());
1938 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1942 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1943 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1944 impl Drop for CVec_RouteHintZ {
1945 fn drop(&mut self) {
1946 if self.datalen == 0 { return; }
1947 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1950 impl Clone for CVec_RouteHintZ {
1951 fn clone(&self) -> Self {
1952 let mut res = Vec::new();
1953 if self.datalen == 0 { return Self::from(res); }
1954 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1960 /// An enum which can either contain a u64 or not
1961 pub enum COption_u64Z {
1962 /// When we're in this state, this COption_u64Z contains a u64
1964 /// When we're in this state, this COption_u64Z contains nothing
1968 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1969 if let Self::Some(_) = self { true } else { false }
1971 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1974 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1975 if let Self::Some(v) = self { v } else { unreachable!() }
1979 /// Constructs a new COption_u64Z containing a u64
1980 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1981 COption_u64Z::Some(o)
1984 /// Constructs a new COption_u64Z containing nothing
1985 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1989 /// Frees any resources associated with the u64, if we are in the Some state
1990 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1992 /// Creates a new COption_u64Z which has the same data as `orig`
1993 /// but with all dynamically-allocated buffers duplicated in new buffers.
1994 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
1996 /// The contents of CResult_PayeeDecodeErrorZ
1997 pub union CResult_PayeeDecodeErrorZPtr {
1998 /// A pointer to the contents in the success state.
1999 /// Reading from this pointer when `result_ok` is not set is undefined.
2000 pub result: *mut crate::lightning::routing::router::Payee,
2001 /// A pointer to the contents in the error state.
2002 /// Reading from this pointer when `result_ok` is set is undefined.
2003 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2006 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2007 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2008 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2009 pub struct CResult_PayeeDecodeErrorZ {
2010 /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2011 /// `err` or `result` depending on the state of `result_ok`.
2012 pub contents: CResult_PayeeDecodeErrorZPtr,
2013 /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2014 pub result_ok: bool,
2017 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2018 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2019 CResult_PayeeDecodeErrorZ {
2020 contents: CResult_PayeeDecodeErrorZPtr {
2021 result: Box::into_raw(Box::new(o)),
2027 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2028 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2029 CResult_PayeeDecodeErrorZ {
2030 contents: CResult_PayeeDecodeErrorZPtr {
2031 err: Box::into_raw(Box::new(e)),
2037 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2038 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2039 impl Drop for CResult_PayeeDecodeErrorZ {
2040 fn drop(&mut self) {
2042 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2043 let _ = unsafe { Box::from_raw(self.contents.result) };
2046 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2047 let _ = unsafe { Box::from_raw(self.contents.err) };
2052 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2053 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2054 let contents = if o.result_ok {
2055 let result = unsafe { o.contents.result };
2056 unsafe { o.contents.result = std::ptr::null_mut() };
2057 CResult_PayeeDecodeErrorZPtr { result }
2059 let err = unsafe { o.contents.err };
2060 unsafe { o.contents.err = std::ptr::null_mut(); }
2061 CResult_PayeeDecodeErrorZPtr { err }
2065 result_ok: o.result_ok,
2069 impl Clone for CResult_PayeeDecodeErrorZ {
2070 fn clone(&self) -> Self {
2072 Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2073 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2076 Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2077 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2083 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2084 /// but with all dynamically-allocated buffers duplicated in new buffers.
2085 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2087 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2088 /// This corresponds to std::vector in C++
2089 pub struct CVec_RouteHintHopZ {
2090 /// The elements in the array.
2091 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2092 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2093 /// The number of elements pointed to by `data`.
2096 impl CVec_RouteHintHopZ {
2097 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2098 if self.datalen == 0 { return Vec::new(); }
2099 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2100 self.data = std::ptr::null_mut();
2104 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2105 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2108 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2109 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2110 let datalen = v.len();
2111 let data = Box::into_raw(v.into_boxed_slice());
2112 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2116 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2117 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2118 impl Drop for CVec_RouteHintHopZ {
2119 fn drop(&mut self) {
2120 if self.datalen == 0 { return; }
2121 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2124 impl Clone for CVec_RouteHintHopZ {
2125 fn clone(&self) -> Self {
2126 let mut res = Vec::new();
2127 if self.datalen == 0 { return Self::from(res); }
2128 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2133 /// The contents of CResult_RouteHintDecodeErrorZ
2134 pub union CResult_RouteHintDecodeErrorZPtr {
2135 /// A pointer to the contents in the success state.
2136 /// Reading from this pointer when `result_ok` is not set is undefined.
2137 pub result: *mut crate::lightning::routing::router::RouteHint,
2138 /// A pointer to the contents in the error state.
2139 /// Reading from this pointer when `result_ok` is set is undefined.
2140 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2143 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2144 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2146 pub struct CResult_RouteHintDecodeErrorZ {
2147 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2148 /// `err` or `result` depending on the state of `result_ok`.
2149 pub contents: CResult_RouteHintDecodeErrorZPtr,
2150 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2151 pub result_ok: bool,
2154 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2155 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2156 CResult_RouteHintDecodeErrorZ {
2157 contents: CResult_RouteHintDecodeErrorZPtr {
2158 result: Box::into_raw(Box::new(o)),
2164 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2165 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2166 CResult_RouteHintDecodeErrorZ {
2167 contents: CResult_RouteHintDecodeErrorZPtr {
2168 err: Box::into_raw(Box::new(e)),
2174 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2175 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2176 impl Drop for CResult_RouteHintDecodeErrorZ {
2177 fn drop(&mut self) {
2179 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2180 let _ = unsafe { Box::from_raw(self.contents.result) };
2183 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2184 let _ = unsafe { Box::from_raw(self.contents.err) };
2189 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2190 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2191 let contents = if o.result_ok {
2192 let result = unsafe { o.contents.result };
2193 unsafe { o.contents.result = std::ptr::null_mut() };
2194 CResult_RouteHintDecodeErrorZPtr { result }
2196 let err = unsafe { o.contents.err };
2197 unsafe { o.contents.err = std::ptr::null_mut(); }
2198 CResult_RouteHintDecodeErrorZPtr { err }
2202 result_ok: o.result_ok,
2206 impl Clone for CResult_RouteHintDecodeErrorZ {
2207 fn clone(&self) -> Self {
2209 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2210 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2213 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2214 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2220 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2221 /// but with all dynamically-allocated buffers duplicated in new buffers.
2222 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2224 /// The contents of CResult_RouteHintHopDecodeErrorZ
2225 pub union CResult_RouteHintHopDecodeErrorZPtr {
2226 /// A pointer to the contents in the success state.
2227 /// Reading from this pointer when `result_ok` is not set is undefined.
2228 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2229 /// A pointer to the contents in the error state.
2230 /// Reading from this pointer when `result_ok` is set is undefined.
2231 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2234 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2235 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2237 pub struct CResult_RouteHintHopDecodeErrorZ {
2238 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2239 /// `err` or `result` depending on the state of `result_ok`.
2240 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2241 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2242 pub result_ok: bool,
2245 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2246 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2247 CResult_RouteHintHopDecodeErrorZ {
2248 contents: CResult_RouteHintHopDecodeErrorZPtr {
2249 result: Box::into_raw(Box::new(o)),
2255 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2256 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2257 CResult_RouteHintHopDecodeErrorZ {
2258 contents: CResult_RouteHintHopDecodeErrorZPtr {
2259 err: Box::into_raw(Box::new(e)),
2265 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2266 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2267 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2268 fn drop(&mut self) {
2270 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2271 let _ = unsafe { Box::from_raw(self.contents.result) };
2274 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2275 let _ = unsafe { Box::from_raw(self.contents.err) };
2280 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2281 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2282 let contents = if o.result_ok {
2283 let result = unsafe { o.contents.result };
2284 unsafe { o.contents.result = std::ptr::null_mut() };
2285 CResult_RouteHintHopDecodeErrorZPtr { result }
2287 let err = unsafe { o.contents.err };
2288 unsafe { o.contents.err = std::ptr::null_mut(); }
2289 CResult_RouteHintHopDecodeErrorZPtr { err }
2293 result_ok: o.result_ok,
2297 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2298 fn clone(&self) -> Self {
2300 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2301 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2304 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2305 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2311 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2312 /// but with all dynamically-allocated buffers duplicated in new buffers.
2313 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2315 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2316 /// This corresponds to std::vector in C++
2317 pub struct CVec_ChannelDetailsZ {
2318 /// The elements in the array.
2319 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2320 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2321 /// The number of elements pointed to by `data`.
2324 impl CVec_ChannelDetailsZ {
2325 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2326 if self.datalen == 0 { return Vec::new(); }
2327 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2328 self.data = std::ptr::null_mut();
2332 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2333 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2336 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2337 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2338 let datalen = v.len();
2339 let data = Box::into_raw(v.into_boxed_slice());
2340 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2344 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2345 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2346 impl Drop for CVec_ChannelDetailsZ {
2347 fn drop(&mut self) {
2348 if self.datalen == 0 { return; }
2349 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2352 impl Clone for CVec_ChannelDetailsZ {
2353 fn clone(&self) -> Self {
2354 let mut res = Vec::new();
2355 if self.datalen == 0 { return Self::from(res); }
2356 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2361 /// The contents of CResult_RouteLightningErrorZ
2362 pub union CResult_RouteLightningErrorZPtr {
2363 /// A pointer to the contents in the success state.
2364 /// Reading from this pointer when `result_ok` is not set is undefined.
2365 pub result: *mut crate::lightning::routing::router::Route,
2366 /// A pointer to the contents in the error state.
2367 /// Reading from this pointer when `result_ok` is set is undefined.
2368 pub err: *mut crate::lightning::ln::msgs::LightningError,
2371 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2372 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2374 pub struct CResult_RouteLightningErrorZ {
2375 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2376 /// `err` or `result` depending on the state of `result_ok`.
2377 pub contents: CResult_RouteLightningErrorZPtr,
2378 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2379 pub result_ok: bool,
2382 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2383 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2384 CResult_RouteLightningErrorZ {
2385 contents: CResult_RouteLightningErrorZPtr {
2386 result: Box::into_raw(Box::new(o)),
2392 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2393 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2394 CResult_RouteLightningErrorZ {
2395 contents: CResult_RouteLightningErrorZPtr {
2396 err: Box::into_raw(Box::new(e)),
2402 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2403 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2404 impl Drop for CResult_RouteLightningErrorZ {
2405 fn drop(&mut self) {
2407 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2408 let _ = unsafe { Box::from_raw(self.contents.result) };
2411 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2412 let _ = unsafe { Box::from_raw(self.contents.err) };
2417 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2418 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2419 let contents = if o.result_ok {
2420 let result = unsafe { o.contents.result };
2421 unsafe { o.contents.result = std::ptr::null_mut() };
2422 CResult_RouteLightningErrorZPtr { result }
2424 let err = unsafe { o.contents.err };
2425 unsafe { o.contents.err = std::ptr::null_mut(); }
2426 CResult_RouteLightningErrorZPtr { err }
2430 result_ok: o.result_ok,
2434 impl Clone for CResult_RouteLightningErrorZ {
2435 fn clone(&self) -> Self {
2437 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2438 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2441 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2442 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2448 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2449 /// but with all dynamically-allocated buffers duplicated in new buffers.
2450 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2452 /// The contents of CResult_TxOutAccessErrorZ
2453 pub union CResult_TxOutAccessErrorZPtr {
2454 /// A pointer to the contents in the success state.
2455 /// Reading from this pointer when `result_ok` is not set is undefined.
2456 pub result: *mut crate::c_types::TxOut,
2457 /// A pointer to the contents in the error state.
2458 /// Reading from this pointer when `result_ok` is set is undefined.
2459 pub err: *mut crate::lightning::chain::AccessError,
2462 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2463 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2465 pub struct CResult_TxOutAccessErrorZ {
2466 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2467 /// `err` or `result` depending on the state of `result_ok`.
2468 pub contents: CResult_TxOutAccessErrorZPtr,
2469 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2470 pub result_ok: bool,
2473 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2474 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2475 CResult_TxOutAccessErrorZ {
2476 contents: CResult_TxOutAccessErrorZPtr {
2477 result: Box::into_raw(Box::new(o)),
2483 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2484 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2485 CResult_TxOutAccessErrorZ {
2486 contents: CResult_TxOutAccessErrorZPtr {
2487 err: Box::into_raw(Box::new(e)),
2493 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2494 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2495 impl Drop for CResult_TxOutAccessErrorZ {
2496 fn drop(&mut self) {
2498 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2499 let _ = unsafe { Box::from_raw(self.contents.result) };
2502 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2503 let _ = unsafe { Box::from_raw(self.contents.err) };
2508 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2509 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2510 let contents = if o.result_ok {
2511 let result = unsafe { o.contents.result };
2512 unsafe { o.contents.result = std::ptr::null_mut() };
2513 CResult_TxOutAccessErrorZPtr { result }
2515 let err = unsafe { o.contents.err };
2516 unsafe { o.contents.err = std::ptr::null_mut(); }
2517 CResult_TxOutAccessErrorZPtr { err }
2521 result_ok: o.result_ok,
2525 impl Clone for CResult_TxOutAccessErrorZ {
2526 fn clone(&self) -> Self {
2528 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2529 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2532 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2533 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2539 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2540 /// but with all dynamically-allocated buffers duplicated in new buffers.
2541 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2543 /// A tuple of 2 elements. See the individual fields for the types contained.
2544 pub struct C2Tuple_usizeTransactionZ {
2545 /// The element at position 0
2547 /// The element at position 1
2548 pub b: crate::c_types::Transaction,
2550 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2551 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2558 impl C2Tuple_usizeTransactionZ {
2559 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2563 impl Clone for C2Tuple_usizeTransactionZ {
2564 fn clone(&self) -> Self {
2566 a: Clone::clone(&self.a),
2567 b: Clone::clone(&self.b),
2572 /// Creates a new tuple which has the same data as `orig`
2573 /// but with all dynamically-allocated buffers duplicated in new buffers.
2574 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2575 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2577 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2578 C2Tuple_usizeTransactionZ { a, b, }
2582 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2583 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2585 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2586 /// This corresponds to std::vector in C++
2587 pub struct CVec_C2Tuple_usizeTransactionZZ {
2588 /// The elements in the array.
2589 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2590 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2591 /// The number of elements pointed to by `data`.
2594 impl CVec_C2Tuple_usizeTransactionZZ {
2595 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2596 if self.datalen == 0 { return Vec::new(); }
2597 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2598 self.data = std::ptr::null_mut();
2602 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2603 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2606 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2607 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2608 let datalen = v.len();
2609 let data = Box::into_raw(v.into_boxed_slice());
2610 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2614 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2615 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2616 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2617 fn drop(&mut self) {
2618 if self.datalen == 0 { return; }
2619 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2622 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2623 fn clone(&self) -> Self {
2624 let mut res = Vec::new();
2625 if self.datalen == 0 { return Self::from(res); }
2626 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2631 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2632 /// This corresponds to std::vector in C++
2633 pub struct CVec_TxidZ {
2634 /// The elements in the array.
2635 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2636 pub data: *mut crate::c_types::ThirtyTwoBytes,
2637 /// The number of elements pointed to by `data`.
2641 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2642 if self.datalen == 0 { return Vec::new(); }
2643 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2644 self.data = std::ptr::null_mut();
2648 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2649 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2652 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2653 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2654 let datalen = v.len();
2655 let data = Box::into_raw(v.into_boxed_slice());
2656 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2660 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2661 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2662 impl Drop for CVec_TxidZ {
2663 fn drop(&mut self) {
2664 if self.datalen == 0 { return; }
2665 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2668 impl Clone for CVec_TxidZ {
2669 fn clone(&self) -> Self {
2670 let mut res = Vec::new();
2671 if self.datalen == 0 { return Self::from(res); }
2672 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2677 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2678 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2679 /// Note that this value is always NULL, as there are no contents in the OK variant
2680 pub result: *mut std::ffi::c_void,
2681 /// A pointer to the contents in the error state.
2682 /// Reading from this pointer when `result_ok` is set is undefined.
2683 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2686 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2687 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2689 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2690 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2691 /// `err` or `result` depending on the state of `result_ok`.
2692 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2693 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2694 pub result_ok: bool,
2697 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2698 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2699 CResult_NoneChannelMonitorUpdateErrZ {
2700 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2701 result: std::ptr::null_mut(),
2707 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2708 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2709 CResult_NoneChannelMonitorUpdateErrZ {
2710 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2711 err: Box::into_raw(Box::new(e)),
2717 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2718 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2719 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2720 fn drop(&mut self) {
2723 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2724 let _ = unsafe { Box::from_raw(self.contents.err) };
2729 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2730 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2731 let contents = if o.result_ok {
2732 let _ = unsafe { Box::from_raw(o.contents.result) };
2733 o.contents.result = std::ptr::null_mut();
2734 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2736 let err = unsafe { o.contents.err };
2737 unsafe { o.contents.err = std::ptr::null_mut(); }
2738 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2742 result_ok: o.result_ok,
2746 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2747 fn clone(&self) -> Self {
2749 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2750 result: std::ptr::null_mut()
2753 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2754 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2760 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2761 /// but with all dynamically-allocated buffers duplicated in new buffers.
2762 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2764 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2765 /// This corresponds to std::vector in C++
2766 pub struct CVec_MonitorEventZ {
2767 /// The elements in the array.
2768 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2769 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2770 /// The number of elements pointed to by `data`.
2773 impl CVec_MonitorEventZ {
2774 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2775 if self.datalen == 0 { return Vec::new(); }
2776 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2777 self.data = std::ptr::null_mut();
2781 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2782 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2785 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2786 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2787 let datalen = v.len();
2788 let data = Box::into_raw(v.into_boxed_slice());
2789 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2793 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2794 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2795 impl Drop for CVec_MonitorEventZ {
2796 fn drop(&mut self) {
2797 if self.datalen == 0 { return; }
2798 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2801 impl Clone for CVec_MonitorEventZ {
2802 fn clone(&self) -> Self {
2803 let mut res = Vec::new();
2804 if self.datalen == 0 { return Self::from(res); }
2805 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2811 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2812 pub enum COption_C2Tuple_usizeTransactionZZ {
2813 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2814 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2815 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2818 impl COption_C2Tuple_usizeTransactionZZ {
2819 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2820 if let Self::Some(_) = self { true } else { false }
2822 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2825 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2826 if let Self::Some(v) = self { v } else { unreachable!() }
2830 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2831 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2832 COption_C2Tuple_usizeTransactionZZ::Some(o)
2835 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2836 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2837 COption_C2Tuple_usizeTransactionZZ::None
2840 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2841 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2843 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2844 /// but with all dynamically-allocated buffers duplicated in new buffers.
2845 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
2848 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2849 pub enum COption_NetworkUpdateZ {
2850 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2851 Some(crate::lightning::routing::network_graph::NetworkUpdate),
2852 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
2855 impl COption_NetworkUpdateZ {
2856 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2857 if let Self::Some(_) = self { true } else { false }
2859 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2862 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
2863 if let Self::Some(v) = self { v } else { unreachable!() }
2867 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
2868 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
2869 COption_NetworkUpdateZ::Some(o)
2872 /// Constructs a new COption_NetworkUpdateZ containing nothing
2873 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
2874 COption_NetworkUpdateZ::None
2877 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
2878 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
2880 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
2881 /// but with all dynamically-allocated buffers duplicated in new buffers.
2882 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
2884 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2885 /// This corresponds to std::vector in C++
2886 pub struct CVec_SpendableOutputDescriptorZ {
2887 /// The elements in the array.
2888 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2889 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2890 /// The number of elements pointed to by `data`.
2893 impl CVec_SpendableOutputDescriptorZ {
2894 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2895 if self.datalen == 0 { return Vec::new(); }
2896 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2897 self.data = std::ptr::null_mut();
2901 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2902 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2905 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2906 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2907 let datalen = v.len();
2908 let data = Box::into_raw(v.into_boxed_slice());
2909 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2913 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2914 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2915 impl Drop for CVec_SpendableOutputDescriptorZ {
2916 fn drop(&mut self) {
2917 if self.datalen == 0 { return; }
2918 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2921 impl Clone for CVec_SpendableOutputDescriptorZ {
2922 fn clone(&self) -> Self {
2923 let mut res = Vec::new();
2924 if self.datalen == 0 { return Self::from(res); }
2925 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2930 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2931 /// This corresponds to std::vector in C++
2932 pub struct CVec_MessageSendEventZ {
2933 /// The elements in the array.
2934 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2935 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2936 /// The number of elements pointed to by `data`.
2939 impl CVec_MessageSendEventZ {
2940 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2941 if self.datalen == 0 { return Vec::new(); }
2942 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2943 self.data = std::ptr::null_mut();
2947 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2948 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2951 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2952 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2953 let datalen = v.len();
2954 let data = Box::into_raw(v.into_boxed_slice());
2955 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2959 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2960 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2961 impl Drop for CVec_MessageSendEventZ {
2962 fn drop(&mut self) {
2963 if self.datalen == 0 { return; }
2964 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2967 impl Clone for CVec_MessageSendEventZ {
2968 fn clone(&self) -> Self {
2969 let mut res = Vec::new();
2970 if self.datalen == 0 { return Self::from(res); }
2971 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2976 /// The contents of CResult_InitFeaturesDecodeErrorZ
2977 pub union CResult_InitFeaturesDecodeErrorZPtr {
2978 /// A pointer to the contents in the success state.
2979 /// Reading from this pointer when `result_ok` is not set is undefined.
2980 pub result: *mut crate::lightning::ln::features::InitFeatures,
2981 /// A pointer to the contents in the error state.
2982 /// Reading from this pointer when `result_ok` is set is undefined.
2983 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2986 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2987 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2988 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2989 pub struct CResult_InitFeaturesDecodeErrorZ {
2990 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2991 /// `err` or `result` depending on the state of `result_ok`.
2992 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2993 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2994 pub result_ok: bool,
2997 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2998 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2999 CResult_InitFeaturesDecodeErrorZ {
3000 contents: CResult_InitFeaturesDecodeErrorZPtr {
3001 result: Box::into_raw(Box::new(o)),
3007 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3008 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3009 CResult_InitFeaturesDecodeErrorZ {
3010 contents: CResult_InitFeaturesDecodeErrorZPtr {
3011 err: Box::into_raw(Box::new(e)),
3017 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3018 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3019 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3020 fn drop(&mut self) {
3022 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3023 let _ = unsafe { Box::from_raw(self.contents.result) };
3026 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3027 let _ = unsafe { Box::from_raw(self.contents.err) };
3032 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3033 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3034 let contents = if o.result_ok {
3035 let result = unsafe { o.contents.result };
3036 unsafe { o.contents.result = std::ptr::null_mut() };
3037 CResult_InitFeaturesDecodeErrorZPtr { result }
3039 let err = unsafe { o.contents.err };
3040 unsafe { o.contents.err = std::ptr::null_mut(); }
3041 CResult_InitFeaturesDecodeErrorZPtr { err }
3045 result_ok: o.result_ok,
3050 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3051 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3052 /// A pointer to the contents in the success state.
3053 /// Reading from this pointer when `result_ok` is not set is undefined.
3054 pub result: *mut crate::lightning::ln::features::NodeFeatures,
3055 /// A pointer to the contents in the error state.
3056 /// Reading from this pointer when `result_ok` is set is undefined.
3057 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3060 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3061 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3062 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3063 pub struct CResult_NodeFeaturesDecodeErrorZ {
3064 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3065 /// `err` or `result` depending on the state of `result_ok`.
3066 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3067 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3068 pub result_ok: bool,
3071 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3072 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3073 CResult_NodeFeaturesDecodeErrorZ {
3074 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3075 result: Box::into_raw(Box::new(o)),
3081 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3082 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3083 CResult_NodeFeaturesDecodeErrorZ {
3084 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3085 err: Box::into_raw(Box::new(e)),
3091 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3092 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3093 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3094 fn drop(&mut self) {
3096 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3097 let _ = unsafe { Box::from_raw(self.contents.result) };
3100 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3101 let _ = unsafe { Box::from_raw(self.contents.err) };
3106 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3107 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3108 let contents = if o.result_ok {
3109 let result = unsafe { o.contents.result };
3110 unsafe { o.contents.result = std::ptr::null_mut() };
3111 CResult_NodeFeaturesDecodeErrorZPtr { result }
3113 let err = unsafe { o.contents.err };
3114 unsafe { o.contents.err = std::ptr::null_mut(); }
3115 CResult_NodeFeaturesDecodeErrorZPtr { err }
3119 result_ok: o.result_ok,
3124 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3125 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3126 /// A pointer to the contents in the success state.
3127 /// Reading from this pointer when `result_ok` is not set is undefined.
3128 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3129 /// A pointer to the contents in the error state.
3130 /// Reading from this pointer when `result_ok` is set is undefined.
3131 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3134 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3135 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3137 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3138 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3139 /// `err` or `result` depending on the state of `result_ok`.
3140 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3141 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3142 pub result_ok: bool,
3145 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3146 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3147 CResult_ChannelFeaturesDecodeErrorZ {
3148 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3149 result: Box::into_raw(Box::new(o)),
3155 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3156 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3157 CResult_ChannelFeaturesDecodeErrorZ {
3158 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3159 err: Box::into_raw(Box::new(e)),
3165 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3166 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3167 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3168 fn drop(&mut self) {
3170 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3171 let _ = unsafe { Box::from_raw(self.contents.result) };
3174 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3175 let _ = unsafe { Box::from_raw(self.contents.err) };
3180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3181 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3182 let contents = if o.result_ok {
3183 let result = unsafe { o.contents.result };
3184 unsafe { o.contents.result = std::ptr::null_mut() };
3185 CResult_ChannelFeaturesDecodeErrorZPtr { result }
3187 let err = unsafe { o.contents.err };
3188 unsafe { o.contents.err = std::ptr::null_mut(); }
3189 CResult_ChannelFeaturesDecodeErrorZPtr { err }
3193 result_ok: o.result_ok,
3198 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3199 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3200 /// A pointer to the contents in the success state.
3201 /// Reading from this pointer when `result_ok` is not set is undefined.
3202 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3203 /// A pointer to the contents in the error state.
3204 /// Reading from this pointer when `result_ok` is set is undefined.
3205 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3208 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3209 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3211 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3212 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3213 /// `err` or `result` depending on the state of `result_ok`.
3214 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3215 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3216 pub result_ok: bool,
3219 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3220 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3221 CResult_InvoiceFeaturesDecodeErrorZ {
3222 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3223 result: Box::into_raw(Box::new(o)),
3229 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3230 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3231 CResult_InvoiceFeaturesDecodeErrorZ {
3232 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3233 err: Box::into_raw(Box::new(e)),
3239 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3240 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3241 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3242 fn drop(&mut self) {
3244 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3245 let _ = unsafe { Box::from_raw(self.contents.result) };
3248 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3249 let _ = unsafe { Box::from_raw(self.contents.err) };
3254 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3255 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3256 let contents = if o.result_ok {
3257 let result = unsafe { o.contents.result };
3258 unsafe { o.contents.result = std::ptr::null_mut() };
3259 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3261 let err = unsafe { o.contents.err };
3262 unsafe { o.contents.err = std::ptr::null_mut(); }
3263 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3267 result_ok: o.result_ok,
3272 /// The contents of CResult_ScoringParametersDecodeErrorZ
3273 pub union CResult_ScoringParametersDecodeErrorZPtr {
3274 /// A pointer to the contents in the success state.
3275 /// Reading from this pointer when `result_ok` is not set is undefined.
3276 pub result: *mut crate::lightning::routing::scorer::ScoringParameters,
3277 /// A pointer to the contents in the error state.
3278 /// Reading from this pointer when `result_ok` is set is undefined.
3279 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3282 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3283 /// containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3285 pub struct CResult_ScoringParametersDecodeErrorZ {
3286 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3287 /// `err` or `result` depending on the state of `result_ok`.
3288 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3289 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3290 pub result_ok: bool,
3293 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3294 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scorer::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3295 CResult_ScoringParametersDecodeErrorZ {
3296 contents: CResult_ScoringParametersDecodeErrorZPtr {
3297 result: Box::into_raw(Box::new(o)),
3303 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3304 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3305 CResult_ScoringParametersDecodeErrorZ {
3306 contents: CResult_ScoringParametersDecodeErrorZPtr {
3307 err: Box::into_raw(Box::new(e)),
3313 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3314 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3315 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3316 fn drop(&mut self) {
3318 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3319 let _ = unsafe { Box::from_raw(self.contents.result) };
3322 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3323 let _ = unsafe { Box::from_raw(self.contents.err) };
3328 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3329 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3330 let contents = if o.result_ok {
3331 let result = unsafe { o.contents.result };
3332 unsafe { o.contents.result = std::ptr::null_mut() };
3333 CResult_ScoringParametersDecodeErrorZPtr { result }
3335 let err = unsafe { o.contents.err };
3336 unsafe { o.contents.err = std::ptr::null_mut(); }
3337 CResult_ScoringParametersDecodeErrorZPtr { err }
3341 result_ok: o.result_ok,
3346 /// The contents of CResult_ScorerDecodeErrorZ
3347 pub union CResult_ScorerDecodeErrorZPtr {
3348 /// A pointer to the contents in the success state.
3349 /// Reading from this pointer when `result_ok` is not set is undefined.
3350 pub result: *mut crate::lightning::routing::scorer::Scorer,
3351 /// A pointer to the contents in the error state.
3352 /// Reading from this pointer when `result_ok` is set is undefined.
3353 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3356 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3357 /// containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3359 pub struct CResult_ScorerDecodeErrorZ {
3360 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3361 /// `err` or `result` depending on the state of `result_ok`.
3362 pub contents: CResult_ScorerDecodeErrorZPtr,
3363 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3364 pub result_ok: bool,
3367 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3368 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scorer::Scorer) -> CResult_ScorerDecodeErrorZ {
3369 CResult_ScorerDecodeErrorZ {
3370 contents: CResult_ScorerDecodeErrorZPtr {
3371 result: Box::into_raw(Box::new(o)),
3377 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3378 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3379 CResult_ScorerDecodeErrorZ {
3380 contents: CResult_ScorerDecodeErrorZPtr {
3381 err: Box::into_raw(Box::new(e)),
3387 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3388 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3389 impl Drop for CResult_ScorerDecodeErrorZ {
3390 fn drop(&mut self) {
3392 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3393 let _ = unsafe { Box::from_raw(self.contents.result) };
3396 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3397 let _ = unsafe { Box::from_raw(self.contents.err) };
3402 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3403 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3404 let contents = if o.result_ok {
3405 let result = unsafe { o.contents.result };
3406 unsafe { o.contents.result = std::ptr::null_mut() };
3407 CResult_ScorerDecodeErrorZPtr { result }
3409 let err = unsafe { o.contents.err };
3410 unsafe { o.contents.err = std::ptr::null_mut(); }
3411 CResult_ScorerDecodeErrorZPtr { err }
3415 result_ok: o.result_ok,
3420 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3421 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3422 /// A pointer to the contents in the success state.
3423 /// Reading from this pointer when `result_ok` is not set is undefined.
3424 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3425 /// A pointer to the contents in the error state.
3426 /// Reading from this pointer when `result_ok` is set is undefined.
3427 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3430 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3431 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3432 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3433 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3434 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3435 /// `err` or `result` depending on the state of `result_ok`.
3436 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3437 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3438 pub result_ok: bool,
3441 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
3442 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3443 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3444 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3445 result: Box::into_raw(Box::new(o)),
3451 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
3452 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3453 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3454 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3455 err: Box::into_raw(Box::new(e)),
3461 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
3462 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
3463 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3464 fn drop(&mut self) {
3466 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3467 let _ = unsafe { Box::from_raw(self.contents.result) };
3470 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3471 let _ = unsafe { Box::from_raw(self.contents.err) };
3476 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3477 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3478 let contents = if o.result_ok {
3479 let result = unsafe { o.contents.result };
3480 unsafe { o.contents.result = std::ptr::null_mut() };
3481 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
3483 let err = unsafe { o.contents.err };
3484 unsafe { o.contents.err = std::ptr::null_mut(); }
3485 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
3489 result_ok: o.result_ok,
3493 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3494 fn clone(&self) -> Self {
3496 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3497 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3500 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3501 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3507 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3508 /// but with all dynamically-allocated buffers duplicated in new buffers.
3509 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3511 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3512 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3513 /// A pointer to the contents in the success state.
3514 /// Reading from this pointer when `result_ok` is not set is undefined.
3515 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
3516 /// A pointer to the contents in the error state.
3517 /// Reading from this pointer when `result_ok` is set is undefined.
3518 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3521 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3522 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3523 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3524 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3525 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3526 /// `err` or `result` depending on the state of `result_ok`.
3527 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
3528 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3529 pub result_ok: bool,
3532 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
3533 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3534 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3535 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3536 result: Box::into_raw(Box::new(o)),
3542 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
3543 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3544 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3545 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3546 err: Box::into_raw(Box::new(e)),
3552 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
3553 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
3554 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3555 fn drop(&mut self) {
3557 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3558 let _ = unsafe { Box::from_raw(self.contents.result) };
3561 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3562 let _ = unsafe { Box::from_raw(self.contents.err) };
3567 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3568 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3569 let contents = if o.result_ok {
3570 let result = unsafe { o.contents.result };
3571 unsafe { o.contents.result = std::ptr::null_mut() };
3572 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
3574 let err = unsafe { o.contents.err };
3575 unsafe { o.contents.err = std::ptr::null_mut(); }
3576 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
3580 result_ok: o.result_ok,
3584 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3585 fn clone(&self) -> Self {
3587 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3588 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3591 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3592 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3598 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3599 /// but with all dynamically-allocated buffers duplicated in new buffers.
3600 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3602 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3603 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3604 /// A pointer to the contents in the success state.
3605 /// Reading from this pointer when `result_ok` is not set is undefined.
3606 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3607 /// A pointer to the contents in the error state.
3608 /// Reading from this pointer when `result_ok` is set is undefined.
3609 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3612 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3613 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3615 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3616 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3617 /// `err` or `result` depending on the state of `result_ok`.
3618 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3619 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3620 pub result_ok: bool,
3623 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
3624 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3625 CResult_SpendableOutputDescriptorDecodeErrorZ {
3626 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3627 result: Box::into_raw(Box::new(o)),
3633 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
3634 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3635 CResult_SpendableOutputDescriptorDecodeErrorZ {
3636 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3637 err: Box::into_raw(Box::new(e)),
3643 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
3644 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3645 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3646 fn drop(&mut self) {
3648 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3649 let _ = unsafe { Box::from_raw(self.contents.result) };
3652 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3653 let _ = unsafe { Box::from_raw(self.contents.err) };
3658 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3659 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3660 let contents = if o.result_ok {
3661 let result = unsafe { o.contents.result };
3662 unsafe { o.contents.result = std::ptr::null_mut() };
3663 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3665 let err = unsafe { o.contents.err };
3666 unsafe { o.contents.err = std::ptr::null_mut(); }
3667 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3671 result_ok: o.result_ok,
3675 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3676 fn clone(&self) -> Self {
3678 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3679 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3682 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3683 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3689 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3690 /// but with all dynamically-allocated buffers duplicated in new buffers.
3691 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3693 /// The contents of CResult_NoneNoneZ
3694 pub union CResult_NoneNoneZPtr {
3695 /// Note that this value is always NULL, as there are no contents in the OK variant
3696 pub result: *mut std::ffi::c_void,
3697 /// Note that this value is always NULL, as there are no contents in the Err variant
3698 pub err: *mut std::ffi::c_void,
3701 /// A CResult_NoneNoneZ represents the result of a fallible operation,
3702 /// containing a () on success and a () on failure.
3703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3704 pub struct CResult_NoneNoneZ {
3705 /// The contents of this CResult_NoneNoneZ, accessible via either
3706 /// `err` or `result` depending on the state of `result_ok`.
3707 pub contents: CResult_NoneNoneZPtr,
3708 /// Whether this CResult_NoneNoneZ represents a success state.
3709 pub result_ok: bool,
3712 /// Creates a new CResult_NoneNoneZ in the success state.
3713 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
3715 contents: CResult_NoneNoneZPtr {
3716 result: std::ptr::null_mut(),
3722 /// Creates a new CResult_NoneNoneZ in the error state.
3723 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
3725 contents: CResult_NoneNoneZPtr {
3726 err: std::ptr::null_mut(),
3732 /// Frees any resources used by the CResult_NoneNoneZ.
3733 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
3734 impl Drop for CResult_NoneNoneZ {
3735 fn drop(&mut self) {
3741 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
3742 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
3743 let contents = if o.result_ok {
3744 let _ = unsafe { Box::from_raw(o.contents.result) };
3745 o.contents.result = std::ptr::null_mut();
3746 CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
3748 let _ = unsafe { Box::from_raw(o.contents.err) };
3749 o.contents.err = std::ptr::null_mut();
3750 CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
3754 result_ok: o.result_ok,
3758 impl Clone for CResult_NoneNoneZ {
3759 fn clone(&self) -> Self {
3761 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
3762 result: std::ptr::null_mut()
3765 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
3766 err: std::ptr::null_mut()
3772 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
3773 /// but with all dynamically-allocated buffers duplicated in new buffers.
3774 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
3776 /// A tuple of 2 elements. See the individual fields for the types contained.
3777 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3778 /// The element at position 0
3779 pub a: crate::c_types::Signature,
3780 /// The element at position 1
3781 pub b: crate::c_types::derived::CVec_SignatureZ,
3783 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3784 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3791 impl C2Tuple_SignatureCVec_SignatureZZ {
3792 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3796 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3797 fn clone(&self) -> Self {
3799 a: Clone::clone(&self.a),
3800 b: Clone::clone(&self.b),
3805 /// Creates a new tuple which has the same data as `orig`
3806 /// but with all dynamically-allocated buffers duplicated in new buffers.
3807 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
3808 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3810 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3811 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3815 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3816 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3818 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3819 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3820 /// A pointer to the contents in the success state.
3821 /// Reading from this pointer when `result_ok` is not set is undefined.
3822 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3823 /// Note that this value is always NULL, as there are no contents in the Err variant
3824 pub err: *mut std::ffi::c_void,
3827 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3828 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3829 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3830 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3831 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3832 /// `err` or `result` depending on the state of `result_ok`.
3833 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3834 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3835 pub result_ok: bool,
3838 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3839 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3840 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3841 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3842 result: Box::into_raw(Box::new(o)),
3848 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3849 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3850 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3851 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3852 err: std::ptr::null_mut(),
3858 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3859 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3860 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3861 fn drop(&mut self) {
3863 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3864 let _ = unsafe { Box::from_raw(self.contents.result) };
3870 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3871 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3872 let contents = if o.result_ok {
3873 let result = unsafe { o.contents.result };
3874 unsafe { o.contents.result = std::ptr::null_mut() };
3875 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3877 let _ = unsafe { Box::from_raw(o.contents.err) };
3878 o.contents.err = std::ptr::null_mut();
3879 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3883 result_ok: o.result_ok,
3887 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3888 fn clone(&self) -> Self {
3890 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3891 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3894 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3895 err: std::ptr::null_mut()
3901 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3902 /// but with all dynamically-allocated buffers duplicated in new buffers.
3903 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
3905 /// The contents of CResult_SignatureNoneZ
3906 pub union CResult_SignatureNoneZPtr {
3907 /// A pointer to the contents in the success state.
3908 /// Reading from this pointer when `result_ok` is not set is undefined.
3909 pub result: *mut crate::c_types::Signature,
3910 /// Note that this value is always NULL, as there are no contents in the Err variant
3911 pub err: *mut std::ffi::c_void,
3914 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3915 /// containing a crate::c_types::Signature on success and a () on failure.
3916 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3917 pub struct CResult_SignatureNoneZ {
3918 /// The contents of this CResult_SignatureNoneZ, accessible via either
3919 /// `err` or `result` depending on the state of `result_ok`.
3920 pub contents: CResult_SignatureNoneZPtr,
3921 /// Whether this CResult_SignatureNoneZ represents a success state.
3922 pub result_ok: bool,
3925 /// Creates a new CResult_SignatureNoneZ in the success state.
3926 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3927 CResult_SignatureNoneZ {
3928 contents: CResult_SignatureNoneZPtr {
3929 result: Box::into_raw(Box::new(o)),
3935 /// Creates a new CResult_SignatureNoneZ in the error state.
3936 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3937 CResult_SignatureNoneZ {
3938 contents: CResult_SignatureNoneZPtr {
3939 err: std::ptr::null_mut(),
3945 /// Frees any resources used by the CResult_SignatureNoneZ.
3946 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3947 impl Drop for CResult_SignatureNoneZ {
3948 fn drop(&mut self) {
3950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3951 let _ = unsafe { Box::from_raw(self.contents.result) };
3957 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3958 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3959 let contents = if o.result_ok {
3960 let result = unsafe { o.contents.result };
3961 unsafe { o.contents.result = std::ptr::null_mut() };
3962 CResult_SignatureNoneZPtr { result }
3964 let _ = unsafe { Box::from_raw(o.contents.err) };
3965 o.contents.err = std::ptr::null_mut();
3966 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3970 result_ok: o.result_ok,
3974 impl Clone for CResult_SignatureNoneZ {
3975 fn clone(&self) -> Self {
3977 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3978 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3981 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3982 err: std::ptr::null_mut()
3988 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3989 /// but with all dynamically-allocated buffers duplicated in new buffers.
3990 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
3992 /// The contents of CResult_SignDecodeErrorZ
3993 pub union CResult_SignDecodeErrorZPtr {
3994 /// A pointer to the contents in the success state.
3995 /// Reading from this pointer when `result_ok` is not set is undefined.
3996 pub result: *mut crate::lightning::chain::keysinterface::Sign,
3997 /// A pointer to the contents in the error state.
3998 /// Reading from this pointer when `result_ok` is set is undefined.
3999 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4002 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4003 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4004 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4005 pub struct CResult_SignDecodeErrorZ {
4006 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
4007 /// `err` or `result` depending on the state of `result_ok`.
4008 pub contents: CResult_SignDecodeErrorZPtr,
4009 /// Whether this CResult_SignDecodeErrorZ represents a success state.
4010 pub result_ok: bool,
4013 /// Creates a new CResult_SignDecodeErrorZ in the success state.
4014 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4015 CResult_SignDecodeErrorZ {
4016 contents: CResult_SignDecodeErrorZPtr {
4017 result: Box::into_raw(Box::new(o)),
4023 /// Creates a new CResult_SignDecodeErrorZ in the error state.
4024 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4025 CResult_SignDecodeErrorZ {
4026 contents: CResult_SignDecodeErrorZPtr {
4027 err: Box::into_raw(Box::new(e)),
4033 /// Frees any resources used by the CResult_SignDecodeErrorZ.
4034 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4035 impl Drop for CResult_SignDecodeErrorZ {
4036 fn drop(&mut self) {
4038 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4039 let _ = unsafe { Box::from_raw(self.contents.result) };
4042 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4043 let _ = unsafe { Box::from_raw(self.contents.err) };
4048 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4049 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
4050 let contents = if o.result_ok {
4051 let result = unsafe { o.contents.result };
4052 unsafe { o.contents.result = std::ptr::null_mut() };
4053 CResult_SignDecodeErrorZPtr { result }
4055 let err = unsafe { o.contents.err };
4056 unsafe { o.contents.err = std::ptr::null_mut(); }
4057 CResult_SignDecodeErrorZPtr { err }
4061 result_ok: o.result_ok,
4065 impl Clone for CResult_SignDecodeErrorZ {
4066 fn clone(&self) -> Self {
4068 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4069 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4072 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4073 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4079 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
4080 /// but with all dynamically-allocated buffers duplicated in new buffers.
4081 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
4083 /// A dynamically-allocated array of u8s of arbitrary size.
4084 /// This corresponds to std::vector in C++
4085 pub struct CVec_u8Z {
4086 /// The elements in the array.
4087 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4089 /// The number of elements pointed to by `data`.
4093 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
4094 if self.datalen == 0 { return Vec::new(); }
4095 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4096 self.data = std::ptr::null_mut();
4100 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
4101 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4104 impl From<Vec<u8>> for CVec_u8Z {
4105 fn from(v: Vec<u8>) -> Self {
4106 let datalen = v.len();
4107 let data = Box::into_raw(v.into_boxed_slice());
4108 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4112 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4113 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
4114 impl Drop for CVec_u8Z {
4115 fn drop(&mut self) {
4116 if self.datalen == 0 { return; }
4117 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4120 impl Clone for CVec_u8Z {
4121 fn clone(&self) -> Self {
4122 let mut res = Vec::new();
4123 if self.datalen == 0 { return Self::from(res); }
4124 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4129 /// The contents of CResult_RecoverableSignatureNoneZ
4130 pub union CResult_RecoverableSignatureNoneZPtr {
4131 /// A pointer to the contents in the success state.
4132 /// Reading from this pointer when `result_ok` is not set is undefined.
4133 pub result: *mut crate::c_types::RecoverableSignature,
4134 /// Note that this value is always NULL, as there are no contents in the Err variant
4135 pub err: *mut std::ffi::c_void,
4138 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4139 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
4140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4141 pub struct CResult_RecoverableSignatureNoneZ {
4142 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4143 /// `err` or `result` depending on the state of `result_ok`.
4144 pub contents: CResult_RecoverableSignatureNoneZPtr,
4145 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4146 pub result_ok: bool,
4149 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4150 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4151 CResult_RecoverableSignatureNoneZ {
4152 contents: CResult_RecoverableSignatureNoneZPtr {
4153 result: Box::into_raw(Box::new(o)),
4159 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4160 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4161 CResult_RecoverableSignatureNoneZ {
4162 contents: CResult_RecoverableSignatureNoneZPtr {
4163 err: std::ptr::null_mut(),
4169 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4170 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4171 impl Drop for CResult_RecoverableSignatureNoneZ {
4172 fn drop(&mut self) {
4174 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4175 let _ = unsafe { Box::from_raw(self.contents.result) };
4181 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4182 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4183 let contents = if o.result_ok {
4184 let result = unsafe { o.contents.result };
4185 unsafe { o.contents.result = std::ptr::null_mut() };
4186 CResult_RecoverableSignatureNoneZPtr { result }
4188 let _ = unsafe { Box::from_raw(o.contents.err) };
4189 o.contents.err = std::ptr::null_mut();
4190 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
4194 result_ok: o.result_ok,
4198 impl Clone for CResult_RecoverableSignatureNoneZ {
4199 fn clone(&self) -> Self {
4201 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4202 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4205 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4206 err: std::ptr::null_mut()
4212 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4213 /// but with all dynamically-allocated buffers duplicated in new buffers.
4214 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4216 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4217 /// This corresponds to std::vector in C++
4218 pub struct CVec_CVec_u8ZZ {
4219 /// The elements in the array.
4220 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4221 pub data: *mut crate::c_types::derived::CVec_u8Z,
4222 /// The number of elements pointed to by `data`.
4225 impl CVec_CVec_u8ZZ {
4226 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4227 if self.datalen == 0 { return Vec::new(); }
4228 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4229 self.data = std::ptr::null_mut();
4233 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4234 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4237 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4238 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4239 let datalen = v.len();
4240 let data = Box::into_raw(v.into_boxed_slice());
4241 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4245 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4246 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4247 impl Drop for CVec_CVec_u8ZZ {
4248 fn drop(&mut self) {
4249 if self.datalen == 0 { return; }
4250 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4253 impl Clone for CVec_CVec_u8ZZ {
4254 fn clone(&self) -> Self {
4255 let mut res = Vec::new();
4256 if self.datalen == 0 { return Self::from(res); }
4257 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4262 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4263 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4264 /// A pointer to the contents in the success state.
4265 /// Reading from this pointer when `result_ok` is not set is undefined.
4266 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4267 /// Note that this value is always NULL, as there are no contents in the Err variant
4268 pub err: *mut std::ffi::c_void,
4271 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4272 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4274 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4275 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4276 /// `err` or `result` depending on the state of `result_ok`.
4277 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4278 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4279 pub result_ok: bool,
4282 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4283 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4284 CResult_CVec_CVec_u8ZZNoneZ {
4285 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4286 result: Box::into_raw(Box::new(o)),
4292 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4293 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4294 CResult_CVec_CVec_u8ZZNoneZ {
4295 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4296 err: std::ptr::null_mut(),
4302 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4303 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4304 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4305 fn drop(&mut self) {
4307 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4308 let _ = unsafe { Box::from_raw(self.contents.result) };
4314 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4315 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4316 let contents = if o.result_ok {
4317 let result = unsafe { o.contents.result };
4318 unsafe { o.contents.result = std::ptr::null_mut() };
4319 CResult_CVec_CVec_u8ZZNoneZPtr { result }
4321 let _ = unsafe { Box::from_raw(o.contents.err) };
4322 o.contents.err = std::ptr::null_mut();
4323 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4327 result_ok: o.result_ok,
4331 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4332 fn clone(&self) -> Self {
4334 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4335 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4338 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4339 err: std::ptr::null_mut()
4345 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4346 /// but with all dynamically-allocated buffers duplicated in new buffers.
4347 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4349 /// The contents of CResult_InMemorySignerDecodeErrorZ
4350 pub union CResult_InMemorySignerDecodeErrorZPtr {
4351 /// A pointer to the contents in the success state.
4352 /// Reading from this pointer when `result_ok` is not set is undefined.
4353 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4354 /// A pointer to the contents in the error state.
4355 /// Reading from this pointer when `result_ok` is set is undefined.
4356 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4359 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4360 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4362 pub struct CResult_InMemorySignerDecodeErrorZ {
4363 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4364 /// `err` or `result` depending on the state of `result_ok`.
4365 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4366 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4367 pub result_ok: bool,
4370 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4371 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4372 CResult_InMemorySignerDecodeErrorZ {
4373 contents: CResult_InMemorySignerDecodeErrorZPtr {
4374 result: Box::into_raw(Box::new(o)),
4380 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4381 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4382 CResult_InMemorySignerDecodeErrorZ {
4383 contents: CResult_InMemorySignerDecodeErrorZPtr {
4384 err: Box::into_raw(Box::new(e)),
4390 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
4391 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4392 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4393 fn drop(&mut self) {
4395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4396 let _ = unsafe { Box::from_raw(self.contents.result) };
4399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4400 let _ = unsafe { Box::from_raw(self.contents.err) };
4405 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
4406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
4407 let contents = if o.result_ok {
4408 let result = unsafe { o.contents.result };
4409 unsafe { o.contents.result = std::ptr::null_mut() };
4410 CResult_InMemorySignerDecodeErrorZPtr { result }
4412 let err = unsafe { o.contents.err };
4413 unsafe { o.contents.err = std::ptr::null_mut(); }
4414 CResult_InMemorySignerDecodeErrorZPtr { err }
4418 result_ok: o.result_ok,
4422 impl Clone for CResult_InMemorySignerDecodeErrorZ {
4423 fn clone(&self) -> Self {
4425 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
4426 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
4429 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
4430 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4436 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
4437 /// but with all dynamically-allocated buffers duplicated in new buffers.
4438 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
4440 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4441 /// This corresponds to std::vector in C++
4442 pub struct CVec_TxOutZ {
4443 /// The elements in the array.
4444 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4445 pub data: *mut crate::c_types::TxOut,
4446 /// The number of elements pointed to by `data`.
4450 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
4451 if self.datalen == 0 { return Vec::new(); }
4452 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4453 self.data = std::ptr::null_mut();
4457 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
4458 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4461 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
4462 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
4463 let datalen = v.len();
4464 let data = Box::into_raw(v.into_boxed_slice());
4465 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4470 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
4471 impl Drop for CVec_TxOutZ {
4472 fn drop(&mut self) {
4473 if self.datalen == 0 { return; }
4474 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4477 impl Clone for CVec_TxOutZ {
4478 fn clone(&self) -> Self {
4479 let mut res = Vec::new();
4480 if self.datalen == 0 { return Self::from(res); }
4481 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4486 /// The contents of CResult_TransactionNoneZ
4487 pub union CResult_TransactionNoneZPtr {
4488 /// A pointer to the contents in the success state.
4489 /// Reading from this pointer when `result_ok` is not set is undefined.
4490 pub result: *mut crate::c_types::Transaction,
4491 /// Note that this value is always NULL, as there are no contents in the Err variant
4492 pub err: *mut std::ffi::c_void,
4495 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
4496 /// containing a crate::c_types::Transaction on success and a () on failure.
4497 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4498 pub struct CResult_TransactionNoneZ {
4499 /// The contents of this CResult_TransactionNoneZ, accessible via either
4500 /// `err` or `result` depending on the state of `result_ok`.
4501 pub contents: CResult_TransactionNoneZPtr,
4502 /// Whether this CResult_TransactionNoneZ represents a success state.
4503 pub result_ok: bool,
4506 /// Creates a new CResult_TransactionNoneZ in the success state.
4507 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
4508 CResult_TransactionNoneZ {
4509 contents: CResult_TransactionNoneZPtr {
4510 result: Box::into_raw(Box::new(o)),
4516 /// Creates a new CResult_TransactionNoneZ in the error state.
4517 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
4518 CResult_TransactionNoneZ {
4519 contents: CResult_TransactionNoneZPtr {
4520 err: std::ptr::null_mut(),
4526 /// Frees any resources used by the CResult_TransactionNoneZ.
4527 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
4528 impl Drop for CResult_TransactionNoneZ {
4529 fn drop(&mut self) {
4531 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4532 let _ = unsafe { Box::from_raw(self.contents.result) };
4538 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
4539 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
4540 let contents = if o.result_ok {
4541 let result = unsafe { o.contents.result };
4542 unsafe { o.contents.result = std::ptr::null_mut() };
4543 CResult_TransactionNoneZPtr { result }
4545 let _ = unsafe { Box::from_raw(o.contents.err) };
4546 o.contents.err = std::ptr::null_mut();
4547 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
4551 result_ok: o.result_ok,
4555 impl Clone for CResult_TransactionNoneZ {
4556 fn clone(&self) -> Self {
4558 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
4559 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
4562 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
4563 err: std::ptr::null_mut()
4569 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
4570 /// but with all dynamically-allocated buffers duplicated in new buffers.
4571 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
4573 /// A tuple of 2 elements. See the individual fields for the types contained.
4574 pub struct C2Tuple_BlockHashChannelMonitorZ {
4575 /// The element at position 0
4576 pub a: crate::c_types::ThirtyTwoBytes,
4577 /// The element at position 1
4578 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
4580 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4581 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
4588 impl C2Tuple_BlockHashChannelMonitorZ {
4589 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
4593 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4595 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4596 C2Tuple_BlockHashChannelMonitorZ { a, b, }
4600 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4601 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4603 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4604 /// This corresponds to std::vector in C++
4605 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
4606 /// The elements in the array.
4607 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4608 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4609 /// The number of elements pointed to by `data`.
4612 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
4613 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
4614 if self.datalen == 0 { return Vec::new(); }
4615 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4616 self.data = std::ptr::null_mut();
4620 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
4621 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4624 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4625 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
4626 let datalen = v.len();
4627 let data = Box::into_raw(v.into_boxed_slice());
4628 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4632 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4633 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
4634 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4635 fn drop(&mut self) {
4636 if self.datalen == 0 { return; }
4637 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4641 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4642 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4643 /// A pointer to the contents in the success state.
4644 /// Reading from this pointer when `result_ok` is not set is undefined.
4645 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
4646 /// A pointer to the contents in the error state.
4647 /// Reading from this pointer when `result_ok` is set is undefined.
4648 pub err: *mut crate::c_types::IOError,
4651 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4652 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4653 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4654 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4655 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4656 /// `err` or `result` depending on the state of `result_ok`.
4657 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
4658 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4659 pub result_ok: bool,
4662 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
4663 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4664 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4665 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4666 result: Box::into_raw(Box::new(o)),
4672 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
4673 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4674 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4675 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4676 err: Box::into_raw(Box::new(e)),
4682 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
4683 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
4684 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4685 fn drop(&mut self) {
4687 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4688 let _ = unsafe { Box::from_raw(self.contents.result) };
4691 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4692 let _ = unsafe { Box::from_raw(self.contents.err) };
4697 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4698 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
4699 let contents = if o.result_ok {
4700 let result = unsafe { o.contents.result };
4701 unsafe { o.contents.result = std::ptr::null_mut() };
4702 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
4704 let err = unsafe { o.contents.err };
4705 unsafe { o.contents.err = std::ptr::null_mut(); }
4706 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
4710 result_ok: o.result_ok,
4716 /// An enum which can either contain a u16 or not
4717 pub enum COption_u16Z {
4718 /// When we're in this state, this COption_u16Z contains a u16
4720 /// When we're in this state, this COption_u16Z contains nothing
4724 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4725 if let Self::Some(_) = self { true } else { false }
4727 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4730 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
4731 if let Self::Some(v) = self { v } else { unreachable!() }
4735 /// Constructs a new COption_u16Z containing a u16
4736 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
4737 COption_u16Z::Some(o)
4740 /// Constructs a new COption_u16Z containing nothing
4741 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
4745 /// Frees any resources associated with the u16, if we are in the Some state
4746 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
4748 /// Creates a new COption_u16Z which has the same data as `orig`
4749 /// but with all dynamically-allocated buffers duplicated in new buffers.
4750 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
4752 /// The contents of CResult_NoneAPIErrorZ
4753 pub union CResult_NoneAPIErrorZPtr {
4754 /// Note that this value is always NULL, as there are no contents in the OK variant
4755 pub result: *mut std::ffi::c_void,
4756 /// A pointer to the contents in the error state.
4757 /// Reading from this pointer when `result_ok` is set is undefined.
4758 pub err: *mut crate::lightning::util::errors::APIError,
4761 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4762 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4764 pub struct CResult_NoneAPIErrorZ {
4765 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4766 /// `err` or `result` depending on the state of `result_ok`.
4767 pub contents: CResult_NoneAPIErrorZPtr,
4768 /// Whether this CResult_NoneAPIErrorZ represents a success state.
4769 pub result_ok: bool,
4772 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4773 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4774 CResult_NoneAPIErrorZ {
4775 contents: CResult_NoneAPIErrorZPtr {
4776 result: std::ptr::null_mut(),
4782 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4783 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4784 CResult_NoneAPIErrorZ {
4785 contents: CResult_NoneAPIErrorZPtr {
4786 err: Box::into_raw(Box::new(e)),
4792 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4793 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4794 impl Drop for CResult_NoneAPIErrorZ {
4795 fn drop(&mut self) {
4798 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4799 let _ = unsafe { Box::from_raw(self.contents.err) };
4804 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4805 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4806 let contents = if o.result_ok {
4807 let _ = unsafe { Box::from_raw(o.contents.result) };
4808 o.contents.result = std::ptr::null_mut();
4809 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4811 let err = unsafe { o.contents.err };
4812 unsafe { o.contents.err = std::ptr::null_mut(); }
4813 CResult_NoneAPIErrorZPtr { err }
4817 result_ok: o.result_ok,
4821 impl Clone for CResult_NoneAPIErrorZ {
4822 fn clone(&self) -> Self {
4824 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4825 result: std::ptr::null_mut()
4828 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4829 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4835 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4836 /// but with all dynamically-allocated buffers duplicated in new buffers.
4837 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
4839 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4840 /// This corresponds to std::vector in C++
4841 pub struct CVec_CResult_NoneAPIErrorZZ {
4842 /// The elements in the array.
4843 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4844 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4845 /// The number of elements pointed to by `data`.
4848 impl CVec_CResult_NoneAPIErrorZZ {
4849 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4850 if self.datalen == 0 { return Vec::new(); }
4851 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4852 self.data = std::ptr::null_mut();
4856 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4857 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4860 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4861 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4862 let datalen = v.len();
4863 let data = Box::into_raw(v.into_boxed_slice());
4864 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4868 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4869 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4870 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4871 fn drop(&mut self) {
4872 if self.datalen == 0 { return; }
4873 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4876 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4877 fn clone(&self) -> Self {
4878 let mut res = Vec::new();
4879 if self.datalen == 0 { return Self::from(res); }
4880 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4885 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4886 /// This corresponds to std::vector in C++
4887 pub struct CVec_APIErrorZ {
4888 /// The elements in the array.
4889 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4890 pub data: *mut crate::lightning::util::errors::APIError,
4891 /// The number of elements pointed to by `data`.
4894 impl CVec_APIErrorZ {
4895 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4896 if self.datalen == 0 { return Vec::new(); }
4897 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4898 self.data = std::ptr::null_mut();
4902 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4903 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4906 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4907 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4908 let datalen = v.len();
4909 let data = Box::into_raw(v.into_boxed_slice());
4910 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4914 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4915 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4916 impl Drop for CVec_APIErrorZ {
4917 fn drop(&mut self) {
4918 if self.datalen == 0 { return; }
4919 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4922 impl Clone for CVec_APIErrorZ {
4923 fn clone(&self) -> Self {
4924 let mut res = Vec::new();
4925 if self.datalen == 0 { return Self::from(res); }
4926 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4931 /// The contents of CResult__u832APIErrorZ
4932 pub union CResult__u832APIErrorZPtr {
4933 /// A pointer to the contents in the success state.
4934 /// Reading from this pointer when `result_ok` is not set is undefined.
4935 pub result: *mut crate::c_types::ThirtyTwoBytes,
4936 /// A pointer to the contents in the error state.
4937 /// Reading from this pointer when `result_ok` is set is undefined.
4938 pub err: *mut crate::lightning::util::errors::APIError,
4941 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
4942 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4944 pub struct CResult__u832APIErrorZ {
4945 /// The contents of this CResult__u832APIErrorZ, accessible via either
4946 /// `err` or `result` depending on the state of `result_ok`.
4947 pub contents: CResult__u832APIErrorZPtr,
4948 /// Whether this CResult__u832APIErrorZ represents a success state.
4949 pub result_ok: bool,
4952 /// Creates a new CResult__u832APIErrorZ in the success state.
4953 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
4954 CResult__u832APIErrorZ {
4955 contents: CResult__u832APIErrorZPtr {
4956 result: Box::into_raw(Box::new(o)),
4962 /// Creates a new CResult__u832APIErrorZ in the error state.
4963 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
4964 CResult__u832APIErrorZ {
4965 contents: CResult__u832APIErrorZPtr {
4966 err: Box::into_raw(Box::new(e)),
4972 /// Frees any resources used by the CResult__u832APIErrorZ.
4973 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
4974 impl Drop for CResult__u832APIErrorZ {
4975 fn drop(&mut self) {
4977 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4978 let _ = unsafe { Box::from_raw(self.contents.result) };
4981 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4982 let _ = unsafe { Box::from_raw(self.contents.err) };
4987 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
4988 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4989 let contents = if o.result_ok {
4990 let result = unsafe { o.contents.result };
4991 unsafe { o.contents.result = std::ptr::null_mut() };
4992 CResult__u832APIErrorZPtr { result }
4994 let err = unsafe { o.contents.err };
4995 unsafe { o.contents.err = std::ptr::null_mut(); }
4996 CResult__u832APIErrorZPtr { err }
5000 result_ok: o.result_ok,
5004 impl Clone for CResult__u832APIErrorZ {
5005 fn clone(&self) -> Self {
5007 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
5008 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5011 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
5012 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5018 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
5019 /// but with all dynamically-allocated buffers duplicated in new buffers.
5020 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
5022 /// The contents of CResult_PaymentIdPaymentSendFailureZ
5023 pub union CResult_PaymentIdPaymentSendFailureZPtr {
5024 /// A pointer to the contents in the success state.
5025 /// Reading from this pointer when `result_ok` is not set is undefined.
5026 pub result: *mut crate::c_types::ThirtyTwoBytes,
5027 /// A pointer to the contents in the error state.
5028 /// Reading from this pointer when `result_ok` is set is undefined.
5029 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5032 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5033 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5035 pub struct CResult_PaymentIdPaymentSendFailureZ {
5036 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5037 /// `err` or `result` depending on the state of `result_ok`.
5038 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
5039 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5040 pub result_ok: bool,
5043 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
5044 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
5045 CResult_PaymentIdPaymentSendFailureZ {
5046 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5047 result: Box::into_raw(Box::new(o)),
5053 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
5054 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
5055 CResult_PaymentIdPaymentSendFailureZ {
5056 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5057 err: Box::into_raw(Box::new(e)),
5063 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
5064 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
5065 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
5066 fn drop(&mut self) {
5068 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5069 let _ = unsafe { Box::from_raw(self.contents.result) };
5072 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5073 let _ = unsafe { Box::from_raw(self.contents.err) };
5078 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
5079 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5080 let contents = if o.result_ok {
5081 let result = unsafe { o.contents.result };
5082 unsafe { o.contents.result = std::ptr::null_mut() };
5083 CResult_PaymentIdPaymentSendFailureZPtr { result }
5085 let err = unsafe { o.contents.err };
5086 unsafe { o.contents.err = std::ptr::null_mut(); }
5087 CResult_PaymentIdPaymentSendFailureZPtr { err }
5091 result_ok: o.result_ok,
5095 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
5096 fn clone(&self) -> Self {
5098 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5099 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5102 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5103 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5109 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
5110 /// but with all dynamically-allocated buffers duplicated in new buffers.
5111 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
5113 /// The contents of CResult_NonePaymentSendFailureZ
5114 pub union CResult_NonePaymentSendFailureZPtr {
5115 /// Note that this value is always NULL, as there are no contents in the OK variant
5116 pub result: *mut std::ffi::c_void,
5117 /// A pointer to the contents in the error state.
5118 /// Reading from this pointer when `result_ok` is set is undefined.
5119 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5122 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5123 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5124 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5125 pub struct CResult_NonePaymentSendFailureZ {
5126 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5127 /// `err` or `result` depending on the state of `result_ok`.
5128 pub contents: CResult_NonePaymentSendFailureZPtr,
5129 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
5130 pub result_ok: bool,
5133 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
5134 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
5135 CResult_NonePaymentSendFailureZ {
5136 contents: CResult_NonePaymentSendFailureZPtr {
5137 result: std::ptr::null_mut(),
5143 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
5144 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
5145 CResult_NonePaymentSendFailureZ {
5146 contents: CResult_NonePaymentSendFailureZPtr {
5147 err: Box::into_raw(Box::new(e)),
5153 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5154 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5155 impl Drop for CResult_NonePaymentSendFailureZ {
5156 fn drop(&mut self) {
5159 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5160 let _ = unsafe { Box::from_raw(self.contents.err) };
5165 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5166 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5167 let contents = if o.result_ok {
5168 let _ = unsafe { Box::from_raw(o.contents.result) };
5169 o.contents.result = std::ptr::null_mut();
5170 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
5172 let err = unsafe { o.contents.err };
5173 unsafe { o.contents.err = std::ptr::null_mut(); }
5174 CResult_NonePaymentSendFailureZPtr { err }
5178 result_ok: o.result_ok,
5182 impl Clone for CResult_NonePaymentSendFailureZ {
5183 fn clone(&self) -> Self {
5185 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5186 result: std::ptr::null_mut()
5189 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5190 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5196 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5197 /// but with all dynamically-allocated buffers duplicated in new buffers.
5198 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5200 /// A tuple of 2 elements. See the individual fields for the types contained.
5201 pub struct C2Tuple_PaymentHashPaymentIdZ {
5202 /// The element at position 0
5203 pub a: crate::c_types::ThirtyTwoBytes,
5204 /// The element at position 1
5205 pub b: crate::c_types::ThirtyTwoBytes,
5207 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5208 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5215 impl C2Tuple_PaymentHashPaymentIdZ {
5216 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5220 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5221 fn clone(&self) -> Self {
5223 a: Clone::clone(&self.a),
5224 b: Clone::clone(&self.b),
5229 /// Creates a new tuple which has the same data as `orig`
5230 /// but with all dynamically-allocated buffers duplicated in new buffers.
5231 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5232 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5234 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5235 C2Tuple_PaymentHashPaymentIdZ { a, b, }
5239 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5240 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5242 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5243 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5244 /// A pointer to the contents in the success state.
5245 /// Reading from this pointer when `result_ok` is not set is undefined.
5246 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5247 /// A pointer to the contents in the error state.
5248 /// Reading from this pointer when `result_ok` is set is undefined.
5249 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5252 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5253 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5254 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5255 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5256 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5257 /// `err` or `result` depending on the state of `result_ok`.
5258 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5259 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5260 pub result_ok: bool,
5263 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5264 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5265 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5266 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5267 result: Box::into_raw(Box::new(o)),
5273 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5274 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5275 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5276 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5277 err: Box::into_raw(Box::new(e)),
5283 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5284 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5285 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5286 fn drop(&mut self) {
5288 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5289 let _ = unsafe { Box::from_raw(self.contents.result) };
5292 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5293 let _ = unsafe { Box::from_raw(self.contents.err) };
5298 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5299 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5300 let contents = if o.result_ok {
5301 let result = unsafe { o.contents.result };
5302 unsafe { o.contents.result = std::ptr::null_mut() };
5303 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5305 let err = unsafe { o.contents.err };
5306 unsafe { o.contents.err = std::ptr::null_mut(); }
5307 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5311 result_ok: o.result_ok,
5315 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5316 fn clone(&self) -> Self {
5318 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5319 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5322 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5323 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5329 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5330 /// but with all dynamically-allocated buffers duplicated in new buffers.
5331 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5333 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5334 /// This corresponds to std::vector in C++
5335 pub struct CVec_NetAddressZ {
5336 /// The elements in the array.
5337 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5338 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5339 /// The number of elements pointed to by `data`.
5342 impl CVec_NetAddressZ {
5343 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5344 if self.datalen == 0 { return Vec::new(); }
5345 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5346 self.data = std::ptr::null_mut();
5350 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5351 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5354 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5355 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5356 let datalen = v.len();
5357 let data = Box::into_raw(v.into_boxed_slice());
5358 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5362 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5363 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5364 impl Drop for CVec_NetAddressZ {
5365 fn drop(&mut self) {
5366 if self.datalen == 0 { return; }
5367 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5370 impl Clone for CVec_NetAddressZ {
5371 fn clone(&self) -> Self {
5372 let mut res = Vec::new();
5373 if self.datalen == 0 { return Self::from(res); }
5374 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5379 /// A tuple of 2 elements. See the individual fields for the types contained.
5380 pub struct C2Tuple_PaymentHashPaymentSecretZ {
5381 /// The element at position 0
5382 pub a: crate::c_types::ThirtyTwoBytes,
5383 /// The element at position 1
5384 pub b: crate::c_types::ThirtyTwoBytes,
5386 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
5387 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5394 impl C2Tuple_PaymentHashPaymentSecretZ {
5395 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5399 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
5400 fn clone(&self) -> Self {
5402 a: Clone::clone(&self.a),
5403 b: Clone::clone(&self.b),
5408 /// Creates a new tuple which has the same data as `orig`
5409 /// but with all dynamically-allocated buffers duplicated in new buffers.
5410 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
5411 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
5413 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
5414 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
5418 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
5419 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
5421 /// The contents of CResult_PaymentSecretAPIErrorZ
5422 pub union CResult_PaymentSecretAPIErrorZPtr {
5423 /// A pointer to the contents in the success state.
5424 /// Reading from this pointer when `result_ok` is not set is undefined.
5425 pub result: *mut crate::c_types::ThirtyTwoBytes,
5426 /// A pointer to the contents in the error state.
5427 /// Reading from this pointer when `result_ok` is set is undefined.
5428 pub err: *mut crate::lightning::util::errors::APIError,
5431 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
5432 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5434 pub struct CResult_PaymentSecretAPIErrorZ {
5435 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
5436 /// `err` or `result` depending on the state of `result_ok`.
5437 pub contents: CResult_PaymentSecretAPIErrorZPtr,
5438 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
5439 pub result_ok: bool,
5442 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
5443 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
5444 CResult_PaymentSecretAPIErrorZ {
5445 contents: CResult_PaymentSecretAPIErrorZPtr {
5446 result: Box::into_raw(Box::new(o)),
5452 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
5453 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
5454 CResult_PaymentSecretAPIErrorZ {
5455 contents: CResult_PaymentSecretAPIErrorZPtr {
5456 err: Box::into_raw(Box::new(e)),
5462 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
5463 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
5464 impl Drop for CResult_PaymentSecretAPIErrorZ {
5465 fn drop(&mut self) {
5467 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5468 let _ = unsafe { Box::from_raw(self.contents.result) };
5471 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5472 let _ = unsafe { Box::from_raw(self.contents.err) };
5477 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
5478 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5479 let contents = if o.result_ok {
5480 let result = unsafe { o.contents.result };
5481 unsafe { o.contents.result = std::ptr::null_mut() };
5482 CResult_PaymentSecretAPIErrorZPtr { result }
5484 let err = unsafe { o.contents.err };
5485 unsafe { o.contents.err = std::ptr::null_mut(); }
5486 CResult_PaymentSecretAPIErrorZPtr { err }
5490 result_ok: o.result_ok,
5494 impl Clone for CResult_PaymentSecretAPIErrorZ {
5495 fn clone(&self) -> Self {
5497 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
5498 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5501 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
5502 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5508 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
5509 /// but with all dynamically-allocated buffers duplicated in new buffers.
5510 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
5512 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
5513 /// This corresponds to std::vector in C++
5514 pub struct CVec_ChannelMonitorZ {
5515 /// The elements in the array.
5516 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5517 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
5518 /// The number of elements pointed to by `data`.
5521 impl CVec_ChannelMonitorZ {
5522 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
5523 if self.datalen == 0 { return Vec::new(); }
5524 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5525 self.data = std::ptr::null_mut();
5529 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
5530 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5533 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
5534 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
5535 let datalen = v.len();
5536 let data = Box::into_raw(v.into_boxed_slice());
5537 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5541 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5542 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
5543 impl Drop for CVec_ChannelMonitorZ {
5544 fn drop(&mut self) {
5545 if self.datalen == 0 { return; }
5546 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5550 /// A tuple of 2 elements. See the individual fields for the types contained.
5551 pub struct C2Tuple_BlockHashChannelManagerZ {
5552 /// The element at position 0
5553 pub a: crate::c_types::ThirtyTwoBytes,
5554 /// The element at position 1
5555 pub b: crate::lightning::ln::channelmanager::ChannelManager,
5557 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
5558 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
5565 impl C2Tuple_BlockHashChannelManagerZ {
5566 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
5570 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
5572 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
5573 C2Tuple_BlockHashChannelManagerZ { a, b, }
5577 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
5578 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
5580 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5581 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5582 /// A pointer to the contents in the success state.
5583 /// Reading from this pointer when `result_ok` is not set is undefined.
5584 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
5585 /// A pointer to the contents in the error state.
5586 /// Reading from this pointer when `result_ok` is set is undefined.
5587 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5590 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5591 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5593 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5594 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5595 /// `err` or `result` depending on the state of `result_ok`.
5596 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
5597 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5598 pub result_ok: bool,
5601 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
5602 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5603 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5604 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5605 result: Box::into_raw(Box::new(o)),
5611 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
5612 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5613 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5614 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5615 err: Box::into_raw(Box::new(e)),
5621 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
5622 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
5623 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5624 fn drop(&mut self) {
5626 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5627 let _ = unsafe { Box::from_raw(self.contents.result) };
5630 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5631 let _ = unsafe { Box::from_raw(self.contents.err) };
5636 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5637 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5638 let contents = if o.result_ok {
5639 let result = unsafe { o.contents.result };
5640 unsafe { o.contents.result = std::ptr::null_mut() };
5641 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
5643 let err = unsafe { o.contents.err };
5644 unsafe { o.contents.err = std::ptr::null_mut(); }
5645 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
5649 result_ok: o.result_ok,
5654 /// The contents of CResult_ChannelConfigDecodeErrorZ
5655 pub union CResult_ChannelConfigDecodeErrorZPtr {
5656 /// A pointer to the contents in the success state.
5657 /// Reading from this pointer when `result_ok` is not set is undefined.
5658 pub result: *mut crate::lightning::util::config::ChannelConfig,
5659 /// A pointer to the contents in the error state.
5660 /// Reading from this pointer when `result_ok` is set is undefined.
5661 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5664 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5665 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5667 pub struct CResult_ChannelConfigDecodeErrorZ {
5668 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5669 /// `err` or `result` depending on the state of `result_ok`.
5670 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
5671 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5672 pub result_ok: bool,
5675 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
5676 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
5677 CResult_ChannelConfigDecodeErrorZ {
5678 contents: CResult_ChannelConfigDecodeErrorZPtr {
5679 result: Box::into_raw(Box::new(o)),
5685 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
5686 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
5687 CResult_ChannelConfigDecodeErrorZ {
5688 contents: CResult_ChannelConfigDecodeErrorZPtr {
5689 err: Box::into_raw(Box::new(e)),
5695 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
5696 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
5697 impl Drop for CResult_ChannelConfigDecodeErrorZ {
5698 fn drop(&mut self) {
5700 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5701 let _ = unsafe { Box::from_raw(self.contents.result) };
5704 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5705 let _ = unsafe { Box::from_raw(self.contents.err) };
5710 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
5711 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
5712 let contents = if o.result_ok {
5713 let result = unsafe { o.contents.result };
5714 unsafe { o.contents.result = std::ptr::null_mut() };
5715 CResult_ChannelConfigDecodeErrorZPtr { result }
5717 let err = unsafe { o.contents.err };
5718 unsafe { o.contents.err = std::ptr::null_mut(); }
5719 CResult_ChannelConfigDecodeErrorZPtr { err }
5723 result_ok: o.result_ok,
5727 impl Clone for CResult_ChannelConfigDecodeErrorZ {
5728 fn clone(&self) -> Self {
5730 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
5731 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
5734 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
5735 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5741 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
5742 /// but with all dynamically-allocated buffers duplicated in new buffers.
5743 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
5745 /// The contents of CResult_OutPointDecodeErrorZ
5746 pub union CResult_OutPointDecodeErrorZPtr {
5747 /// A pointer to the contents in the success state.
5748 /// Reading from this pointer when `result_ok` is not set is undefined.
5749 pub result: *mut crate::lightning::chain::transaction::OutPoint,
5750 /// A pointer to the contents in the error state.
5751 /// Reading from this pointer when `result_ok` is set is undefined.
5752 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5755 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5756 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5758 pub struct CResult_OutPointDecodeErrorZ {
5759 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5760 /// `err` or `result` depending on the state of `result_ok`.
5761 pub contents: CResult_OutPointDecodeErrorZPtr,
5762 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
5763 pub result_ok: bool,
5766 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
5767 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
5768 CResult_OutPointDecodeErrorZ {
5769 contents: CResult_OutPointDecodeErrorZPtr {
5770 result: Box::into_raw(Box::new(o)),
5776 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
5777 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
5778 CResult_OutPointDecodeErrorZ {
5779 contents: CResult_OutPointDecodeErrorZPtr {
5780 err: Box::into_raw(Box::new(e)),
5786 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
5787 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
5788 impl Drop for CResult_OutPointDecodeErrorZ {
5789 fn drop(&mut self) {
5791 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5792 let _ = unsafe { Box::from_raw(self.contents.result) };
5795 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5796 let _ = unsafe { Box::from_raw(self.contents.err) };
5801 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
5802 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5803 let contents = if o.result_ok {
5804 let result = unsafe { o.contents.result };
5805 unsafe { o.contents.result = std::ptr::null_mut() };
5806 CResult_OutPointDecodeErrorZPtr { result }
5808 let err = unsafe { o.contents.err };
5809 unsafe { o.contents.err = std::ptr::null_mut(); }
5810 CResult_OutPointDecodeErrorZPtr { err }
5814 result_ok: o.result_ok,
5818 impl Clone for CResult_OutPointDecodeErrorZ {
5819 fn clone(&self) -> Self {
5821 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
5822 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
5825 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
5826 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5832 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
5833 /// but with all dynamically-allocated buffers duplicated in new buffers.
5834 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
5836 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
5837 pub enum COption_TypeZ {
5838 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5839 Some(crate::lightning::ln::wire::Type),
5840 /// When we're in this state, this COption_TypeZ contains nothing
5843 impl COption_TypeZ {
5844 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5845 if let Self::Some(_) = self { true } else { false }
5847 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5850 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
5851 if let Self::Some(v) = self { v } else { unreachable!() }
5855 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
5856 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
5857 COption_TypeZ::Some(o)
5860 /// Constructs a new COption_TypeZ containing nothing
5861 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
5865 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
5866 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
5868 /// The contents of CResult_COption_TypeZDecodeErrorZ
5869 pub union CResult_COption_TypeZDecodeErrorZPtr {
5870 /// A pointer to the contents in the success state.
5871 /// Reading from this pointer when `result_ok` is not set is undefined.
5872 pub result: *mut crate::c_types::derived::COption_TypeZ,
5873 /// A pointer to the contents in the error state.
5874 /// Reading from this pointer when `result_ok` is set is undefined.
5875 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5878 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5879 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5880 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5881 pub struct CResult_COption_TypeZDecodeErrorZ {
5882 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5883 /// `err` or `result` depending on the state of `result_ok`.
5884 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
5885 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5886 pub result_ok: bool,
5889 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
5890 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
5891 CResult_COption_TypeZDecodeErrorZ {
5892 contents: CResult_COption_TypeZDecodeErrorZPtr {
5893 result: Box::into_raw(Box::new(o)),
5899 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
5900 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
5901 CResult_COption_TypeZDecodeErrorZ {
5902 contents: CResult_COption_TypeZDecodeErrorZPtr {
5903 err: Box::into_raw(Box::new(e)),
5909 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
5910 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
5911 impl Drop for CResult_COption_TypeZDecodeErrorZ {
5912 fn drop(&mut self) {
5914 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5915 let _ = unsafe { Box::from_raw(self.contents.result) };
5918 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5919 let _ = unsafe { Box::from_raw(self.contents.err) };
5924 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
5925 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5926 let contents = if o.result_ok {
5927 let result = unsafe { o.contents.result };
5928 unsafe { o.contents.result = std::ptr::null_mut() };
5929 CResult_COption_TypeZDecodeErrorZPtr { result }
5931 let err = unsafe { o.contents.err };
5932 unsafe { o.contents.err = std::ptr::null_mut(); }
5933 CResult_COption_TypeZDecodeErrorZPtr { err }
5937 result_ok: o.result_ok,
5942 /// The contents of CResult_PaymentIdPaymentErrorZ
5943 pub union CResult_PaymentIdPaymentErrorZPtr {
5944 /// A pointer to the contents in the success state.
5945 /// Reading from this pointer when `result_ok` is not set is undefined.
5946 pub result: *mut crate::c_types::ThirtyTwoBytes,
5947 /// A pointer to the contents in the error state.
5948 /// Reading from this pointer when `result_ok` is set is undefined.
5949 pub err: *mut crate::lightning_invoice::payment::PaymentError,
5952 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
5953 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
5954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5955 pub struct CResult_PaymentIdPaymentErrorZ {
5956 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
5957 /// `err` or `result` depending on the state of `result_ok`.
5958 pub contents: CResult_PaymentIdPaymentErrorZPtr,
5959 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
5960 pub result_ok: bool,
5963 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
5964 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
5965 CResult_PaymentIdPaymentErrorZ {
5966 contents: CResult_PaymentIdPaymentErrorZPtr {
5967 result: Box::into_raw(Box::new(o)),
5973 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
5974 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
5975 CResult_PaymentIdPaymentErrorZ {
5976 contents: CResult_PaymentIdPaymentErrorZPtr {
5977 err: Box::into_raw(Box::new(e)),
5983 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
5984 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
5985 impl Drop for CResult_PaymentIdPaymentErrorZ {
5986 fn drop(&mut self) {
5988 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5989 let _ = unsafe { Box::from_raw(self.contents.result) };
5992 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5993 let _ = unsafe { Box::from_raw(self.contents.err) };
5998 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
5999 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
6000 let contents = if o.result_ok {
6001 let result = unsafe { o.contents.result };
6002 unsafe { o.contents.result = std::ptr::null_mut() };
6003 CResult_PaymentIdPaymentErrorZPtr { result }
6005 let err = unsafe { o.contents.err };
6006 unsafe { o.contents.err = std::ptr::null_mut(); }
6007 CResult_PaymentIdPaymentErrorZPtr { err }
6011 result_ok: o.result_ok,
6015 impl Clone for CResult_PaymentIdPaymentErrorZ {
6016 fn clone(&self) -> Self {
6018 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
6019 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6022 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
6023 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
6029 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
6030 /// but with all dynamically-allocated buffers duplicated in new buffers.
6031 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
6033 /// The contents of CResult_SiPrefixNoneZ
6034 pub union CResult_SiPrefixNoneZPtr {
6035 /// A pointer to the contents in the success state.
6036 /// Reading from this pointer when `result_ok` is not set is undefined.
6037 pub result: *mut crate::lightning_invoice::SiPrefix,
6038 /// Note that this value is always NULL, as there are no contents in the Err variant
6039 pub err: *mut std::ffi::c_void,
6042 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
6043 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
6044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6045 pub struct CResult_SiPrefixNoneZ {
6046 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
6047 /// `err` or `result` depending on the state of `result_ok`.
6048 pub contents: CResult_SiPrefixNoneZPtr,
6049 /// Whether this CResult_SiPrefixNoneZ represents a success state.
6050 pub result_ok: bool,
6053 /// Creates a new CResult_SiPrefixNoneZ in the success state.
6054 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
6055 CResult_SiPrefixNoneZ {
6056 contents: CResult_SiPrefixNoneZPtr {
6057 result: Box::into_raw(Box::new(o)),
6063 /// Creates a new CResult_SiPrefixNoneZ in the error state.
6064 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
6065 CResult_SiPrefixNoneZ {
6066 contents: CResult_SiPrefixNoneZPtr {
6067 err: std::ptr::null_mut(),
6073 /// Frees any resources used by the CResult_SiPrefixNoneZ.
6074 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
6075 impl Drop for CResult_SiPrefixNoneZ {
6076 fn drop(&mut self) {
6078 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6079 let _ = unsafe { Box::from_raw(self.contents.result) };
6085 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
6086 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
6087 let contents = if o.result_ok {
6088 let result = unsafe { o.contents.result };
6089 unsafe { o.contents.result = std::ptr::null_mut() };
6090 CResult_SiPrefixNoneZPtr { result }
6092 let _ = unsafe { Box::from_raw(o.contents.err) };
6093 o.contents.err = std::ptr::null_mut();
6094 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
6098 result_ok: o.result_ok,
6102 impl Clone for CResult_SiPrefixNoneZ {
6103 fn clone(&self) -> Self {
6105 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
6106 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
6109 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
6110 err: std::ptr::null_mut()
6116 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
6117 /// but with all dynamically-allocated buffers duplicated in new buffers.
6118 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
6120 /// The contents of CResult_InvoiceNoneZ
6121 pub union CResult_InvoiceNoneZPtr {
6122 /// A pointer to the contents in the success state.
6123 /// Reading from this pointer when `result_ok` is not set is undefined.
6124 pub result: *mut crate::lightning_invoice::Invoice,
6125 /// Note that this value is always NULL, as there are no contents in the Err variant
6126 pub err: *mut std::ffi::c_void,
6129 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
6130 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
6131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6132 pub struct CResult_InvoiceNoneZ {
6133 /// The contents of this CResult_InvoiceNoneZ, accessible via either
6134 /// `err` or `result` depending on the state of `result_ok`.
6135 pub contents: CResult_InvoiceNoneZPtr,
6136 /// Whether this CResult_InvoiceNoneZ represents a success state.
6137 pub result_ok: bool,
6140 /// Creates a new CResult_InvoiceNoneZ in the success state.
6141 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
6142 CResult_InvoiceNoneZ {
6143 contents: CResult_InvoiceNoneZPtr {
6144 result: Box::into_raw(Box::new(o)),
6150 /// Creates a new CResult_InvoiceNoneZ in the error state.
6151 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
6152 CResult_InvoiceNoneZ {
6153 contents: CResult_InvoiceNoneZPtr {
6154 err: std::ptr::null_mut(),
6160 /// Frees any resources used by the CResult_InvoiceNoneZ.
6161 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
6162 impl Drop for CResult_InvoiceNoneZ {
6163 fn drop(&mut self) {
6165 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6166 let _ = unsafe { Box::from_raw(self.contents.result) };
6172 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
6173 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
6174 let contents = if o.result_ok {
6175 let result = unsafe { o.contents.result };
6176 unsafe { o.contents.result = std::ptr::null_mut() };
6177 CResult_InvoiceNoneZPtr { result }
6179 let _ = unsafe { Box::from_raw(o.contents.err) };
6180 o.contents.err = std::ptr::null_mut();
6181 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
6185 result_ok: o.result_ok,
6189 impl Clone for CResult_InvoiceNoneZ {
6190 fn clone(&self) -> Self {
6192 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
6193 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6196 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
6197 err: std::ptr::null_mut()
6203 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
6204 /// but with all dynamically-allocated buffers duplicated in new buffers.
6205 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
6207 /// The contents of CResult_SignedRawInvoiceNoneZ
6208 pub union CResult_SignedRawInvoiceNoneZPtr {
6209 /// A pointer to the contents in the success state.
6210 /// Reading from this pointer when `result_ok` is not set is undefined.
6211 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
6212 /// Note that this value is always NULL, as there are no contents in the Err variant
6213 pub err: *mut std::ffi::c_void,
6216 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
6217 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
6218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6219 pub struct CResult_SignedRawInvoiceNoneZ {
6220 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
6221 /// `err` or `result` depending on the state of `result_ok`.
6222 pub contents: CResult_SignedRawInvoiceNoneZPtr,
6223 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
6224 pub result_ok: bool,
6227 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
6228 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
6229 CResult_SignedRawInvoiceNoneZ {
6230 contents: CResult_SignedRawInvoiceNoneZPtr {
6231 result: Box::into_raw(Box::new(o)),
6237 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
6238 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
6239 CResult_SignedRawInvoiceNoneZ {
6240 contents: CResult_SignedRawInvoiceNoneZPtr {
6241 err: std::ptr::null_mut(),
6247 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
6248 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
6249 impl Drop for CResult_SignedRawInvoiceNoneZ {
6250 fn drop(&mut self) {
6252 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6253 let _ = unsafe { Box::from_raw(self.contents.result) };
6259 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
6260 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
6261 let contents = if o.result_ok {
6262 let result = unsafe { o.contents.result };
6263 unsafe { o.contents.result = std::ptr::null_mut() };
6264 CResult_SignedRawInvoiceNoneZPtr { result }
6266 let _ = unsafe { Box::from_raw(o.contents.err) };
6267 o.contents.err = std::ptr::null_mut();
6268 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
6272 result_ok: o.result_ok,
6276 impl Clone for CResult_SignedRawInvoiceNoneZ {
6277 fn clone(&self) -> Self {
6279 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
6280 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
6283 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
6284 err: std::ptr::null_mut()
6290 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
6291 /// but with all dynamically-allocated buffers duplicated in new buffers.
6292 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
6294 /// A tuple of 3 elements. See the individual fields for the types contained.
6295 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6296 /// The element at position 0
6297 pub a: crate::lightning_invoice::RawInvoice,
6298 /// The element at position 1
6299 pub b: crate::c_types::ThirtyTwoBytes,
6300 /// The element at position 2
6301 pub c: crate::lightning_invoice::InvoiceSignature,
6303 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6304 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
6312 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6313 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
6314 (self.a, self.b, self.c)
6317 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6318 fn clone(&self) -> Self {
6320 a: Clone::clone(&self.a),
6321 b: Clone::clone(&self.b),
6322 c: Clone::clone(&self.c),
6327 /// Creates a new tuple which has the same data as `orig`
6328 /// but with all dynamically-allocated buffers duplicated in new buffers.
6329 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
6330 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
6332 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 {
6333 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
6337 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
6338 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
6340 /// The contents of CResult_PayeePubKeyErrorZ
6341 pub union CResult_PayeePubKeyErrorZPtr {
6342 /// A pointer to the contents in the success state.
6343 /// Reading from this pointer when `result_ok` is not set is undefined.
6344 pub result: *mut crate::lightning_invoice::PayeePubKey,
6345 /// A pointer to the contents in the error state.
6346 /// Reading from this pointer when `result_ok` is set is undefined.
6347 pub err: *mut crate::c_types::Secp256k1Error,
6350 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
6351 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
6352 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6353 pub struct CResult_PayeePubKeyErrorZ {
6354 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
6355 /// `err` or `result` depending on the state of `result_ok`.
6356 pub contents: CResult_PayeePubKeyErrorZPtr,
6357 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
6358 pub result_ok: bool,
6361 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
6362 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
6363 CResult_PayeePubKeyErrorZ {
6364 contents: CResult_PayeePubKeyErrorZPtr {
6365 result: Box::into_raw(Box::new(o)),
6371 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
6372 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
6373 CResult_PayeePubKeyErrorZ {
6374 contents: CResult_PayeePubKeyErrorZPtr {
6375 err: Box::into_raw(Box::new(e)),
6381 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
6382 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
6383 impl Drop for CResult_PayeePubKeyErrorZ {
6384 fn drop(&mut self) {
6386 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6387 let _ = unsafe { Box::from_raw(self.contents.result) };
6390 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6391 let _ = unsafe { Box::from_raw(self.contents.err) };
6396 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
6397 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
6398 let contents = if o.result_ok {
6399 let result = unsafe { o.contents.result };
6400 unsafe { o.contents.result = std::ptr::null_mut() };
6401 CResult_PayeePubKeyErrorZPtr { result }
6403 let err = unsafe { o.contents.err };
6404 unsafe { o.contents.err = std::ptr::null_mut(); }
6405 CResult_PayeePubKeyErrorZPtr { err }
6409 result_ok: o.result_ok,
6413 impl Clone for CResult_PayeePubKeyErrorZ {
6414 fn clone(&self) -> Self {
6416 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
6417 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
6420 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
6421 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6427 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
6428 /// but with all dynamically-allocated buffers duplicated in new buffers.
6429 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
6431 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
6432 /// This corresponds to std::vector in C++
6433 pub struct CVec_PrivateRouteZ {
6434 /// The elements in the array.
6435 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6436 pub data: *mut crate::lightning_invoice::PrivateRoute,
6437 /// The number of elements pointed to by `data`.
6440 impl CVec_PrivateRouteZ {
6441 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
6442 if self.datalen == 0 { return Vec::new(); }
6443 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6444 self.data = std::ptr::null_mut();
6448 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
6449 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6452 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
6453 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
6454 let datalen = v.len();
6455 let data = Box::into_raw(v.into_boxed_slice());
6456 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6460 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6461 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
6462 impl Drop for CVec_PrivateRouteZ {
6463 fn drop(&mut self) {
6464 if self.datalen == 0 { return; }
6465 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6468 impl Clone for CVec_PrivateRouteZ {
6469 fn clone(&self) -> Self {
6470 let mut res = Vec::new();
6471 if self.datalen == 0 { return Self::from(res); }
6472 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6477 /// The contents of CResult_PositiveTimestampCreationErrorZ
6478 pub union CResult_PositiveTimestampCreationErrorZPtr {
6479 /// A pointer to the contents in the success state.
6480 /// Reading from this pointer when `result_ok` is not set is undefined.
6481 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
6482 /// A pointer to the contents in the error state.
6483 /// Reading from this pointer when `result_ok` is set is undefined.
6484 pub err: *mut crate::lightning_invoice::CreationError,
6487 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
6488 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
6489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6490 pub struct CResult_PositiveTimestampCreationErrorZ {
6491 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
6492 /// `err` or `result` depending on the state of `result_ok`.
6493 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
6494 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
6495 pub result_ok: bool,
6498 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
6499 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
6500 CResult_PositiveTimestampCreationErrorZ {
6501 contents: CResult_PositiveTimestampCreationErrorZPtr {
6502 result: Box::into_raw(Box::new(o)),
6508 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
6509 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
6510 CResult_PositiveTimestampCreationErrorZ {
6511 contents: CResult_PositiveTimestampCreationErrorZPtr {
6512 err: Box::into_raw(Box::new(e)),
6518 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
6519 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
6520 impl Drop for CResult_PositiveTimestampCreationErrorZ {
6521 fn drop(&mut self) {
6523 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6524 let _ = unsafe { Box::from_raw(self.contents.result) };
6527 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6528 let _ = unsafe { Box::from_raw(self.contents.err) };
6533 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
6534 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
6535 let contents = if o.result_ok {
6536 let result = unsafe { o.contents.result };
6537 unsafe { o.contents.result = std::ptr::null_mut() };
6538 CResult_PositiveTimestampCreationErrorZPtr { result }
6540 let err = unsafe { o.contents.err };
6541 unsafe { o.contents.err = std::ptr::null_mut(); }
6542 CResult_PositiveTimestampCreationErrorZPtr { err }
6546 result_ok: o.result_ok,
6550 impl Clone for CResult_PositiveTimestampCreationErrorZ {
6551 fn clone(&self) -> Self {
6553 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
6554 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
6557 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
6558 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6564 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
6565 /// but with all dynamically-allocated buffers duplicated in new buffers.
6566 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
6568 /// The contents of CResult_NoneSemanticErrorZ
6569 pub union CResult_NoneSemanticErrorZPtr {
6570 /// Note that this value is always NULL, as there are no contents in the OK variant
6571 pub result: *mut std::ffi::c_void,
6572 /// A pointer to the contents in the error state.
6573 /// Reading from this pointer when `result_ok` is set is undefined.
6574 pub err: *mut crate::lightning_invoice::SemanticError,
6577 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
6578 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
6579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6580 pub struct CResult_NoneSemanticErrorZ {
6581 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
6582 /// `err` or `result` depending on the state of `result_ok`.
6583 pub contents: CResult_NoneSemanticErrorZPtr,
6584 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
6585 pub result_ok: bool,
6588 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
6589 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
6590 CResult_NoneSemanticErrorZ {
6591 contents: CResult_NoneSemanticErrorZPtr {
6592 result: std::ptr::null_mut(),
6598 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
6599 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
6600 CResult_NoneSemanticErrorZ {
6601 contents: CResult_NoneSemanticErrorZPtr {
6602 err: Box::into_raw(Box::new(e)),
6608 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
6609 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
6610 impl Drop for CResult_NoneSemanticErrorZ {
6611 fn drop(&mut self) {
6614 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6615 let _ = unsafe { Box::from_raw(self.contents.err) };
6620 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
6621 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
6622 let contents = if o.result_ok {
6623 let _ = unsafe { Box::from_raw(o.contents.result) };
6624 o.contents.result = std::ptr::null_mut();
6625 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
6627 let err = unsafe { o.contents.err };
6628 unsafe { o.contents.err = std::ptr::null_mut(); }
6629 CResult_NoneSemanticErrorZPtr { err }
6633 result_ok: o.result_ok,
6637 impl Clone for CResult_NoneSemanticErrorZ {
6638 fn clone(&self) -> Self {
6640 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
6641 result: std::ptr::null_mut()
6644 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
6645 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6651 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
6652 /// but with all dynamically-allocated buffers duplicated in new buffers.
6653 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
6655 /// The contents of CResult_InvoiceSemanticErrorZ
6656 pub union CResult_InvoiceSemanticErrorZPtr {
6657 /// A pointer to the contents in the success state.
6658 /// Reading from this pointer when `result_ok` is not set is undefined.
6659 pub result: *mut crate::lightning_invoice::Invoice,
6660 /// A pointer to the contents in the error state.
6661 /// Reading from this pointer when `result_ok` is set is undefined.
6662 pub err: *mut crate::lightning_invoice::SemanticError,
6665 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
6666 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
6667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6668 pub struct CResult_InvoiceSemanticErrorZ {
6669 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
6670 /// `err` or `result` depending on the state of `result_ok`.
6671 pub contents: CResult_InvoiceSemanticErrorZPtr,
6672 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
6673 pub result_ok: bool,
6676 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
6677 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
6678 CResult_InvoiceSemanticErrorZ {
6679 contents: CResult_InvoiceSemanticErrorZPtr {
6680 result: Box::into_raw(Box::new(o)),
6686 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
6687 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
6688 CResult_InvoiceSemanticErrorZ {
6689 contents: CResult_InvoiceSemanticErrorZPtr {
6690 err: Box::into_raw(Box::new(e)),
6696 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
6697 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
6698 impl Drop for CResult_InvoiceSemanticErrorZ {
6699 fn drop(&mut self) {
6701 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6702 let _ = unsafe { Box::from_raw(self.contents.result) };
6705 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6706 let _ = unsafe { Box::from_raw(self.contents.err) };
6711 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
6712 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
6713 let contents = if o.result_ok {
6714 let result = unsafe { o.contents.result };
6715 unsafe { o.contents.result = std::ptr::null_mut() };
6716 CResult_InvoiceSemanticErrorZPtr { result }
6718 let err = unsafe { o.contents.err };
6719 unsafe { o.contents.err = std::ptr::null_mut(); }
6720 CResult_InvoiceSemanticErrorZPtr { err }
6724 result_ok: o.result_ok,
6728 impl Clone for CResult_InvoiceSemanticErrorZ {
6729 fn clone(&self) -> Self {
6731 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
6732 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6735 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
6736 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6742 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
6743 /// but with all dynamically-allocated buffers duplicated in new buffers.
6744 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
6746 /// The contents of CResult_DescriptionCreationErrorZ
6747 pub union CResult_DescriptionCreationErrorZPtr {
6748 /// A pointer to the contents in the success state.
6749 /// Reading from this pointer when `result_ok` is not set is undefined.
6750 pub result: *mut crate::lightning_invoice::Description,
6751 /// A pointer to the contents in the error state.
6752 /// Reading from this pointer when `result_ok` is set is undefined.
6753 pub err: *mut crate::lightning_invoice::CreationError,
6756 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
6757 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
6758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6759 pub struct CResult_DescriptionCreationErrorZ {
6760 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
6761 /// `err` or `result` depending on the state of `result_ok`.
6762 pub contents: CResult_DescriptionCreationErrorZPtr,
6763 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
6764 pub result_ok: bool,
6767 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
6768 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
6769 CResult_DescriptionCreationErrorZ {
6770 contents: CResult_DescriptionCreationErrorZPtr {
6771 result: Box::into_raw(Box::new(o)),
6777 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
6778 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
6779 CResult_DescriptionCreationErrorZ {
6780 contents: CResult_DescriptionCreationErrorZPtr {
6781 err: Box::into_raw(Box::new(e)),
6787 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
6788 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
6789 impl Drop for CResult_DescriptionCreationErrorZ {
6790 fn drop(&mut self) {
6792 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6793 let _ = unsafe { Box::from_raw(self.contents.result) };
6796 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6797 let _ = unsafe { Box::from_raw(self.contents.err) };
6802 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
6803 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
6804 let contents = if o.result_ok {
6805 let result = unsafe { o.contents.result };
6806 unsafe { o.contents.result = std::ptr::null_mut() };
6807 CResult_DescriptionCreationErrorZPtr { result }
6809 let err = unsafe { o.contents.err };
6810 unsafe { o.contents.err = std::ptr::null_mut(); }
6811 CResult_DescriptionCreationErrorZPtr { err }
6815 result_ok: o.result_ok,
6819 impl Clone for CResult_DescriptionCreationErrorZ {
6820 fn clone(&self) -> Self {
6822 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
6823 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
6826 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
6827 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6833 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
6834 /// but with all dynamically-allocated buffers duplicated in new buffers.
6835 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
6837 /// The contents of CResult_ExpiryTimeCreationErrorZ
6838 pub union CResult_ExpiryTimeCreationErrorZPtr {
6839 /// A pointer to the contents in the success state.
6840 /// Reading from this pointer when `result_ok` is not set is undefined.
6841 pub result: *mut crate::lightning_invoice::ExpiryTime,
6842 /// A pointer to the contents in the error state.
6843 /// Reading from this pointer when `result_ok` is set is undefined.
6844 pub err: *mut crate::lightning_invoice::CreationError,
6847 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6848 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6850 pub struct CResult_ExpiryTimeCreationErrorZ {
6851 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6852 /// `err` or `result` depending on the state of `result_ok`.
6853 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
6854 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6855 pub result_ok: bool,
6858 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
6859 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
6860 CResult_ExpiryTimeCreationErrorZ {
6861 contents: CResult_ExpiryTimeCreationErrorZPtr {
6862 result: Box::into_raw(Box::new(o)),
6868 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
6869 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
6870 CResult_ExpiryTimeCreationErrorZ {
6871 contents: CResult_ExpiryTimeCreationErrorZPtr {
6872 err: Box::into_raw(Box::new(e)),
6878 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
6879 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
6880 impl Drop for CResult_ExpiryTimeCreationErrorZ {
6881 fn drop(&mut self) {
6883 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6884 let _ = unsafe { Box::from_raw(self.contents.result) };
6887 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6888 let _ = unsafe { Box::from_raw(self.contents.err) };
6893 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
6894 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
6895 let contents = if o.result_ok {
6896 let result = unsafe { o.contents.result };
6897 unsafe { o.contents.result = std::ptr::null_mut() };
6898 CResult_ExpiryTimeCreationErrorZPtr { result }
6900 let err = unsafe { o.contents.err };
6901 unsafe { o.contents.err = std::ptr::null_mut(); }
6902 CResult_ExpiryTimeCreationErrorZPtr { err }
6906 result_ok: o.result_ok,
6910 impl Clone for CResult_ExpiryTimeCreationErrorZ {
6911 fn clone(&self) -> Self {
6913 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
6914 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
6917 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
6918 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6924 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
6925 /// but with all dynamically-allocated buffers duplicated in new buffers.
6926 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
6928 /// The contents of CResult_PrivateRouteCreationErrorZ
6929 pub union CResult_PrivateRouteCreationErrorZPtr {
6930 /// A pointer to the contents in the success state.
6931 /// Reading from this pointer when `result_ok` is not set is undefined.
6932 pub result: *mut crate::lightning_invoice::PrivateRoute,
6933 /// A pointer to the contents in the error state.
6934 /// Reading from this pointer when `result_ok` is set is undefined.
6935 pub err: *mut crate::lightning_invoice::CreationError,
6938 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6939 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6941 pub struct CResult_PrivateRouteCreationErrorZ {
6942 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6943 /// `err` or `result` depending on the state of `result_ok`.
6944 pub contents: CResult_PrivateRouteCreationErrorZPtr,
6945 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6946 pub result_ok: bool,
6949 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
6950 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
6951 CResult_PrivateRouteCreationErrorZ {
6952 contents: CResult_PrivateRouteCreationErrorZPtr {
6953 result: Box::into_raw(Box::new(o)),
6959 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
6960 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
6961 CResult_PrivateRouteCreationErrorZ {
6962 contents: CResult_PrivateRouteCreationErrorZPtr {
6963 err: Box::into_raw(Box::new(e)),
6969 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
6970 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
6971 impl Drop for CResult_PrivateRouteCreationErrorZ {
6972 fn drop(&mut self) {
6974 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6975 let _ = unsafe { Box::from_raw(self.contents.result) };
6978 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6979 let _ = unsafe { Box::from_raw(self.contents.err) };
6984 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
6985 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
6986 let contents = if o.result_ok {
6987 let result = unsafe { o.contents.result };
6988 unsafe { o.contents.result = std::ptr::null_mut() };
6989 CResult_PrivateRouteCreationErrorZPtr { result }
6991 let err = unsafe { o.contents.err };
6992 unsafe { o.contents.err = std::ptr::null_mut(); }
6993 CResult_PrivateRouteCreationErrorZPtr { err }
6997 result_ok: o.result_ok,
7001 impl Clone for CResult_PrivateRouteCreationErrorZ {
7002 fn clone(&self) -> Self {
7004 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
7005 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
7008 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
7009 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7015 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
7016 /// but with all dynamically-allocated buffers duplicated in new buffers.
7017 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
7019 /// The contents of CResult_StringErrorZ
7020 pub union CResult_StringErrorZPtr {
7021 /// A pointer to the contents in the success state.
7022 /// Reading from this pointer when `result_ok` is not set is undefined.
7023 pub result: *mut crate::c_types::Str,
7024 /// A pointer to the contents in the error state.
7025 /// Reading from this pointer when `result_ok` is set is undefined.
7026 pub err: *mut crate::c_types::Secp256k1Error,
7029 /// A CResult_StringErrorZ represents the result of a fallible operation,
7030 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7032 pub struct CResult_StringErrorZ {
7033 /// The contents of this CResult_StringErrorZ, accessible via either
7034 /// `err` or `result` depending on the state of `result_ok`.
7035 pub contents: CResult_StringErrorZPtr,
7036 /// Whether this CResult_StringErrorZ represents a success state.
7037 pub result_ok: bool,
7040 /// Creates a new CResult_StringErrorZ in the success state.
7041 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
7042 CResult_StringErrorZ {
7043 contents: CResult_StringErrorZPtr {
7044 result: Box::into_raw(Box::new(o)),
7050 /// Creates a new CResult_StringErrorZ in the error state.
7051 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
7052 CResult_StringErrorZ {
7053 contents: CResult_StringErrorZPtr {
7054 err: Box::into_raw(Box::new(e)),
7060 /// Frees any resources used by the CResult_StringErrorZ.
7061 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
7062 impl Drop for CResult_StringErrorZ {
7063 fn drop(&mut self) {
7065 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7066 let _ = unsafe { Box::from_raw(self.contents.result) };
7069 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7070 let _ = unsafe { Box::from_raw(self.contents.err) };
7075 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
7076 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
7077 let contents = if o.result_ok {
7078 let result = unsafe { o.contents.result };
7079 unsafe { o.contents.result = std::ptr::null_mut() };
7080 CResult_StringErrorZPtr { result }
7082 let err = unsafe { o.contents.err };
7083 unsafe { o.contents.err = std::ptr::null_mut(); }
7084 CResult_StringErrorZPtr { err }
7088 result_ok: o.result_ok,
7093 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7094 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7095 /// A pointer to the contents in the success state.
7096 /// Reading from this pointer when `result_ok` is not set is undefined.
7097 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
7098 /// A pointer to the contents in the error state.
7099 /// Reading from this pointer when `result_ok` is set is undefined.
7100 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7103 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7104 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7106 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
7107 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7108 /// `err` or `result` depending on the state of `result_ok`.
7109 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
7110 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7111 pub result_ok: bool,
7114 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
7115 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
7116 CResult_ChannelMonitorUpdateDecodeErrorZ {
7117 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7118 result: Box::into_raw(Box::new(o)),
7124 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
7125 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
7126 CResult_ChannelMonitorUpdateDecodeErrorZ {
7127 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7128 err: Box::into_raw(Box::new(e)),
7134 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
7135 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
7136 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
7137 fn drop(&mut self) {
7139 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7140 let _ = unsafe { Box::from_raw(self.contents.result) };
7143 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7144 let _ = unsafe { Box::from_raw(self.contents.err) };
7149 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
7150 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7151 let contents = if o.result_ok {
7152 let result = unsafe { o.contents.result };
7153 unsafe { o.contents.result = std::ptr::null_mut() };
7154 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
7156 let err = unsafe { o.contents.err };
7157 unsafe { o.contents.err = std::ptr::null_mut(); }
7158 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
7162 result_ok: o.result_ok,
7166 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
7167 fn clone(&self) -> Self {
7169 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7170 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
7173 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7174 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7180 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
7181 /// but with all dynamically-allocated buffers duplicated in new buffers.
7182 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
7184 /// The contents of CResult_HTLCUpdateDecodeErrorZ
7185 pub union CResult_HTLCUpdateDecodeErrorZPtr {
7186 /// A pointer to the contents in the success state.
7187 /// Reading from this pointer when `result_ok` is not set is undefined.
7188 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
7189 /// A pointer to the contents in the error state.
7190 /// Reading from this pointer when `result_ok` is set is undefined.
7191 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7194 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7195 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7197 pub struct CResult_HTLCUpdateDecodeErrorZ {
7198 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7199 /// `err` or `result` depending on the state of `result_ok`.
7200 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
7201 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7202 pub result_ok: bool,
7205 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
7206 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
7207 CResult_HTLCUpdateDecodeErrorZ {
7208 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7209 result: Box::into_raw(Box::new(o)),
7215 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
7216 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
7217 CResult_HTLCUpdateDecodeErrorZ {
7218 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7219 err: Box::into_raw(Box::new(e)),
7225 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
7226 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
7227 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
7228 fn drop(&mut self) {
7230 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7231 let _ = unsafe { Box::from_raw(self.contents.result) };
7234 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7235 let _ = unsafe { Box::from_raw(self.contents.err) };
7240 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
7241 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7242 let contents = if o.result_ok {
7243 let result = unsafe { o.contents.result };
7244 unsafe { o.contents.result = std::ptr::null_mut() };
7245 CResult_HTLCUpdateDecodeErrorZPtr { result }
7247 let err = unsafe { o.contents.err };
7248 unsafe { o.contents.err = std::ptr::null_mut(); }
7249 CResult_HTLCUpdateDecodeErrorZPtr { err }
7253 result_ok: o.result_ok,
7257 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
7258 fn clone(&self) -> Self {
7260 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
7261 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
7264 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
7265 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7271 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
7272 /// but with all dynamically-allocated buffers duplicated in new buffers.
7273 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
7275 /// The contents of CResult_NoneMonitorUpdateErrorZ
7276 pub union CResult_NoneMonitorUpdateErrorZPtr {
7277 /// Note that this value is always NULL, as there are no contents in the OK variant
7278 pub result: *mut std::ffi::c_void,
7279 /// A pointer to the contents in the error state.
7280 /// Reading from this pointer when `result_ok` is set is undefined.
7281 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
7284 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
7285 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
7286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7287 pub struct CResult_NoneMonitorUpdateErrorZ {
7288 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
7289 /// `err` or `result` depending on the state of `result_ok`.
7290 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
7291 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
7292 pub result_ok: bool,
7295 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
7296 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
7297 CResult_NoneMonitorUpdateErrorZ {
7298 contents: CResult_NoneMonitorUpdateErrorZPtr {
7299 result: std::ptr::null_mut(),
7305 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
7306 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
7307 CResult_NoneMonitorUpdateErrorZ {
7308 contents: CResult_NoneMonitorUpdateErrorZPtr {
7309 err: Box::into_raw(Box::new(e)),
7315 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
7316 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
7317 impl Drop for CResult_NoneMonitorUpdateErrorZ {
7318 fn drop(&mut self) {
7321 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7322 let _ = unsafe { Box::from_raw(self.contents.err) };
7327 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
7328 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
7329 let contents = if o.result_ok {
7330 let _ = unsafe { Box::from_raw(o.contents.result) };
7331 o.contents.result = std::ptr::null_mut();
7332 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
7334 let err = unsafe { o.contents.err };
7335 unsafe { o.contents.err = std::ptr::null_mut(); }
7336 CResult_NoneMonitorUpdateErrorZPtr { err }
7340 result_ok: o.result_ok,
7344 impl Clone for CResult_NoneMonitorUpdateErrorZ {
7345 fn clone(&self) -> Self {
7347 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
7348 result: std::ptr::null_mut()
7351 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
7352 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
7358 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
7359 /// but with all dynamically-allocated buffers duplicated in new buffers.
7360 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
7362 /// A tuple of 2 elements. See the individual fields for the types contained.
7363 pub struct C2Tuple_OutPointScriptZ {
7364 /// The element at position 0
7365 pub a: crate::lightning::chain::transaction::OutPoint,
7366 /// The element at position 1
7367 pub b: crate::c_types::derived::CVec_u8Z,
7369 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
7370 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
7377 impl C2Tuple_OutPointScriptZ {
7378 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
7382 impl Clone for C2Tuple_OutPointScriptZ {
7383 fn clone(&self) -> Self {
7385 a: Clone::clone(&self.a),
7386 b: Clone::clone(&self.b),
7391 /// Creates a new tuple which has the same data as `orig`
7392 /// but with all dynamically-allocated buffers duplicated in new buffers.
7393 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
7394 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
7396 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
7397 C2Tuple_OutPointScriptZ { a, b, }
7401 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
7402 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
7404 /// A tuple of 2 elements. See the individual fields for the types contained.
7405 pub struct C2Tuple_u32ScriptZ {
7406 /// The element at position 0
7408 /// The element at position 1
7409 pub b: crate::c_types::derived::CVec_u8Z,
7411 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
7412 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
7419 impl C2Tuple_u32ScriptZ {
7420 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
7424 impl Clone for C2Tuple_u32ScriptZ {
7425 fn clone(&self) -> Self {
7427 a: Clone::clone(&self.a),
7428 b: Clone::clone(&self.b),
7433 /// Creates a new tuple which has the same data as `orig`
7434 /// but with all dynamically-allocated buffers duplicated in new buffers.
7435 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
7436 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
7438 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
7439 C2Tuple_u32ScriptZ { a, b, }
7443 /// Frees any resources used by the C2Tuple_u32ScriptZ.
7444 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
7446 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7447 /// This corresponds to std::vector in C++
7448 pub struct CVec_C2Tuple_u32ScriptZZ {
7449 /// The elements in the array.
7450 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7451 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
7452 /// The number of elements pointed to by `data`.
7455 impl CVec_C2Tuple_u32ScriptZZ {
7456 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
7457 if self.datalen == 0 { return Vec::new(); }
7458 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7459 self.data = std::ptr::null_mut();
7463 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
7464 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7467 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
7468 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
7469 let datalen = v.len();
7470 let data = Box::into_raw(v.into_boxed_slice());
7471 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7475 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7476 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
7477 impl Drop for CVec_C2Tuple_u32ScriptZZ {
7478 fn drop(&mut self) {
7479 if self.datalen == 0 { return; }
7480 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7483 impl Clone for CVec_C2Tuple_u32ScriptZZ {
7484 fn clone(&self) -> Self {
7485 let mut res = Vec::new();
7486 if self.datalen == 0 { return Self::from(res); }
7487 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7492 /// A tuple of 2 elements. See the individual fields for the types contained.
7493 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7494 /// The element at position 0
7495 pub a: crate::c_types::ThirtyTwoBytes,
7496 /// The element at position 1
7497 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
7499 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7500 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
7507 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7508 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
7512 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7513 fn clone(&self) -> Self {
7515 a: Clone::clone(&self.a),
7516 b: Clone::clone(&self.b),
7521 /// Creates a new tuple which has the same data as `orig`
7522 /// but with all dynamically-allocated buffers duplicated in new buffers.
7523 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
7524 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
7526 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 {
7527 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
7531 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
7532 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
7534 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
7535 /// This corresponds to std::vector in C++
7536 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7537 /// The elements in the array.
7538 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7539 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
7540 /// The number of elements pointed to by `data`.
7543 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7544 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
7545 if self.datalen == 0 { return Vec::new(); }
7546 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7547 self.data = std::ptr::null_mut();
7551 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
7552 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7555 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7556 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
7557 let datalen = v.len();
7558 let data = Box::into_raw(v.into_boxed_slice());
7559 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7563 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7564 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
7565 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7566 fn drop(&mut self) {
7567 if self.datalen == 0 { return; }
7568 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7571 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7572 fn clone(&self) -> Self {
7573 let mut res = Vec::new();
7574 if self.datalen == 0 { return Self::from(res); }
7575 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7580 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7581 /// This corresponds to std::vector in C++
7582 pub struct CVec_EventZ {
7583 /// The elements in the array.
7584 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7585 pub data: *mut crate::lightning::util::events::Event,
7586 /// The number of elements pointed to by `data`.
7590 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
7591 if self.datalen == 0 { return Vec::new(); }
7592 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7593 self.data = std::ptr::null_mut();
7597 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
7598 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7601 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
7602 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
7603 let datalen = v.len();
7604 let data = Box::into_raw(v.into_boxed_slice());
7605 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7609 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7610 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
7611 impl Drop for CVec_EventZ {
7612 fn drop(&mut self) {
7613 if self.datalen == 0 { return; }
7614 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7617 impl Clone for CVec_EventZ {
7618 fn clone(&self) -> Self {
7619 let mut res = Vec::new();
7620 if self.datalen == 0 { return Self::from(res); }
7621 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7626 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7627 /// This corresponds to std::vector in C++
7628 pub struct CVec_TransactionZ {
7629 /// The elements in the array.
7630 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7631 pub data: *mut crate::c_types::Transaction,
7632 /// The number of elements pointed to by `data`.
7635 impl CVec_TransactionZ {
7636 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
7637 if self.datalen == 0 { return Vec::new(); }
7638 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7639 self.data = std::ptr::null_mut();
7643 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
7644 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7647 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
7648 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
7649 let datalen = v.len();
7650 let data = Box::into_raw(v.into_boxed_slice());
7651 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7655 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7656 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
7657 impl Drop for CVec_TransactionZ {
7658 fn drop(&mut self) {
7659 if self.datalen == 0 { return; }
7660 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7663 impl Clone for CVec_TransactionZ {
7664 fn clone(&self) -> Self {
7665 let mut res = Vec::new();
7666 if self.datalen == 0 { return Self::from(res); }
7667 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7672 /// A tuple of 2 elements. See the individual fields for the types contained.
7673 pub struct C2Tuple_u32TxOutZ {
7674 /// The element at position 0
7676 /// The element at position 1
7677 pub b: crate::c_types::TxOut,
7679 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
7680 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
7687 impl C2Tuple_u32TxOutZ {
7688 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
7692 impl Clone for C2Tuple_u32TxOutZ {
7693 fn clone(&self) -> Self {
7695 a: Clone::clone(&self.a),
7696 b: Clone::clone(&self.b),
7701 /// Creates a new tuple which has the same data as `orig`
7702 /// but with all dynamically-allocated buffers duplicated in new buffers.
7703 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
7704 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
7706 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
7707 C2Tuple_u32TxOutZ { a, b, }
7711 /// Frees any resources used by the C2Tuple_u32TxOutZ.
7712 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
7714 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7715 /// This corresponds to std::vector in C++
7716 pub struct CVec_C2Tuple_u32TxOutZZ {
7717 /// The elements in the array.
7718 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7719 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
7720 /// The number of elements pointed to by `data`.
7723 impl CVec_C2Tuple_u32TxOutZZ {
7724 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
7725 if self.datalen == 0 { return Vec::new(); }
7726 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7727 self.data = std::ptr::null_mut();
7731 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
7732 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7735 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
7736 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
7737 let datalen = v.len();
7738 let data = Box::into_raw(v.into_boxed_slice());
7739 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7744 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
7745 impl Drop for CVec_C2Tuple_u32TxOutZZ {
7746 fn drop(&mut self) {
7747 if self.datalen == 0 { return; }
7748 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7751 impl Clone for CVec_C2Tuple_u32TxOutZZ {
7752 fn clone(&self) -> Self {
7753 let mut res = Vec::new();
7754 if self.datalen == 0 { return Self::from(res); }
7755 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7760 /// A tuple of 2 elements. See the individual fields for the types contained.
7761 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7762 /// The element at position 0
7763 pub a: crate::c_types::ThirtyTwoBytes,
7764 /// The element at position 1
7765 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
7767 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7768 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
7775 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7776 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
7780 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7781 fn clone(&self) -> Self {
7783 a: Clone::clone(&self.a),
7784 b: Clone::clone(&self.b),
7789 /// Creates a new tuple which has the same data as `orig`
7790 /// but with all dynamically-allocated buffers duplicated in new buffers.
7791 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
7792 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
7794 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 {
7795 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
7799 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
7800 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
7802 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7803 /// This corresponds to std::vector in C++
7804 pub struct CVec_TransactionOutputsZ {
7805 /// The elements in the array.
7806 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7807 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
7808 /// The number of elements pointed to by `data`.
7811 impl CVec_TransactionOutputsZ {
7812 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
7813 if self.datalen == 0 { return Vec::new(); }
7814 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7815 self.data = std::ptr::null_mut();
7819 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
7820 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7823 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
7824 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
7825 let datalen = v.len();
7826 let data = Box::into_raw(v.into_boxed_slice());
7827 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7832 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
7833 impl Drop for CVec_TransactionOutputsZ {
7834 fn drop(&mut self) {
7835 if self.datalen == 0 { return; }
7836 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7839 impl Clone for CVec_TransactionOutputsZ {
7840 fn clone(&self) -> Self {
7841 let mut res = Vec::new();
7842 if self.datalen == 0 { return Self::from(res); }
7843 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7848 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7849 /// This corresponds to std::vector in C++
7850 pub struct CVec_BalanceZ {
7851 /// The elements in the array.
7852 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7853 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
7854 /// The number of elements pointed to by `data`.
7857 impl CVec_BalanceZ {
7858 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
7859 if self.datalen == 0 { return Vec::new(); }
7860 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7861 self.data = std::ptr::null_mut();
7865 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
7866 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7869 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
7870 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
7871 let datalen = v.len();
7872 let data = Box::into_raw(v.into_boxed_slice());
7873 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7877 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7878 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
7879 impl Drop for CVec_BalanceZ {
7880 fn drop(&mut self) {
7881 if self.datalen == 0 { return; }
7882 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7885 impl Clone for CVec_BalanceZ {
7886 fn clone(&self) -> Self {
7887 let mut res = Vec::new();
7888 if self.datalen == 0 { return Self::from(res); }
7889 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7894 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7895 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7896 /// A pointer to the contents in the success state.
7897 /// Reading from this pointer when `result_ok` is not set is undefined.
7898 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7899 /// A pointer to the contents in the error state.
7900 /// Reading from this pointer when `result_ok` is set is undefined.
7901 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7904 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7905 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7907 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7908 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7909 /// `err` or `result` depending on the state of `result_ok`.
7910 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
7911 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7912 pub result_ok: bool,
7915 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
7916 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7917 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7918 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7919 result: Box::into_raw(Box::new(o)),
7925 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
7926 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7927 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7928 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7929 err: Box::into_raw(Box::new(e)),
7935 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
7936 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
7937 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7938 fn drop(&mut self) {
7940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7941 let _ = unsafe { Box::from_raw(self.contents.result) };
7944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7945 let _ = unsafe { Box::from_raw(self.contents.err) };
7950 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7951 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7952 let contents = if o.result_ok {
7953 let result = unsafe { o.contents.result };
7954 unsafe { o.contents.result = std::ptr::null_mut() };
7955 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
7957 let err = unsafe { o.contents.err };
7958 unsafe { o.contents.err = std::ptr::null_mut(); }
7959 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
7963 result_ok: o.result_ok,
7968 /// The contents of CResult_NoneLightningErrorZ
7969 pub union CResult_NoneLightningErrorZPtr {
7970 /// Note that this value is always NULL, as there are no contents in the OK variant
7971 pub result: *mut std::ffi::c_void,
7972 /// A pointer to the contents in the error state.
7973 /// Reading from this pointer when `result_ok` is set is undefined.
7974 pub err: *mut crate::lightning::ln::msgs::LightningError,
7977 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7978 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7980 pub struct CResult_NoneLightningErrorZ {
7981 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7982 /// `err` or `result` depending on the state of `result_ok`.
7983 pub contents: CResult_NoneLightningErrorZPtr,
7984 /// Whether this CResult_NoneLightningErrorZ represents a success state.
7985 pub result_ok: bool,
7988 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7989 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7990 CResult_NoneLightningErrorZ {
7991 contents: CResult_NoneLightningErrorZPtr {
7992 result: std::ptr::null_mut(),
7998 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7999 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
8000 CResult_NoneLightningErrorZ {
8001 contents: CResult_NoneLightningErrorZPtr {
8002 err: Box::into_raw(Box::new(e)),
8008 /// Frees any resources used by the CResult_NoneLightningErrorZ.
8009 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
8010 impl Drop for CResult_NoneLightningErrorZ {
8011 fn drop(&mut self) {
8014 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8015 let _ = unsafe { Box::from_raw(self.contents.err) };
8020 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
8021 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
8022 let contents = if o.result_ok {
8023 let _ = unsafe { Box::from_raw(o.contents.result) };
8024 o.contents.result = std::ptr::null_mut();
8025 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
8027 let err = unsafe { o.contents.err };
8028 unsafe { o.contents.err = std::ptr::null_mut(); }
8029 CResult_NoneLightningErrorZPtr { err }
8033 result_ok: o.result_ok,
8037 impl Clone for CResult_NoneLightningErrorZ {
8038 fn clone(&self) -> Self {
8040 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
8041 result: std::ptr::null_mut()
8044 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
8045 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8051 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8052 /// but with all dynamically-allocated buffers duplicated in new buffers.
8053 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
8055 /// A tuple of 2 elements. See the individual fields for the types contained.
8056 pub struct C2Tuple_PublicKeyTypeZ {
8057 /// The element at position 0
8058 pub a: crate::c_types::PublicKey,
8059 /// The element at position 1
8060 pub b: crate::lightning::ln::wire::Type,
8062 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
8063 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
8070 impl C2Tuple_PublicKeyTypeZ {
8071 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
8075 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
8077 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
8078 C2Tuple_PublicKeyTypeZ { a, b, }
8082 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
8083 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
8085 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8086 /// This corresponds to std::vector in C++
8087 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
8088 /// The elements in the array.
8089 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8090 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
8091 /// The number of elements pointed to by `data`.
8094 impl CVec_C2Tuple_PublicKeyTypeZZ {
8095 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
8096 if self.datalen == 0 { return Vec::new(); }
8097 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8098 self.data = std::ptr::null_mut();
8102 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
8103 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8106 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
8107 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
8108 let datalen = v.len();
8109 let data = Box::into_raw(v.into_boxed_slice());
8110 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8114 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8115 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
8116 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
8117 fn drop(&mut self) {
8118 if self.datalen == 0 { return; }
8119 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8123 /// The contents of CResult_boolLightningErrorZ
8124 pub union CResult_boolLightningErrorZPtr {
8125 /// A pointer to the contents in the success state.
8126 /// Reading from this pointer when `result_ok` is not set is undefined.
8127 pub result: *mut bool,
8128 /// A pointer to the contents in the error state.
8129 /// Reading from this pointer when `result_ok` is set is undefined.
8130 pub err: *mut crate::lightning::ln::msgs::LightningError,
8133 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
8134 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8136 pub struct CResult_boolLightningErrorZ {
8137 /// The contents of this CResult_boolLightningErrorZ, accessible via either
8138 /// `err` or `result` depending on the state of `result_ok`.
8139 pub contents: CResult_boolLightningErrorZPtr,
8140 /// Whether this CResult_boolLightningErrorZ represents a success state.
8141 pub result_ok: bool,
8144 /// Creates a new CResult_boolLightningErrorZ in the success state.
8145 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
8146 CResult_boolLightningErrorZ {
8147 contents: CResult_boolLightningErrorZPtr {
8148 result: Box::into_raw(Box::new(o)),
8154 /// Creates a new CResult_boolLightningErrorZ in the error state.
8155 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
8156 CResult_boolLightningErrorZ {
8157 contents: CResult_boolLightningErrorZPtr {
8158 err: Box::into_raw(Box::new(e)),
8164 /// Frees any resources used by the CResult_boolLightningErrorZ.
8165 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
8166 impl Drop for CResult_boolLightningErrorZ {
8167 fn drop(&mut self) {
8169 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8170 let _ = unsafe { Box::from_raw(self.contents.result) };
8173 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8174 let _ = unsafe { Box::from_raw(self.contents.err) };
8179 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
8180 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
8181 let contents = if o.result_ok {
8182 let result = unsafe { o.contents.result };
8183 unsafe { o.contents.result = std::ptr::null_mut() };
8184 CResult_boolLightningErrorZPtr { result }
8186 let err = unsafe { o.contents.err };
8187 unsafe { o.contents.err = std::ptr::null_mut(); }
8188 CResult_boolLightningErrorZPtr { err }
8192 result_ok: o.result_ok,
8196 impl Clone for CResult_boolLightningErrorZ {
8197 fn clone(&self) -> Self {
8199 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
8200 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8203 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
8204 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8210 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8211 /// but with all dynamically-allocated buffers duplicated in new buffers.
8212 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
8214 /// A tuple of 3 elements. See the individual fields for the types contained.
8215 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8216 /// The element at position 0
8217 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
8218 /// The element at position 1
8219 pub b: crate::lightning::ln::msgs::ChannelUpdate,
8220 /// The element at position 2
8221 pub c: crate::lightning::ln::msgs::ChannelUpdate,
8223 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8224 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
8232 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8233 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
8234 (self.a, self.b, self.c)
8237 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8238 fn clone(&self) -> Self {
8240 a: Clone::clone(&self.a),
8241 b: Clone::clone(&self.b),
8242 c: Clone::clone(&self.c),
8247 /// Creates a new tuple which has the same data as `orig`
8248 /// but with all dynamically-allocated buffers duplicated in new buffers.
8249 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
8250 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8252 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 {
8253 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
8257 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8258 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
8260 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
8261 /// This corresponds to std::vector in C++
8262 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8263 /// The elements in the array.
8264 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8265 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
8266 /// The number of elements pointed to by `data`.
8269 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8270 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
8271 if self.datalen == 0 { return Vec::new(); }
8272 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8273 self.data = std::ptr::null_mut();
8277 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
8278 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8281 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8282 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
8283 let datalen = v.len();
8284 let data = Box::into_raw(v.into_boxed_slice());
8285 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8289 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8290 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
8291 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8292 fn drop(&mut self) {
8293 if self.datalen == 0 { return; }
8294 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8297 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8298 fn clone(&self) -> Self {
8299 let mut res = Vec::new();
8300 if self.datalen == 0 { return Self::from(res); }
8301 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8306 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
8307 /// This corresponds to std::vector in C++
8308 pub struct CVec_NodeAnnouncementZ {
8309 /// The elements in the array.
8310 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8311 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
8312 /// The number of elements pointed to by `data`.
8315 impl CVec_NodeAnnouncementZ {
8316 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
8317 if self.datalen == 0 { return Vec::new(); }
8318 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8319 self.data = std::ptr::null_mut();
8323 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
8324 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8327 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
8328 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
8329 let datalen = v.len();
8330 let data = Box::into_raw(v.into_boxed_slice());
8331 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8335 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8336 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
8337 impl Drop for CVec_NodeAnnouncementZ {
8338 fn drop(&mut self) {
8339 if self.datalen == 0 { return; }
8340 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8343 impl Clone for CVec_NodeAnnouncementZ {
8344 fn clone(&self) -> Self {
8345 let mut res = Vec::new();
8346 if self.datalen == 0 { return Self::from(res); }
8347 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8352 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
8353 /// This corresponds to std::vector in C++
8354 pub struct CVec_PublicKeyZ {
8355 /// The elements in the array.
8356 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8357 pub data: *mut crate::c_types::PublicKey,
8358 /// The number of elements pointed to by `data`.
8361 impl CVec_PublicKeyZ {
8362 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
8363 if self.datalen == 0 { return Vec::new(); }
8364 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8365 self.data = std::ptr::null_mut();
8369 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
8370 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8373 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
8374 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
8375 let datalen = v.len();
8376 let data = Box::into_raw(v.into_boxed_slice());
8377 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8381 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8382 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
8383 impl Drop for CVec_PublicKeyZ {
8384 fn drop(&mut self) {
8385 if self.datalen == 0 { return; }
8386 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8389 impl Clone for CVec_PublicKeyZ {
8390 fn clone(&self) -> Self {
8391 let mut res = Vec::new();
8392 if self.datalen == 0 { return Self::from(res); }
8393 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8398 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
8399 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
8400 /// A pointer to the contents in the success state.
8401 /// Reading from this pointer when `result_ok` is not set is undefined.
8402 pub result: *mut crate::c_types::derived::CVec_u8Z,
8403 /// A pointer to the contents in the error state.
8404 /// Reading from this pointer when `result_ok` is set is undefined.
8405 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8408 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
8409 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8411 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
8412 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
8413 /// `err` or `result` depending on the state of `result_ok`.
8414 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
8415 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
8416 pub result_ok: bool,
8419 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
8420 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
8421 CResult_CVec_u8ZPeerHandleErrorZ {
8422 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8423 result: Box::into_raw(Box::new(o)),
8429 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
8430 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
8431 CResult_CVec_u8ZPeerHandleErrorZ {
8432 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8433 err: Box::into_raw(Box::new(e)),
8439 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
8440 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
8441 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
8442 fn drop(&mut self) {
8444 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8445 let _ = unsafe { Box::from_raw(self.contents.result) };
8448 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8449 let _ = unsafe { Box::from_raw(self.contents.err) };
8454 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
8455 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8456 let contents = if o.result_ok {
8457 let result = unsafe { o.contents.result };
8458 unsafe { o.contents.result = std::ptr::null_mut() };
8459 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
8461 let err = unsafe { o.contents.err };
8462 unsafe { o.contents.err = std::ptr::null_mut(); }
8463 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
8467 result_ok: o.result_ok,
8471 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
8472 fn clone(&self) -> Self {
8474 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8475 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
8478 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8479 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8485 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
8486 /// but with all dynamically-allocated buffers duplicated in new buffers.
8487 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
8489 /// The contents of CResult_NonePeerHandleErrorZ
8490 pub union CResult_NonePeerHandleErrorZPtr {
8491 /// Note that this value is always NULL, as there are no contents in the OK variant
8492 pub result: *mut std::ffi::c_void,
8493 /// A pointer to the contents in the error state.
8494 /// Reading from this pointer when `result_ok` is set is undefined.
8495 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8498 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
8499 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8501 pub struct CResult_NonePeerHandleErrorZ {
8502 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
8503 /// `err` or `result` depending on the state of `result_ok`.
8504 pub contents: CResult_NonePeerHandleErrorZPtr,
8505 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
8506 pub result_ok: bool,
8509 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
8510 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
8511 CResult_NonePeerHandleErrorZ {
8512 contents: CResult_NonePeerHandleErrorZPtr {
8513 result: std::ptr::null_mut(),
8519 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
8520 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
8521 CResult_NonePeerHandleErrorZ {
8522 contents: CResult_NonePeerHandleErrorZPtr {
8523 err: Box::into_raw(Box::new(e)),
8529 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
8530 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
8531 impl Drop for CResult_NonePeerHandleErrorZ {
8532 fn drop(&mut self) {
8535 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8536 let _ = unsafe { Box::from_raw(self.contents.err) };
8541 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
8542 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8543 let contents = if o.result_ok {
8544 let _ = unsafe { Box::from_raw(o.contents.result) };
8545 o.contents.result = std::ptr::null_mut();
8546 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
8548 let err = unsafe { o.contents.err };
8549 unsafe { o.contents.err = std::ptr::null_mut(); }
8550 CResult_NonePeerHandleErrorZPtr { err }
8554 result_ok: o.result_ok,
8558 impl Clone for CResult_NonePeerHandleErrorZ {
8559 fn clone(&self) -> Self {
8561 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
8562 result: std::ptr::null_mut()
8565 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
8566 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8572 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8573 /// but with all dynamically-allocated buffers duplicated in new buffers.
8574 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
8576 /// The contents of CResult_boolPeerHandleErrorZ
8577 pub union CResult_boolPeerHandleErrorZPtr {
8578 /// A pointer to the contents in the success state.
8579 /// Reading from this pointer when `result_ok` is not set is undefined.
8580 pub result: *mut bool,
8581 /// A pointer to the contents in the error state.
8582 /// Reading from this pointer when `result_ok` is set is undefined.
8583 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8586 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8587 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8589 pub struct CResult_boolPeerHandleErrorZ {
8590 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8591 /// `err` or `result` depending on the state of `result_ok`.
8592 pub contents: CResult_boolPeerHandleErrorZPtr,
8593 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
8594 pub result_ok: bool,
8597 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
8598 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
8599 CResult_boolPeerHandleErrorZ {
8600 contents: CResult_boolPeerHandleErrorZPtr {
8601 result: Box::into_raw(Box::new(o)),
8607 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
8608 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
8609 CResult_boolPeerHandleErrorZ {
8610 contents: CResult_boolPeerHandleErrorZPtr {
8611 err: Box::into_raw(Box::new(e)),
8617 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
8618 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
8619 impl Drop for CResult_boolPeerHandleErrorZ {
8620 fn drop(&mut self) {
8622 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8623 let _ = unsafe { Box::from_raw(self.contents.result) };
8626 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8627 let _ = unsafe { Box::from_raw(self.contents.err) };
8632 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
8633 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8634 let contents = if o.result_ok {
8635 let result = unsafe { o.contents.result };
8636 unsafe { o.contents.result = std::ptr::null_mut() };
8637 CResult_boolPeerHandleErrorZPtr { result }
8639 let err = unsafe { o.contents.err };
8640 unsafe { o.contents.err = std::ptr::null_mut(); }
8641 CResult_boolPeerHandleErrorZPtr { err }
8645 result_ok: o.result_ok,
8649 impl Clone for CResult_boolPeerHandleErrorZ {
8650 fn clone(&self) -> Self {
8652 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
8653 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8656 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
8657 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8663 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8664 /// but with all dynamically-allocated buffers duplicated in new buffers.
8665 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
8667 /// The contents of CResult_NodeIdDecodeErrorZ
8668 pub union CResult_NodeIdDecodeErrorZPtr {
8669 /// A pointer to the contents in the success state.
8670 /// Reading from this pointer when `result_ok` is not set is undefined.
8671 pub result: *mut crate::lightning::routing::network_graph::NodeId,
8672 /// A pointer to the contents in the error state.
8673 /// Reading from this pointer when `result_ok` is set is undefined.
8674 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8677 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8678 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8680 pub struct CResult_NodeIdDecodeErrorZ {
8681 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8682 /// `err` or `result` depending on the state of `result_ok`.
8683 pub contents: CResult_NodeIdDecodeErrorZPtr,
8684 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8685 pub result_ok: bool,
8688 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
8689 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
8690 CResult_NodeIdDecodeErrorZ {
8691 contents: CResult_NodeIdDecodeErrorZPtr {
8692 result: Box::into_raw(Box::new(o)),
8698 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
8699 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
8700 CResult_NodeIdDecodeErrorZ {
8701 contents: CResult_NodeIdDecodeErrorZPtr {
8702 err: Box::into_raw(Box::new(e)),
8708 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
8709 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
8710 impl Drop for CResult_NodeIdDecodeErrorZ {
8711 fn drop(&mut self) {
8713 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8714 let _ = unsafe { Box::from_raw(self.contents.result) };
8717 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8718 let _ = unsafe { Box::from_raw(self.contents.err) };
8723 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
8724 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
8725 let contents = if o.result_ok {
8726 let result = unsafe { o.contents.result };
8727 unsafe { o.contents.result = std::ptr::null_mut() };
8728 CResult_NodeIdDecodeErrorZPtr { result }
8730 let err = unsafe { o.contents.err };
8731 unsafe { o.contents.err = std::ptr::null_mut(); }
8732 CResult_NodeIdDecodeErrorZPtr { err }
8736 result_ok: o.result_ok,
8740 impl Clone for CResult_NodeIdDecodeErrorZ {
8741 fn clone(&self) -> Self {
8743 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
8744 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
8747 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
8748 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8754 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
8755 /// but with all dynamically-allocated buffers duplicated in new buffers.
8756 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
8758 /// An enum which can either contain a crate::lightning::chain::Access or not
8759 pub enum COption_AccessZ {
8760 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8761 Some(crate::lightning::chain::Access),
8762 /// When we're in this state, this COption_AccessZ contains nothing
8765 impl COption_AccessZ {
8766 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8767 if let Self::Some(_) = self { true } else { false }
8769 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8772 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
8773 if let Self::Some(v) = self { v } else { unreachable!() }
8777 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
8778 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
8779 COption_AccessZ::Some(o)
8782 /// Constructs a new COption_AccessZ containing nothing
8783 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
8784 COption_AccessZ::None
8787 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
8788 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
8790 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
8791 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
8792 /// A pointer to the contents in the success state.
8793 /// Reading from this pointer when `result_ok` is not set is undefined.
8794 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
8795 /// A pointer to the contents in the error state.
8796 /// Reading from this pointer when `result_ok` is set is undefined.
8797 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8800 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
8801 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8803 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
8804 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
8805 /// `err` or `result` depending on the state of `result_ok`.
8806 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
8807 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
8808 pub result_ok: bool,
8811 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8812 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8813 CResult_DirectionalChannelInfoDecodeErrorZ {
8814 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8815 result: Box::into_raw(Box::new(o)),
8821 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8822 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8823 CResult_DirectionalChannelInfoDecodeErrorZ {
8824 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8825 err: Box::into_raw(Box::new(e)),
8831 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8832 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
8833 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
8834 fn drop(&mut self) {
8836 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8837 let _ = unsafe { Box::from_raw(self.contents.result) };
8840 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8841 let _ = unsafe { Box::from_raw(self.contents.err) };
8846 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
8847 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8848 let contents = if o.result_ok {
8849 let result = unsafe { o.contents.result };
8850 unsafe { o.contents.result = std::ptr::null_mut() };
8851 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
8853 let err = unsafe { o.contents.err };
8854 unsafe { o.contents.err = std::ptr::null_mut(); }
8855 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
8859 result_ok: o.result_ok,
8863 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
8864 fn clone(&self) -> Self {
8866 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8867 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
8870 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8871 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8877 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8878 /// but with all dynamically-allocated buffers duplicated in new buffers.
8879 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8881 /// The contents of CResult_ChannelInfoDecodeErrorZ
8882 pub union CResult_ChannelInfoDecodeErrorZPtr {
8883 /// A pointer to the contents in the success state.
8884 /// Reading from this pointer when `result_ok` is not set is undefined.
8885 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
8886 /// A pointer to the contents in the error state.
8887 /// Reading from this pointer when `result_ok` is set is undefined.
8888 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8891 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8892 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8894 pub struct CResult_ChannelInfoDecodeErrorZ {
8895 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8896 /// `err` or `result` depending on the state of `result_ok`.
8897 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8898 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8899 pub result_ok: bool,
8902 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8903 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8904 CResult_ChannelInfoDecodeErrorZ {
8905 contents: CResult_ChannelInfoDecodeErrorZPtr {
8906 result: Box::into_raw(Box::new(o)),
8912 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8913 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8914 CResult_ChannelInfoDecodeErrorZ {
8915 contents: CResult_ChannelInfoDecodeErrorZPtr {
8916 err: Box::into_raw(Box::new(e)),
8922 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8923 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8924 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8925 fn drop(&mut self) {
8927 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8928 let _ = unsafe { Box::from_raw(self.contents.result) };
8931 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8932 let _ = unsafe { Box::from_raw(self.contents.err) };
8937 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8938 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8939 let contents = if o.result_ok {
8940 let result = unsafe { o.contents.result };
8941 unsafe { o.contents.result = std::ptr::null_mut() };
8942 CResult_ChannelInfoDecodeErrorZPtr { result }
8944 let err = unsafe { o.contents.err };
8945 unsafe { o.contents.err = std::ptr::null_mut(); }
8946 CResult_ChannelInfoDecodeErrorZPtr { err }
8950 result_ok: o.result_ok,
8954 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8955 fn clone(&self) -> Self {
8957 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8958 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8961 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8962 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8968 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8969 /// but with all dynamically-allocated buffers duplicated in new buffers.
8970 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8972 /// The contents of CResult_RoutingFeesDecodeErrorZ
8973 pub union CResult_RoutingFeesDecodeErrorZPtr {
8974 /// A pointer to the contents in the success state.
8975 /// Reading from this pointer when `result_ok` is not set is undefined.
8976 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
8977 /// A pointer to the contents in the error state.
8978 /// Reading from this pointer when `result_ok` is set is undefined.
8979 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8982 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8983 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8985 pub struct CResult_RoutingFeesDecodeErrorZ {
8986 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8987 /// `err` or `result` depending on the state of `result_ok`.
8988 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8989 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8990 pub result_ok: bool,
8993 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8994 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8995 CResult_RoutingFeesDecodeErrorZ {
8996 contents: CResult_RoutingFeesDecodeErrorZPtr {
8997 result: Box::into_raw(Box::new(o)),
9003 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
9004 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
9005 CResult_RoutingFeesDecodeErrorZ {
9006 contents: CResult_RoutingFeesDecodeErrorZPtr {
9007 err: Box::into_raw(Box::new(e)),
9013 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
9014 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
9015 impl Drop for CResult_RoutingFeesDecodeErrorZ {
9016 fn drop(&mut self) {
9018 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9019 let _ = unsafe { Box::from_raw(self.contents.result) };
9022 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9023 let _ = unsafe { Box::from_raw(self.contents.err) };
9028 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
9029 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
9030 let contents = if o.result_ok {
9031 let result = unsafe { o.contents.result };
9032 unsafe { o.contents.result = std::ptr::null_mut() };
9033 CResult_RoutingFeesDecodeErrorZPtr { result }
9035 let err = unsafe { o.contents.err };
9036 unsafe { o.contents.err = std::ptr::null_mut(); }
9037 CResult_RoutingFeesDecodeErrorZPtr { err }
9041 result_ok: o.result_ok,
9045 impl Clone for CResult_RoutingFeesDecodeErrorZ {
9046 fn clone(&self) -> Self {
9048 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
9049 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
9052 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
9053 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9059 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
9060 /// but with all dynamically-allocated buffers duplicated in new buffers.
9061 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
9063 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
9064 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9065 /// A pointer to the contents in the success state.
9066 /// Reading from this pointer when `result_ok` is not set is undefined.
9067 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
9068 /// A pointer to the contents in the error state.
9069 /// Reading from this pointer when `result_ok` is set is undefined.
9070 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9073 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
9074 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9076 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
9077 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
9078 /// `err` or `result` depending on the state of `result_ok`.
9079 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
9080 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
9081 pub result_ok: bool,
9084 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
9085 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
9086 CResult_NodeAnnouncementInfoDecodeErrorZ {
9087 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9088 result: Box::into_raw(Box::new(o)),
9094 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
9095 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
9096 CResult_NodeAnnouncementInfoDecodeErrorZ {
9097 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9098 err: Box::into_raw(Box::new(e)),
9104 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
9105 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
9106 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
9107 fn drop(&mut self) {
9109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9110 let _ = unsafe { Box::from_raw(self.contents.result) };
9113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9114 let _ = unsafe { Box::from_raw(self.contents.err) };
9119 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
9120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9121 let contents = if o.result_ok {
9122 let result = unsafe { o.contents.result };
9123 unsafe { o.contents.result = std::ptr::null_mut() };
9124 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
9126 let err = unsafe { o.contents.err };
9127 unsafe { o.contents.err = std::ptr::null_mut(); }
9128 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
9132 result_ok: o.result_ok,
9136 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
9137 fn clone(&self) -> Self {
9139 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9140 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
9143 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9144 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9150 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
9151 /// but with all dynamically-allocated buffers duplicated in new buffers.
9152 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
9154 /// A dynamically-allocated array of u64s of arbitrary size.
9155 /// This corresponds to std::vector in C++
9156 pub struct CVec_u64Z {
9157 /// The elements in the array.
9158 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9160 /// The number of elements pointed to by `data`.
9164 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
9165 if self.datalen == 0 { return Vec::new(); }
9166 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9167 self.data = std::ptr::null_mut();
9171 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
9172 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9175 impl From<Vec<u64>> for CVec_u64Z {
9176 fn from(v: Vec<u64>) -> Self {
9177 let datalen = v.len();
9178 let data = Box::into_raw(v.into_boxed_slice());
9179 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9183 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9184 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
9185 impl Drop for CVec_u64Z {
9186 fn drop(&mut self) {
9187 if self.datalen == 0 { return; }
9188 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9191 impl Clone for CVec_u64Z {
9192 fn clone(&self) -> Self {
9193 let mut res = Vec::new();
9194 if self.datalen == 0 { return Self::from(res); }
9195 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9200 /// The contents of CResult_NodeInfoDecodeErrorZ
9201 pub union CResult_NodeInfoDecodeErrorZPtr {
9202 /// A pointer to the contents in the success state.
9203 /// Reading from this pointer when `result_ok` is not set is undefined.
9204 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
9205 /// A pointer to the contents in the error state.
9206 /// Reading from this pointer when `result_ok` is set is undefined.
9207 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9210 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
9211 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9213 pub struct CResult_NodeInfoDecodeErrorZ {
9214 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
9215 /// `err` or `result` depending on the state of `result_ok`.
9216 pub contents: CResult_NodeInfoDecodeErrorZPtr,
9217 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
9218 pub result_ok: bool,
9221 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
9222 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
9223 CResult_NodeInfoDecodeErrorZ {
9224 contents: CResult_NodeInfoDecodeErrorZPtr {
9225 result: Box::into_raw(Box::new(o)),
9231 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
9232 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
9233 CResult_NodeInfoDecodeErrorZ {
9234 contents: CResult_NodeInfoDecodeErrorZPtr {
9235 err: Box::into_raw(Box::new(e)),
9241 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
9242 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
9243 impl Drop for CResult_NodeInfoDecodeErrorZ {
9244 fn drop(&mut self) {
9246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9247 let _ = unsafe { Box::from_raw(self.contents.result) };
9250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9251 let _ = unsafe { Box::from_raw(self.contents.err) };
9256 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
9257 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9258 let contents = if o.result_ok {
9259 let result = unsafe { o.contents.result };
9260 unsafe { o.contents.result = std::ptr::null_mut() };
9261 CResult_NodeInfoDecodeErrorZPtr { result }
9263 let err = unsafe { o.contents.err };
9264 unsafe { o.contents.err = std::ptr::null_mut(); }
9265 CResult_NodeInfoDecodeErrorZPtr { err }
9269 result_ok: o.result_ok,
9273 impl Clone for CResult_NodeInfoDecodeErrorZ {
9274 fn clone(&self) -> Self {
9276 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
9277 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
9280 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
9281 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9287 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
9288 /// but with all dynamically-allocated buffers duplicated in new buffers.
9289 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
9291 /// The contents of CResult_NetworkGraphDecodeErrorZ
9292 pub union CResult_NetworkGraphDecodeErrorZPtr {
9293 /// A pointer to the contents in the success state.
9294 /// Reading from this pointer when `result_ok` is not set is undefined.
9295 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
9296 /// A pointer to the contents in the error state.
9297 /// Reading from this pointer when `result_ok` is set is undefined.
9298 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9301 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
9302 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
9303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9304 pub struct CResult_NetworkGraphDecodeErrorZ {
9305 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
9306 /// `err` or `result` depending on the state of `result_ok`.
9307 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
9308 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
9309 pub result_ok: bool,
9312 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
9313 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
9314 CResult_NetworkGraphDecodeErrorZ {
9315 contents: CResult_NetworkGraphDecodeErrorZPtr {
9316 result: Box::into_raw(Box::new(o)),
9322 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
9323 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
9324 CResult_NetworkGraphDecodeErrorZ {
9325 contents: CResult_NetworkGraphDecodeErrorZPtr {
9326 err: Box::into_raw(Box::new(e)),
9332 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
9333 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
9334 impl Drop for CResult_NetworkGraphDecodeErrorZ {
9335 fn drop(&mut self) {
9337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9338 let _ = unsafe { Box::from_raw(self.contents.result) };
9341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9342 let _ = unsafe { Box::from_raw(self.contents.err) };
9347 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
9348 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
9349 let contents = if o.result_ok {
9350 let result = unsafe { o.contents.result };
9351 unsafe { o.contents.result = std::ptr::null_mut() };
9352 CResult_NetworkGraphDecodeErrorZPtr { result }
9354 let err = unsafe { o.contents.err };
9355 unsafe { o.contents.err = std::ptr::null_mut(); }
9356 CResult_NetworkGraphDecodeErrorZPtr { err }
9360 result_ok: o.result_ok,
9364 impl Clone for CResult_NetworkGraphDecodeErrorZ {
9365 fn clone(&self) -> Self {
9367 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
9368 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
9371 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
9372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9378 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
9379 /// but with all dynamically-allocated buffers duplicated in new buffers.
9380 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
9383 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
9384 pub enum COption_CVec_NetAddressZZ {
9385 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
9386 Some(crate::c_types::derived::CVec_NetAddressZ),
9387 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
9390 impl COption_CVec_NetAddressZZ {
9391 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9392 if let Self::Some(_) = self { true } else { false }
9394 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9397 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
9398 if let Self::Some(v) = self { v } else { unreachable!() }
9402 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
9403 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
9404 COption_CVec_NetAddressZZ::Some(o)
9407 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
9408 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
9409 COption_CVec_NetAddressZZ::None
9412 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
9413 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
9415 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
9416 /// but with all dynamically-allocated buffers duplicated in new buffers.
9417 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
9419 /// The contents of CResult_NetAddressDecodeErrorZ
9420 pub union CResult_NetAddressDecodeErrorZPtr {
9421 /// A pointer to the contents in the success state.
9422 /// Reading from this pointer when `result_ok` is not set is undefined.
9423 pub result: *mut crate::lightning::ln::msgs::NetAddress,
9424 /// A pointer to the contents in the error state.
9425 /// Reading from this pointer when `result_ok` is set is undefined.
9426 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9429 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9430 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9432 pub struct CResult_NetAddressDecodeErrorZ {
9433 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9434 /// `err` or `result` depending on the state of `result_ok`.
9435 pub contents: CResult_NetAddressDecodeErrorZPtr,
9436 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9437 pub result_ok: bool,
9440 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
9441 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
9442 CResult_NetAddressDecodeErrorZ {
9443 contents: CResult_NetAddressDecodeErrorZPtr {
9444 result: Box::into_raw(Box::new(o)),
9450 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
9451 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
9452 CResult_NetAddressDecodeErrorZ {
9453 contents: CResult_NetAddressDecodeErrorZPtr {
9454 err: Box::into_raw(Box::new(e)),
9460 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
9461 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
9462 impl Drop for CResult_NetAddressDecodeErrorZ {
9463 fn drop(&mut self) {
9465 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9466 let _ = unsafe { Box::from_raw(self.contents.result) };
9469 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9470 let _ = unsafe { Box::from_raw(self.contents.err) };
9475 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
9476 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
9477 let contents = if o.result_ok {
9478 let result = unsafe { o.contents.result };
9479 unsafe { o.contents.result = std::ptr::null_mut() };
9480 CResult_NetAddressDecodeErrorZPtr { result }
9482 let err = unsafe { o.contents.err };
9483 unsafe { o.contents.err = std::ptr::null_mut(); }
9484 CResult_NetAddressDecodeErrorZPtr { err }
9488 result_ok: o.result_ok,
9492 impl Clone for CResult_NetAddressDecodeErrorZ {
9493 fn clone(&self) -> Self {
9495 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
9496 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
9499 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
9500 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9506 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
9507 /// but with all dynamically-allocated buffers duplicated in new buffers.
9508 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
9510 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9511 /// This corresponds to std::vector in C++
9512 pub struct CVec_UpdateAddHTLCZ {
9513 /// The elements in the array.
9514 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9515 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9516 /// The number of elements pointed to by `data`.
9519 impl CVec_UpdateAddHTLCZ {
9520 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
9521 if self.datalen == 0 { return Vec::new(); }
9522 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9523 self.data = std::ptr::null_mut();
9527 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
9528 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9531 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
9532 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
9533 let datalen = v.len();
9534 let data = Box::into_raw(v.into_boxed_slice());
9535 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9539 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9540 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
9541 impl Drop for CVec_UpdateAddHTLCZ {
9542 fn drop(&mut self) {
9543 if self.datalen == 0 { return; }
9544 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9547 impl Clone for CVec_UpdateAddHTLCZ {
9548 fn clone(&self) -> Self {
9549 let mut res = Vec::new();
9550 if self.datalen == 0 { return Self::from(res); }
9551 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9556 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9557 /// This corresponds to std::vector in C++
9558 pub struct CVec_UpdateFulfillHTLCZ {
9559 /// The elements in the array.
9560 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9561 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9562 /// The number of elements pointed to by `data`.
9565 impl CVec_UpdateFulfillHTLCZ {
9566 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
9567 if self.datalen == 0 { return Vec::new(); }
9568 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9569 self.data = std::ptr::null_mut();
9573 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
9574 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9577 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
9578 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
9579 let datalen = v.len();
9580 let data = Box::into_raw(v.into_boxed_slice());
9581 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9585 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9586 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
9587 impl Drop for CVec_UpdateFulfillHTLCZ {
9588 fn drop(&mut self) {
9589 if self.datalen == 0 { return; }
9590 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9593 impl Clone for CVec_UpdateFulfillHTLCZ {
9594 fn clone(&self) -> Self {
9595 let mut res = Vec::new();
9596 if self.datalen == 0 { return Self::from(res); }
9597 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9602 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9603 /// This corresponds to std::vector in C++
9604 pub struct CVec_UpdateFailHTLCZ {
9605 /// The elements in the array.
9606 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9607 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9608 /// The number of elements pointed to by `data`.
9611 impl CVec_UpdateFailHTLCZ {
9612 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
9613 if self.datalen == 0 { return Vec::new(); }
9614 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9615 self.data = std::ptr::null_mut();
9619 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
9620 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9623 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
9624 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
9625 let datalen = v.len();
9626 let data = Box::into_raw(v.into_boxed_slice());
9627 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9631 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9632 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
9633 impl Drop for CVec_UpdateFailHTLCZ {
9634 fn drop(&mut self) {
9635 if self.datalen == 0 { return; }
9636 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9639 impl Clone for CVec_UpdateFailHTLCZ {
9640 fn clone(&self) -> Self {
9641 let mut res = Vec::new();
9642 if self.datalen == 0 { return Self::from(res); }
9643 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9648 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9649 /// This corresponds to std::vector in C++
9650 pub struct CVec_UpdateFailMalformedHTLCZ {
9651 /// The elements in the array.
9652 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9653 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9654 /// The number of elements pointed to by `data`.
9657 impl CVec_UpdateFailMalformedHTLCZ {
9658 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
9659 if self.datalen == 0 { return Vec::new(); }
9660 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9661 self.data = std::ptr::null_mut();
9665 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
9666 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9669 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
9670 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
9671 let datalen = v.len();
9672 let data = Box::into_raw(v.into_boxed_slice());
9673 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9677 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9678 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
9679 impl Drop for CVec_UpdateFailMalformedHTLCZ {
9680 fn drop(&mut self) {
9681 if self.datalen == 0 { return; }
9682 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9685 impl Clone for CVec_UpdateFailMalformedHTLCZ {
9686 fn clone(&self) -> Self {
9687 let mut res = Vec::new();
9688 if self.datalen == 0 { return Self::from(res); }
9689 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9694 /// The contents of CResult_AcceptChannelDecodeErrorZ
9695 pub union CResult_AcceptChannelDecodeErrorZPtr {
9696 /// A pointer to the contents in the success state.
9697 /// Reading from this pointer when `result_ok` is not set is undefined.
9698 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
9699 /// A pointer to the contents in the error state.
9700 /// Reading from this pointer when `result_ok` is set is undefined.
9701 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9704 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9705 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9707 pub struct CResult_AcceptChannelDecodeErrorZ {
9708 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9709 /// `err` or `result` depending on the state of `result_ok`.
9710 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
9711 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9712 pub result_ok: bool,
9715 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
9716 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
9717 CResult_AcceptChannelDecodeErrorZ {
9718 contents: CResult_AcceptChannelDecodeErrorZPtr {
9719 result: Box::into_raw(Box::new(o)),
9725 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
9726 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
9727 CResult_AcceptChannelDecodeErrorZ {
9728 contents: CResult_AcceptChannelDecodeErrorZPtr {
9729 err: Box::into_raw(Box::new(e)),
9735 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
9736 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
9737 impl Drop for CResult_AcceptChannelDecodeErrorZ {
9738 fn drop(&mut self) {
9740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9741 let _ = unsafe { Box::from_raw(self.contents.result) };
9744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9745 let _ = unsafe { Box::from_raw(self.contents.err) };
9750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
9751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9752 let contents = if o.result_ok {
9753 let result = unsafe { o.contents.result };
9754 unsafe { o.contents.result = std::ptr::null_mut() };
9755 CResult_AcceptChannelDecodeErrorZPtr { result }
9757 let err = unsafe { o.contents.err };
9758 unsafe { o.contents.err = std::ptr::null_mut(); }
9759 CResult_AcceptChannelDecodeErrorZPtr { err }
9763 result_ok: o.result_ok,
9767 impl Clone for CResult_AcceptChannelDecodeErrorZ {
9768 fn clone(&self) -> Self {
9770 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
9771 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
9774 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
9775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9781 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
9782 /// but with all dynamically-allocated buffers duplicated in new buffers.
9783 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
9785 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9786 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
9787 /// A pointer to the contents in the success state.
9788 /// Reading from this pointer when `result_ok` is not set is undefined.
9789 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
9790 /// A pointer to the contents in the error state.
9791 /// Reading from this pointer when `result_ok` is set is undefined.
9792 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9795 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9796 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9798 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
9799 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9800 /// `err` or `result` depending on the state of `result_ok`.
9801 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
9802 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9803 pub result_ok: bool,
9806 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
9807 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9808 CResult_AnnouncementSignaturesDecodeErrorZ {
9809 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9810 result: Box::into_raw(Box::new(o)),
9816 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
9817 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9818 CResult_AnnouncementSignaturesDecodeErrorZ {
9819 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9820 err: Box::into_raw(Box::new(e)),
9826 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
9827 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
9828 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
9829 fn drop(&mut self) {
9831 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9832 let _ = unsafe { Box::from_raw(self.contents.result) };
9835 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9836 let _ = unsafe { Box::from_raw(self.contents.err) };
9841 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9842 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
9843 let contents = if o.result_ok {
9844 let result = unsafe { o.contents.result };
9845 unsafe { o.contents.result = std::ptr::null_mut() };
9846 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
9848 let err = unsafe { o.contents.err };
9849 unsafe { o.contents.err = std::ptr::null_mut(); }
9850 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9854 result_ok: o.result_ok,
9858 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9859 fn clone(&self) -> Self {
9861 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9862 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9865 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9866 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9872 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9873 /// but with all dynamically-allocated buffers duplicated in new buffers.
9874 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9876 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9877 pub union CResult_ChannelReestablishDecodeErrorZPtr {
9878 /// A pointer to the contents in the success state.
9879 /// Reading from this pointer when `result_ok` is not set is undefined.
9880 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
9881 /// A pointer to the contents in the error state.
9882 /// Reading from this pointer when `result_ok` is set is undefined.
9883 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9886 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9887 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9889 pub struct CResult_ChannelReestablishDecodeErrorZ {
9890 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9891 /// `err` or `result` depending on the state of `result_ok`.
9892 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9893 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9894 pub result_ok: bool,
9897 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9898 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9899 CResult_ChannelReestablishDecodeErrorZ {
9900 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9901 result: Box::into_raw(Box::new(o)),
9907 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9908 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9909 CResult_ChannelReestablishDecodeErrorZ {
9910 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9911 err: Box::into_raw(Box::new(e)),
9917 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
9918 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9919 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
9920 fn drop(&mut self) {
9922 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9923 let _ = unsafe { Box::from_raw(self.contents.result) };
9926 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9927 let _ = unsafe { Box::from_raw(self.contents.err) };
9932 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9933 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
9934 let contents = if o.result_ok {
9935 let result = unsafe { o.contents.result };
9936 unsafe { o.contents.result = std::ptr::null_mut() };
9937 CResult_ChannelReestablishDecodeErrorZPtr { result }
9939 let err = unsafe { o.contents.err };
9940 unsafe { o.contents.err = std::ptr::null_mut(); }
9941 CResult_ChannelReestablishDecodeErrorZPtr { err }
9945 result_ok: o.result_ok,
9949 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9950 fn clone(&self) -> Self {
9952 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9953 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9956 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9957 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9963 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9964 /// but with all dynamically-allocated buffers duplicated in new buffers.
9965 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9967 /// The contents of CResult_ClosingSignedDecodeErrorZ
9968 pub union CResult_ClosingSignedDecodeErrorZPtr {
9969 /// A pointer to the contents in the success state.
9970 /// Reading from this pointer when `result_ok` is not set is undefined.
9971 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
9972 /// A pointer to the contents in the error state.
9973 /// Reading from this pointer when `result_ok` is set is undefined.
9974 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9977 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9978 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9980 pub struct CResult_ClosingSignedDecodeErrorZ {
9981 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9982 /// `err` or `result` depending on the state of `result_ok`.
9983 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9984 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9985 pub result_ok: bool,
9988 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9989 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9990 CResult_ClosingSignedDecodeErrorZ {
9991 contents: CResult_ClosingSignedDecodeErrorZPtr {
9992 result: Box::into_raw(Box::new(o)),
9998 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9999 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
10000 CResult_ClosingSignedDecodeErrorZ {
10001 contents: CResult_ClosingSignedDecodeErrorZPtr {
10002 err: Box::into_raw(Box::new(e)),
10008 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10009 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
10010 impl Drop for CResult_ClosingSignedDecodeErrorZ {
10011 fn drop(&mut self) {
10012 if self.result_ok {
10013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10014 let _ = unsafe { Box::from_raw(self.contents.result) };
10017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10018 let _ = unsafe { Box::from_raw(self.contents.err) };
10023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
10024 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10025 let contents = if o.result_ok {
10026 let result = unsafe { o.contents.result };
10027 unsafe { o.contents.result = std::ptr::null_mut() };
10028 CResult_ClosingSignedDecodeErrorZPtr { result }
10030 let err = unsafe { o.contents.err };
10031 unsafe { o.contents.err = std::ptr::null_mut(); }
10032 CResult_ClosingSignedDecodeErrorZPtr { err }
10036 result_ok: o.result_ok,
10040 impl Clone for CResult_ClosingSignedDecodeErrorZ {
10041 fn clone(&self) -> Self {
10042 if self.result_ok {
10043 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
10044 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
10047 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
10048 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10054 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10055 /// but with all dynamically-allocated buffers duplicated in new buffers.
10056 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
10058 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
10059 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10060 /// A pointer to the contents in the success state.
10061 /// Reading from this pointer when `result_ok` is not set is undefined.
10062 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
10063 /// A pointer to the contents in the error state.
10064 /// Reading from this pointer when `result_ok` is set is undefined.
10065 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10068 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
10069 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10071 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
10072 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
10073 /// `err` or `result` depending on the state of `result_ok`.
10074 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
10075 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
10076 pub result_ok: bool,
10079 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
10080 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
10081 CResult_ClosingSignedFeeRangeDecodeErrorZ {
10082 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10083 result: Box::into_raw(Box::new(o)),
10089 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
10090 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
10091 CResult_ClosingSignedFeeRangeDecodeErrorZ {
10092 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10093 err: Box::into_raw(Box::new(e)),
10099 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
10100 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
10101 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
10102 fn drop(&mut self) {
10103 if self.result_ok {
10104 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10105 let _ = unsafe { Box::from_raw(self.contents.result) };
10108 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10109 let _ = unsafe { Box::from_raw(self.contents.err) };
10114 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
10115 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10116 let contents = if o.result_ok {
10117 let result = unsafe { o.contents.result };
10118 unsafe { o.contents.result = std::ptr::null_mut() };
10119 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
10121 let err = unsafe { o.contents.err };
10122 unsafe { o.contents.err = std::ptr::null_mut(); }
10123 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
10127 result_ok: o.result_ok,
10131 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
10132 fn clone(&self) -> Self {
10133 if self.result_ok {
10134 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10135 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
10138 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10139 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10145 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
10146 /// but with all dynamically-allocated buffers duplicated in new buffers.
10147 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
10149 /// The contents of CResult_CommitmentSignedDecodeErrorZ
10150 pub union CResult_CommitmentSignedDecodeErrorZPtr {
10151 /// A pointer to the contents in the success state.
10152 /// Reading from this pointer when `result_ok` is not set is undefined.
10153 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
10154 /// A pointer to the contents in the error state.
10155 /// Reading from this pointer when `result_ok` is set is undefined.
10156 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10159 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
10160 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10162 pub struct CResult_CommitmentSignedDecodeErrorZ {
10163 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
10164 /// `err` or `result` depending on the state of `result_ok`.
10165 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
10166 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
10167 pub result_ok: bool,
10170 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10171 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
10172 CResult_CommitmentSignedDecodeErrorZ {
10173 contents: CResult_CommitmentSignedDecodeErrorZPtr {
10174 result: Box::into_raw(Box::new(o)),
10180 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10181 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
10182 CResult_CommitmentSignedDecodeErrorZ {
10183 contents: CResult_CommitmentSignedDecodeErrorZPtr {
10184 err: Box::into_raw(Box::new(e)),
10190 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10191 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
10192 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
10193 fn drop(&mut self) {
10194 if self.result_ok {
10195 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10196 let _ = unsafe { Box::from_raw(self.contents.result) };
10199 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10200 let _ = unsafe { Box::from_raw(self.contents.err) };
10205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
10206 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10207 let contents = if o.result_ok {
10208 let result = unsafe { o.contents.result };
10209 unsafe { o.contents.result = std::ptr::null_mut() };
10210 CResult_CommitmentSignedDecodeErrorZPtr { result }
10212 let err = unsafe { o.contents.err };
10213 unsafe { o.contents.err = std::ptr::null_mut(); }
10214 CResult_CommitmentSignedDecodeErrorZPtr { err }
10218 result_ok: o.result_ok,
10222 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
10223 fn clone(&self) -> Self {
10224 if self.result_ok {
10225 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
10226 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
10229 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
10230 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10236 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10237 /// but with all dynamically-allocated buffers duplicated in new buffers.
10238 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
10240 /// The contents of CResult_FundingCreatedDecodeErrorZ
10241 pub union CResult_FundingCreatedDecodeErrorZPtr {
10242 /// A pointer to the contents in the success state.
10243 /// Reading from this pointer when `result_ok` is not set is undefined.
10244 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
10245 /// A pointer to the contents in the error state.
10246 /// Reading from this pointer when `result_ok` is set is undefined.
10247 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10250 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
10251 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
10252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10253 pub struct CResult_FundingCreatedDecodeErrorZ {
10254 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
10255 /// `err` or `result` depending on the state of `result_ok`.
10256 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
10257 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
10258 pub result_ok: bool,
10261 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10262 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
10263 CResult_FundingCreatedDecodeErrorZ {
10264 contents: CResult_FundingCreatedDecodeErrorZPtr {
10265 result: Box::into_raw(Box::new(o)),
10271 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10272 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
10273 CResult_FundingCreatedDecodeErrorZ {
10274 contents: CResult_FundingCreatedDecodeErrorZPtr {
10275 err: Box::into_raw(Box::new(e)),
10281 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10282 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
10283 impl Drop for CResult_FundingCreatedDecodeErrorZ {
10284 fn drop(&mut self) {
10285 if self.result_ok {
10286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10287 let _ = unsafe { Box::from_raw(self.contents.result) };
10290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10291 let _ = unsafe { Box::from_raw(self.contents.err) };
10296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
10297 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
10298 let contents = if o.result_ok {
10299 let result = unsafe { o.contents.result };
10300 unsafe { o.contents.result = std::ptr::null_mut() };
10301 CResult_FundingCreatedDecodeErrorZPtr { result }
10303 let err = unsafe { o.contents.err };
10304 unsafe { o.contents.err = std::ptr::null_mut(); }
10305 CResult_FundingCreatedDecodeErrorZPtr { err }
10309 result_ok: o.result_ok,
10313 impl Clone for CResult_FundingCreatedDecodeErrorZ {
10314 fn clone(&self) -> Self {
10315 if self.result_ok {
10316 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
10317 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
10320 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
10321 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10327 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10328 /// but with all dynamically-allocated buffers duplicated in new buffers.
10329 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
10331 /// The contents of CResult_FundingSignedDecodeErrorZ
10332 pub union CResult_FundingSignedDecodeErrorZPtr {
10333 /// A pointer to the contents in the success state.
10334 /// Reading from this pointer when `result_ok` is not set is undefined.
10335 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
10336 /// A pointer to the contents in the error state.
10337 /// Reading from this pointer when `result_ok` is set is undefined.
10338 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10341 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
10342 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10344 pub struct CResult_FundingSignedDecodeErrorZ {
10345 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
10346 /// `err` or `result` depending on the state of `result_ok`.
10347 pub contents: CResult_FundingSignedDecodeErrorZPtr,
10348 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
10349 pub result_ok: bool,
10352 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10353 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
10354 CResult_FundingSignedDecodeErrorZ {
10355 contents: CResult_FundingSignedDecodeErrorZPtr {
10356 result: Box::into_raw(Box::new(o)),
10362 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10363 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
10364 CResult_FundingSignedDecodeErrorZ {
10365 contents: CResult_FundingSignedDecodeErrorZPtr {
10366 err: Box::into_raw(Box::new(e)),
10372 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10373 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
10374 impl Drop for CResult_FundingSignedDecodeErrorZ {
10375 fn drop(&mut self) {
10376 if self.result_ok {
10377 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10378 let _ = unsafe { Box::from_raw(self.contents.result) };
10381 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10382 let _ = unsafe { Box::from_raw(self.contents.err) };
10387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
10388 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10389 let contents = if o.result_ok {
10390 let result = unsafe { o.contents.result };
10391 unsafe { o.contents.result = std::ptr::null_mut() };
10392 CResult_FundingSignedDecodeErrorZPtr { result }
10394 let err = unsafe { o.contents.err };
10395 unsafe { o.contents.err = std::ptr::null_mut(); }
10396 CResult_FundingSignedDecodeErrorZPtr { err }
10400 result_ok: o.result_ok,
10404 impl Clone for CResult_FundingSignedDecodeErrorZ {
10405 fn clone(&self) -> Self {
10406 if self.result_ok {
10407 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
10408 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
10411 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
10412 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10418 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10419 /// but with all dynamically-allocated buffers duplicated in new buffers.
10420 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
10422 /// The contents of CResult_FundingLockedDecodeErrorZ
10423 pub union CResult_FundingLockedDecodeErrorZPtr {
10424 /// A pointer to the contents in the success state.
10425 /// Reading from this pointer when `result_ok` is not set is undefined.
10426 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
10427 /// A pointer to the contents in the error state.
10428 /// Reading from this pointer when `result_ok` is set is undefined.
10429 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10432 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
10433 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
10434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10435 pub struct CResult_FundingLockedDecodeErrorZ {
10436 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
10437 /// `err` or `result` depending on the state of `result_ok`.
10438 pub contents: CResult_FundingLockedDecodeErrorZPtr,
10439 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
10440 pub result_ok: bool,
10443 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10444 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
10445 CResult_FundingLockedDecodeErrorZ {
10446 contents: CResult_FundingLockedDecodeErrorZPtr {
10447 result: Box::into_raw(Box::new(o)),
10453 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10454 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
10455 CResult_FundingLockedDecodeErrorZ {
10456 contents: CResult_FundingLockedDecodeErrorZPtr {
10457 err: Box::into_raw(Box::new(e)),
10463 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10464 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
10465 impl Drop for CResult_FundingLockedDecodeErrorZ {
10466 fn drop(&mut self) {
10467 if self.result_ok {
10468 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10469 let _ = unsafe { Box::from_raw(self.contents.result) };
10472 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10473 let _ = unsafe { Box::from_raw(self.contents.err) };
10478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
10479 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
10480 let contents = if o.result_ok {
10481 let result = unsafe { o.contents.result };
10482 unsafe { o.contents.result = std::ptr::null_mut() };
10483 CResult_FundingLockedDecodeErrorZPtr { result }
10485 let err = unsafe { o.contents.err };
10486 unsafe { o.contents.err = std::ptr::null_mut(); }
10487 CResult_FundingLockedDecodeErrorZPtr { err }
10491 result_ok: o.result_ok,
10495 impl Clone for CResult_FundingLockedDecodeErrorZ {
10496 fn clone(&self) -> Self {
10497 if self.result_ok {
10498 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
10499 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
10502 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
10503 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10509 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10510 /// but with all dynamically-allocated buffers duplicated in new buffers.
10511 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
10513 /// The contents of CResult_InitDecodeErrorZ
10514 pub union CResult_InitDecodeErrorZPtr {
10515 /// A pointer to the contents in the success state.
10516 /// Reading from this pointer when `result_ok` is not set is undefined.
10517 pub result: *mut crate::lightning::ln::msgs::Init,
10518 /// A pointer to the contents in the error state.
10519 /// Reading from this pointer when `result_ok` is set is undefined.
10520 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10523 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
10524 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
10525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10526 pub struct CResult_InitDecodeErrorZ {
10527 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
10528 /// `err` or `result` depending on the state of `result_ok`.
10529 pub contents: CResult_InitDecodeErrorZPtr,
10530 /// Whether this CResult_InitDecodeErrorZ represents a success state.
10531 pub result_ok: bool,
10534 /// Creates a new CResult_InitDecodeErrorZ in the success state.
10535 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
10536 CResult_InitDecodeErrorZ {
10537 contents: CResult_InitDecodeErrorZPtr {
10538 result: Box::into_raw(Box::new(o)),
10544 /// Creates a new CResult_InitDecodeErrorZ in the error state.
10545 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
10546 CResult_InitDecodeErrorZ {
10547 contents: CResult_InitDecodeErrorZPtr {
10548 err: Box::into_raw(Box::new(e)),
10554 /// Frees any resources used by the CResult_InitDecodeErrorZ.
10555 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
10556 impl Drop for CResult_InitDecodeErrorZ {
10557 fn drop(&mut self) {
10558 if self.result_ok {
10559 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10560 let _ = unsafe { Box::from_raw(self.contents.result) };
10563 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10564 let _ = unsafe { Box::from_raw(self.contents.err) };
10569 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
10570 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
10571 let contents = if o.result_ok {
10572 let result = unsafe { o.contents.result };
10573 unsafe { o.contents.result = std::ptr::null_mut() };
10574 CResult_InitDecodeErrorZPtr { result }
10576 let err = unsafe { o.contents.err };
10577 unsafe { o.contents.err = std::ptr::null_mut(); }
10578 CResult_InitDecodeErrorZPtr { err }
10582 result_ok: o.result_ok,
10586 impl Clone for CResult_InitDecodeErrorZ {
10587 fn clone(&self) -> Self {
10588 if self.result_ok {
10589 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
10590 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
10593 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
10594 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10600 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10601 /// but with all dynamically-allocated buffers duplicated in new buffers.
10602 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
10604 /// The contents of CResult_OpenChannelDecodeErrorZ
10605 pub union CResult_OpenChannelDecodeErrorZPtr {
10606 /// A pointer to the contents in the success state.
10607 /// Reading from this pointer when `result_ok` is not set is undefined.
10608 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
10609 /// A pointer to the contents in the error state.
10610 /// Reading from this pointer when `result_ok` is set is undefined.
10611 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10614 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10615 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10617 pub struct CResult_OpenChannelDecodeErrorZ {
10618 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10619 /// `err` or `result` depending on the state of `result_ok`.
10620 pub contents: CResult_OpenChannelDecodeErrorZPtr,
10621 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10622 pub result_ok: bool,
10625 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10626 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
10627 CResult_OpenChannelDecodeErrorZ {
10628 contents: CResult_OpenChannelDecodeErrorZPtr {
10629 result: Box::into_raw(Box::new(o)),
10635 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10636 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
10637 CResult_OpenChannelDecodeErrorZ {
10638 contents: CResult_OpenChannelDecodeErrorZPtr {
10639 err: Box::into_raw(Box::new(e)),
10645 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10646 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
10647 impl Drop for CResult_OpenChannelDecodeErrorZ {
10648 fn drop(&mut self) {
10649 if self.result_ok {
10650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10651 let _ = unsafe { Box::from_raw(self.contents.result) };
10654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10655 let _ = unsafe { Box::from_raw(self.contents.err) };
10660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
10661 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
10662 let contents = if o.result_ok {
10663 let result = unsafe { o.contents.result };
10664 unsafe { o.contents.result = std::ptr::null_mut() };
10665 CResult_OpenChannelDecodeErrorZPtr { result }
10667 let err = unsafe { o.contents.err };
10668 unsafe { o.contents.err = std::ptr::null_mut(); }
10669 CResult_OpenChannelDecodeErrorZPtr { err }
10673 result_ok: o.result_ok,
10677 impl Clone for CResult_OpenChannelDecodeErrorZ {
10678 fn clone(&self) -> Self {
10679 if self.result_ok {
10680 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
10681 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
10684 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
10685 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10691 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10692 /// but with all dynamically-allocated buffers duplicated in new buffers.
10693 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
10695 /// The contents of CResult_RevokeAndACKDecodeErrorZ
10696 pub union CResult_RevokeAndACKDecodeErrorZPtr {
10697 /// A pointer to the contents in the success state.
10698 /// Reading from this pointer when `result_ok` is not set is undefined.
10699 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
10700 /// A pointer to the contents in the error state.
10701 /// Reading from this pointer when `result_ok` is set is undefined.
10702 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10705 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10706 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
10707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10708 pub struct CResult_RevokeAndACKDecodeErrorZ {
10709 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10710 /// `err` or `result` depending on the state of `result_ok`.
10711 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
10712 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10713 pub result_ok: bool,
10716 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10717 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
10718 CResult_RevokeAndACKDecodeErrorZ {
10719 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10720 result: Box::into_raw(Box::new(o)),
10726 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10727 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
10728 CResult_RevokeAndACKDecodeErrorZ {
10729 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10730 err: Box::into_raw(Box::new(e)),
10736 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10737 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
10738 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
10739 fn drop(&mut self) {
10740 if self.result_ok {
10741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10742 let _ = unsafe { Box::from_raw(self.contents.result) };
10745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10746 let _ = unsafe { Box::from_raw(self.contents.err) };
10751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
10752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
10753 let contents = if o.result_ok {
10754 let result = unsafe { o.contents.result };
10755 unsafe { o.contents.result = std::ptr::null_mut() };
10756 CResult_RevokeAndACKDecodeErrorZPtr { result }
10758 let err = unsafe { o.contents.err };
10759 unsafe { o.contents.err = std::ptr::null_mut(); }
10760 CResult_RevokeAndACKDecodeErrorZPtr { err }
10764 result_ok: o.result_ok,
10768 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
10769 fn clone(&self) -> Self {
10770 if self.result_ok {
10771 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10772 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
10775 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10776 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10782 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10783 /// but with all dynamically-allocated buffers duplicated in new buffers.
10784 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
10786 /// The contents of CResult_ShutdownDecodeErrorZ
10787 pub union CResult_ShutdownDecodeErrorZPtr {
10788 /// A pointer to the contents in the success state.
10789 /// Reading from this pointer when `result_ok` is not set is undefined.
10790 pub result: *mut crate::lightning::ln::msgs::Shutdown,
10791 /// A pointer to the contents in the error state.
10792 /// Reading from this pointer when `result_ok` is set is undefined.
10793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10796 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
10797 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
10798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10799 pub struct CResult_ShutdownDecodeErrorZ {
10800 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10801 /// `err` or `result` depending on the state of `result_ok`.
10802 pub contents: CResult_ShutdownDecodeErrorZPtr,
10803 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10804 pub result_ok: bool,
10807 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10808 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
10809 CResult_ShutdownDecodeErrorZ {
10810 contents: CResult_ShutdownDecodeErrorZPtr {
10811 result: Box::into_raw(Box::new(o)),
10817 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10818 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
10819 CResult_ShutdownDecodeErrorZ {
10820 contents: CResult_ShutdownDecodeErrorZPtr {
10821 err: Box::into_raw(Box::new(e)),
10827 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10828 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
10829 impl Drop for CResult_ShutdownDecodeErrorZ {
10830 fn drop(&mut self) {
10831 if self.result_ok {
10832 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10833 let _ = unsafe { Box::from_raw(self.contents.result) };
10836 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10837 let _ = unsafe { Box::from_raw(self.contents.err) };
10842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10843 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
10844 let contents = if o.result_ok {
10845 let result = unsafe { o.contents.result };
10846 unsafe { o.contents.result = std::ptr::null_mut() };
10847 CResult_ShutdownDecodeErrorZPtr { result }
10849 let err = unsafe { o.contents.err };
10850 unsafe { o.contents.err = std::ptr::null_mut(); }
10851 CResult_ShutdownDecodeErrorZPtr { err }
10855 result_ok: o.result_ok,
10859 impl Clone for CResult_ShutdownDecodeErrorZ {
10860 fn clone(&self) -> Self {
10861 if self.result_ok {
10862 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10863 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10866 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
10867 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10873 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10874 /// but with all dynamically-allocated buffers duplicated in new buffers.
10875 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10877 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10878 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
10879 /// A pointer to the contents in the success state.
10880 /// Reading from this pointer when `result_ok` is not set is undefined.
10881 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10882 /// A pointer to the contents in the error state.
10883 /// Reading from this pointer when `result_ok` is set is undefined.
10884 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10887 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10888 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10890 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
10891 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10892 /// `err` or `result` depending on the state of `result_ok`.
10893 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10894 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10895 pub result_ok: bool,
10898 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10899 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10900 CResult_UpdateFailHTLCDecodeErrorZ {
10901 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10902 result: Box::into_raw(Box::new(o)),
10908 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10909 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10910 CResult_UpdateFailHTLCDecodeErrorZ {
10911 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10912 err: Box::into_raw(Box::new(e)),
10918 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10919 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10920 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
10921 fn drop(&mut self) {
10922 if self.result_ok {
10923 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10924 let _ = unsafe { Box::from_raw(self.contents.result) };
10927 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10928 let _ = unsafe { Box::from_raw(self.contents.err) };
10933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10934 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10935 let contents = if o.result_ok {
10936 let result = unsafe { o.contents.result };
10937 unsafe { o.contents.result = std::ptr::null_mut() };
10938 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
10940 let err = unsafe { o.contents.err };
10941 unsafe { o.contents.err = std::ptr::null_mut(); }
10942 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10946 result_ok: o.result_ok,
10950 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10951 fn clone(&self) -> Self {
10952 if self.result_ok {
10953 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10954 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10957 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10958 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10964 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10965 /// but with all dynamically-allocated buffers duplicated in new buffers.
10966 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10968 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10969 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10970 /// A pointer to the contents in the success state.
10971 /// Reading from this pointer when `result_ok` is not set is undefined.
10972 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10973 /// A pointer to the contents in the error state.
10974 /// Reading from this pointer when `result_ok` is set is undefined.
10975 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10978 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10979 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10981 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10982 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10983 /// `err` or `result` depending on the state of `result_ok`.
10984 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10985 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10986 pub result_ok: bool,
10989 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10990 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10991 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10992 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10993 result: Box::into_raw(Box::new(o)),
10999 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11000 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11001 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11002 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11003 err: Box::into_raw(Box::new(e)),
11009 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
11010 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
11011 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11012 fn drop(&mut self) {
11013 if self.result_ok {
11014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11015 let _ = unsafe { Box::from_raw(self.contents.result) };
11018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11019 let _ = unsafe { Box::from_raw(self.contents.err) };
11024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11026 let contents = if o.result_ok {
11027 let result = unsafe { o.contents.result };
11028 unsafe { o.contents.result = std::ptr::null_mut() };
11029 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
11031 let err = unsafe { o.contents.err };
11032 unsafe { o.contents.err = std::ptr::null_mut(); }
11033 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
11037 result_ok: o.result_ok,
11041 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11042 fn clone(&self) -> Self {
11043 if self.result_ok {
11044 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11045 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
11048 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11049 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11055 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
11056 /// but with all dynamically-allocated buffers duplicated in new buffers.
11057 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
11059 /// The contents of CResult_UpdateFeeDecodeErrorZ
11060 pub union CResult_UpdateFeeDecodeErrorZPtr {
11061 /// A pointer to the contents in the success state.
11062 /// Reading from this pointer when `result_ok` is not set is undefined.
11063 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
11064 /// A pointer to the contents in the error state.
11065 /// Reading from this pointer when `result_ok` is set is undefined.
11066 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11069 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
11070 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
11071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11072 pub struct CResult_UpdateFeeDecodeErrorZ {
11073 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
11074 /// `err` or `result` depending on the state of `result_ok`.
11075 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
11076 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
11077 pub result_ok: bool,
11080 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
11081 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
11082 CResult_UpdateFeeDecodeErrorZ {
11083 contents: CResult_UpdateFeeDecodeErrorZPtr {
11084 result: Box::into_raw(Box::new(o)),
11090 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
11091 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
11092 CResult_UpdateFeeDecodeErrorZ {
11093 contents: CResult_UpdateFeeDecodeErrorZPtr {
11094 err: Box::into_raw(Box::new(e)),
11100 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
11101 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
11102 impl Drop for CResult_UpdateFeeDecodeErrorZ {
11103 fn drop(&mut self) {
11104 if self.result_ok {
11105 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11106 let _ = unsafe { Box::from_raw(self.contents.result) };
11109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11110 let _ = unsafe { Box::from_raw(self.contents.err) };
11115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
11116 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
11117 let contents = if o.result_ok {
11118 let result = unsafe { o.contents.result };
11119 unsafe { o.contents.result = std::ptr::null_mut() };
11120 CResult_UpdateFeeDecodeErrorZPtr { result }
11122 let err = unsafe { o.contents.err };
11123 unsafe { o.contents.err = std::ptr::null_mut(); }
11124 CResult_UpdateFeeDecodeErrorZPtr { err }
11128 result_ok: o.result_ok,
11132 impl Clone for CResult_UpdateFeeDecodeErrorZ {
11133 fn clone(&self) -> Self {
11134 if self.result_ok {
11135 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
11136 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
11139 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
11140 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11146 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
11147 /// but with all dynamically-allocated buffers duplicated in new buffers.
11148 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
11150 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
11151 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11152 /// A pointer to the contents in the success state.
11153 /// Reading from this pointer when `result_ok` is not set is undefined.
11154 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11155 /// A pointer to the contents in the error state.
11156 /// Reading from this pointer when `result_ok` is set is undefined.
11157 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11160 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
11161 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11163 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
11164 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
11165 /// `err` or `result` depending on the state of `result_ok`.
11166 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
11167 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
11168 pub result_ok: bool,
11171 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11172 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
11173 CResult_UpdateFulfillHTLCDecodeErrorZ {
11174 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11175 result: Box::into_raw(Box::new(o)),
11181 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11182 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
11183 CResult_UpdateFulfillHTLCDecodeErrorZ {
11184 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11185 err: Box::into_raw(Box::new(e)),
11191 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
11192 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
11193 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
11194 fn drop(&mut self) {
11195 if self.result_ok {
11196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11197 let _ = unsafe { Box::from_raw(self.contents.result) };
11200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11201 let _ = unsafe { Box::from_raw(self.contents.err) };
11206 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
11207 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11208 let contents = if o.result_ok {
11209 let result = unsafe { o.contents.result };
11210 unsafe { o.contents.result = std::ptr::null_mut() };
11211 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
11213 let err = unsafe { o.contents.err };
11214 unsafe { o.contents.err = std::ptr::null_mut(); }
11215 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
11219 result_ok: o.result_ok,
11223 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
11224 fn clone(&self) -> Self {
11225 if self.result_ok {
11226 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11227 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
11230 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11231 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11237 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11238 /// but with all dynamically-allocated buffers duplicated in new buffers.
11239 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
11241 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
11242 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
11243 /// A pointer to the contents in the success state.
11244 /// Reading from this pointer when `result_ok` is not set is undefined.
11245 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11246 /// A pointer to the contents in the error state.
11247 /// Reading from this pointer when `result_ok` is set is undefined.
11248 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11251 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
11252 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11254 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
11255 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
11256 /// `err` or `result` depending on the state of `result_ok`.
11257 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
11258 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
11259 pub result_ok: bool,
11262 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11263 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
11264 CResult_UpdateAddHTLCDecodeErrorZ {
11265 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11266 result: Box::into_raw(Box::new(o)),
11272 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11273 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
11274 CResult_UpdateAddHTLCDecodeErrorZ {
11275 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11276 err: Box::into_raw(Box::new(e)),
11282 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
11283 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
11284 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
11285 fn drop(&mut self) {
11286 if self.result_ok {
11287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11288 let _ = unsafe { Box::from_raw(self.contents.result) };
11291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11292 let _ = unsafe { Box::from_raw(self.contents.err) };
11297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
11298 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11299 let contents = if o.result_ok {
11300 let result = unsafe { o.contents.result };
11301 unsafe { o.contents.result = std::ptr::null_mut() };
11302 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
11304 let err = unsafe { o.contents.err };
11305 unsafe { o.contents.err = std::ptr::null_mut(); }
11306 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
11310 result_ok: o.result_ok,
11314 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
11315 fn clone(&self) -> Self {
11316 if self.result_ok {
11317 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11318 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
11321 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11322 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11328 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11329 /// but with all dynamically-allocated buffers duplicated in new buffers.
11330 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
11332 /// The contents of CResult_PingDecodeErrorZ
11333 pub union CResult_PingDecodeErrorZPtr {
11334 /// A pointer to the contents in the success state.
11335 /// Reading from this pointer when `result_ok` is not set is undefined.
11336 pub result: *mut crate::lightning::ln::msgs::Ping,
11337 /// A pointer to the contents in the error state.
11338 /// Reading from this pointer when `result_ok` is set is undefined.
11339 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11342 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
11343 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
11344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11345 pub struct CResult_PingDecodeErrorZ {
11346 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
11347 /// `err` or `result` depending on the state of `result_ok`.
11348 pub contents: CResult_PingDecodeErrorZPtr,
11349 /// Whether this CResult_PingDecodeErrorZ represents a success state.
11350 pub result_ok: bool,
11353 /// Creates a new CResult_PingDecodeErrorZ in the success state.
11354 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
11355 CResult_PingDecodeErrorZ {
11356 contents: CResult_PingDecodeErrorZPtr {
11357 result: Box::into_raw(Box::new(o)),
11363 /// Creates a new CResult_PingDecodeErrorZ in the error state.
11364 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
11365 CResult_PingDecodeErrorZ {
11366 contents: CResult_PingDecodeErrorZPtr {
11367 err: Box::into_raw(Box::new(e)),
11373 /// Frees any resources used by the CResult_PingDecodeErrorZ.
11374 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
11375 impl Drop for CResult_PingDecodeErrorZ {
11376 fn drop(&mut self) {
11377 if self.result_ok {
11378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11379 let _ = unsafe { Box::from_raw(self.contents.result) };
11382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11383 let _ = unsafe { Box::from_raw(self.contents.err) };
11388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
11389 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
11390 let contents = if o.result_ok {
11391 let result = unsafe { o.contents.result };
11392 unsafe { o.contents.result = std::ptr::null_mut() };
11393 CResult_PingDecodeErrorZPtr { result }
11395 let err = unsafe { o.contents.err };
11396 unsafe { o.contents.err = std::ptr::null_mut(); }
11397 CResult_PingDecodeErrorZPtr { err }
11401 result_ok: o.result_ok,
11405 impl Clone for CResult_PingDecodeErrorZ {
11406 fn clone(&self) -> Self {
11407 if self.result_ok {
11408 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
11409 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
11412 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
11413 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11419 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11420 /// but with all dynamically-allocated buffers duplicated in new buffers.
11421 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
11423 /// The contents of CResult_PongDecodeErrorZ
11424 pub union CResult_PongDecodeErrorZPtr {
11425 /// A pointer to the contents in the success state.
11426 /// Reading from this pointer when `result_ok` is not set is undefined.
11427 pub result: *mut crate::lightning::ln::msgs::Pong,
11428 /// A pointer to the contents in the error state.
11429 /// Reading from this pointer when `result_ok` is set is undefined.
11430 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11433 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11434 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11436 pub struct CResult_PongDecodeErrorZ {
11437 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
11438 /// `err` or `result` depending on the state of `result_ok`.
11439 pub contents: CResult_PongDecodeErrorZPtr,
11440 /// Whether this CResult_PongDecodeErrorZ represents a success state.
11441 pub result_ok: bool,
11444 /// Creates a new CResult_PongDecodeErrorZ in the success state.
11445 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
11446 CResult_PongDecodeErrorZ {
11447 contents: CResult_PongDecodeErrorZPtr {
11448 result: Box::into_raw(Box::new(o)),
11454 /// Creates a new CResult_PongDecodeErrorZ in the error state.
11455 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
11456 CResult_PongDecodeErrorZ {
11457 contents: CResult_PongDecodeErrorZPtr {
11458 err: Box::into_raw(Box::new(e)),
11464 /// Frees any resources used by the CResult_PongDecodeErrorZ.
11465 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
11466 impl Drop for CResult_PongDecodeErrorZ {
11467 fn drop(&mut self) {
11468 if self.result_ok {
11469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11470 let _ = unsafe { Box::from_raw(self.contents.result) };
11473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11474 let _ = unsafe { Box::from_raw(self.contents.err) };
11479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
11480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
11481 let contents = if o.result_ok {
11482 let result = unsafe { o.contents.result };
11483 unsafe { o.contents.result = std::ptr::null_mut() };
11484 CResult_PongDecodeErrorZPtr { result }
11486 let err = unsafe { o.contents.err };
11487 unsafe { o.contents.err = std::ptr::null_mut(); }
11488 CResult_PongDecodeErrorZPtr { err }
11492 result_ok: o.result_ok,
11496 impl Clone for CResult_PongDecodeErrorZ {
11497 fn clone(&self) -> Self {
11498 if self.result_ok {
11499 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
11500 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
11503 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
11504 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11510 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11511 /// but with all dynamically-allocated buffers duplicated in new buffers.
11512 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
11514 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11515 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11516 /// A pointer to the contents in the success state.
11517 /// Reading from this pointer when `result_ok` is not set is undefined.
11518 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
11519 /// A pointer to the contents in the error state.
11520 /// Reading from this pointer when `result_ok` is set is undefined.
11521 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11524 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11525 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11527 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11528 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11529 /// `err` or `result` depending on the state of `result_ok`.
11530 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
11531 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11532 pub result_ok: bool,
11535 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11536 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11537 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11538 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11539 result: Box::into_raw(Box::new(o)),
11545 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11546 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11547 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11548 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11549 err: Box::into_raw(Box::new(e)),
11555 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11556 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
11557 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11558 fn drop(&mut self) {
11559 if self.result_ok {
11560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11561 let _ = unsafe { Box::from_raw(self.contents.result) };
11564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11565 let _ = unsafe { Box::from_raw(self.contents.err) };
11570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11571 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11572 let contents = if o.result_ok {
11573 let result = unsafe { o.contents.result };
11574 unsafe { o.contents.result = std::ptr::null_mut() };
11575 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
11577 let err = unsafe { o.contents.err };
11578 unsafe { o.contents.err = std::ptr::null_mut(); }
11579 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
11583 result_ok: o.result_ok,
11587 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11588 fn clone(&self) -> Self {
11589 if self.result_ok {
11590 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11591 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11594 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11595 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11601 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11602 /// but with all dynamically-allocated buffers duplicated in new buffers.
11603 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11605 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
11606 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
11607 /// A pointer to the contents in the success state.
11608 /// Reading from this pointer when `result_ok` is not set is undefined.
11609 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
11610 /// A pointer to the contents in the error state.
11611 /// Reading from this pointer when `result_ok` is set is undefined.
11612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11615 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
11619 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11620 /// `err` or `result` depending on the state of `result_ok`.
11621 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
11622 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11623 pub result_ok: bool,
11626 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
11628 CResult_ChannelAnnouncementDecodeErrorZ {
11629 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11630 result: Box::into_raw(Box::new(o)),
11636 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
11638 CResult_ChannelAnnouncementDecodeErrorZ {
11639 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11640 err: Box::into_raw(Box::new(e)),
11646 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11647 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
11648 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
11649 fn drop(&mut self) {
11650 if self.result_ok {
11651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11652 let _ = unsafe { Box::from_raw(self.contents.result) };
11655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11656 let _ = unsafe { Box::from_raw(self.contents.err) };
11661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
11662 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11663 let contents = if o.result_ok {
11664 let result = unsafe { o.contents.result };
11665 unsafe { o.contents.result = std::ptr::null_mut() };
11666 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
11668 let err = unsafe { o.contents.err };
11669 unsafe { o.contents.err = std::ptr::null_mut(); }
11670 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
11674 result_ok: o.result_ok,
11678 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
11679 fn clone(&self) -> Self {
11680 if self.result_ok {
11681 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11682 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11685 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11686 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11692 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11693 /// but with all dynamically-allocated buffers duplicated in new buffers.
11694 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11696 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11697 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11698 /// A pointer to the contents in the success state.
11699 /// Reading from this pointer when `result_ok` is not set is undefined.
11700 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
11701 /// A pointer to the contents in the error state.
11702 /// Reading from this pointer when `result_ok` is set is undefined.
11703 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11706 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11707 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11709 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
11710 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11711 /// `err` or `result` depending on the state of `result_ok`.
11712 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
11713 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11714 pub result_ok: bool,
11717 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11718 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11719 CResult_UnsignedChannelUpdateDecodeErrorZ {
11720 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11721 result: Box::into_raw(Box::new(o)),
11727 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11728 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11729 CResult_UnsignedChannelUpdateDecodeErrorZ {
11730 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11731 err: Box::into_raw(Box::new(e)),
11737 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11738 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
11739 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
11740 fn drop(&mut self) {
11741 if self.result_ok {
11742 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11743 let _ = unsafe { Box::from_raw(self.contents.result) };
11746 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11747 let _ = unsafe { Box::from_raw(self.contents.err) };
11752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
11753 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11754 let contents = if o.result_ok {
11755 let result = unsafe { o.contents.result };
11756 unsafe { o.contents.result = std::ptr::null_mut() };
11757 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
11759 let err = unsafe { o.contents.err };
11760 unsafe { o.contents.err = std::ptr::null_mut(); }
11761 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
11765 result_ok: o.result_ok,
11769 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
11770 fn clone(&self) -> Self {
11771 if self.result_ok {
11772 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11773 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
11776 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11777 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11783 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11784 /// but with all dynamically-allocated buffers duplicated in new buffers.
11785 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11787 /// The contents of CResult_ChannelUpdateDecodeErrorZ
11788 pub union CResult_ChannelUpdateDecodeErrorZPtr {
11789 /// A pointer to the contents in the success state.
11790 /// Reading from this pointer when `result_ok` is not set is undefined.
11791 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
11792 /// A pointer to the contents in the error state.
11793 /// Reading from this pointer when `result_ok` is set is undefined.
11794 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11797 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11798 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11800 pub struct CResult_ChannelUpdateDecodeErrorZ {
11801 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11802 /// `err` or `result` depending on the state of `result_ok`.
11803 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
11804 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11805 pub result_ok: bool,
11808 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11809 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
11810 CResult_ChannelUpdateDecodeErrorZ {
11811 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11812 result: Box::into_raw(Box::new(o)),
11818 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11819 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
11820 CResult_ChannelUpdateDecodeErrorZ {
11821 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11822 err: Box::into_raw(Box::new(e)),
11828 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11829 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
11830 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
11831 fn drop(&mut self) {
11832 if self.result_ok {
11833 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11834 let _ = unsafe { Box::from_raw(self.contents.result) };
11837 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11838 let _ = unsafe { Box::from_raw(self.contents.err) };
11843 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11844 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11845 let contents = if o.result_ok {
11846 let result = unsafe { o.contents.result };
11847 unsafe { o.contents.result = std::ptr::null_mut() };
11848 CResult_ChannelUpdateDecodeErrorZPtr { result }
11850 let err = unsafe { o.contents.err };
11851 unsafe { o.contents.err = std::ptr::null_mut(); }
11852 CResult_ChannelUpdateDecodeErrorZPtr { err }
11856 result_ok: o.result_ok,
11860 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11861 fn clone(&self) -> Self {
11862 if self.result_ok {
11863 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11864 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11867 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11868 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11874 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11875 /// but with all dynamically-allocated buffers duplicated in new buffers.
11876 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11878 /// The contents of CResult_ErrorMessageDecodeErrorZ
11879 pub union CResult_ErrorMessageDecodeErrorZPtr {
11880 /// A pointer to the contents in the success state.
11881 /// Reading from this pointer when `result_ok` is not set is undefined.
11882 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11883 /// A pointer to the contents in the error state.
11884 /// Reading from this pointer when `result_ok` is set is undefined.
11885 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11888 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11889 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11891 pub struct CResult_ErrorMessageDecodeErrorZ {
11892 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11893 /// `err` or `result` depending on the state of `result_ok`.
11894 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11895 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11896 pub result_ok: bool,
11899 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11900 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11901 CResult_ErrorMessageDecodeErrorZ {
11902 contents: CResult_ErrorMessageDecodeErrorZPtr {
11903 result: Box::into_raw(Box::new(o)),
11909 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11910 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11911 CResult_ErrorMessageDecodeErrorZ {
11912 contents: CResult_ErrorMessageDecodeErrorZPtr {
11913 err: Box::into_raw(Box::new(e)),
11919 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11920 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11921 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11922 fn drop(&mut self) {
11923 if self.result_ok {
11924 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11925 let _ = unsafe { Box::from_raw(self.contents.result) };
11928 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11929 let _ = unsafe { Box::from_raw(self.contents.err) };
11934 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11935 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11936 let contents = if o.result_ok {
11937 let result = unsafe { o.contents.result };
11938 unsafe { o.contents.result = std::ptr::null_mut() };
11939 CResult_ErrorMessageDecodeErrorZPtr { result }
11941 let err = unsafe { o.contents.err };
11942 unsafe { o.contents.err = std::ptr::null_mut(); }
11943 CResult_ErrorMessageDecodeErrorZPtr { err }
11947 result_ok: o.result_ok,
11951 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11952 fn clone(&self) -> Self {
11953 if self.result_ok {
11954 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11955 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11958 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11959 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11965 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11966 /// but with all dynamically-allocated buffers duplicated in new buffers.
11967 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11969 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11970 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11971 /// A pointer to the contents in the success state.
11972 /// Reading from this pointer when `result_ok` is not set is undefined.
11973 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11974 /// A pointer to the contents in the error state.
11975 /// Reading from this pointer when `result_ok` is set is undefined.
11976 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11979 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11980 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11982 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11983 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11984 /// `err` or `result` depending on the state of `result_ok`.
11985 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11986 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11987 pub result_ok: bool,
11990 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11991 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11992 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11993 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11994 result: Box::into_raw(Box::new(o)),
12000 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
12001 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12002 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12003 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12004 err: Box::into_raw(Box::new(e)),
12010 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
12011 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
12012 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12013 fn drop(&mut self) {
12014 if self.result_ok {
12015 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12016 let _ = unsafe { Box::from_raw(self.contents.result) };
12019 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12020 let _ = unsafe { Box::from_raw(self.contents.err) };
12025 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12026 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12027 let contents = if o.result_ok {
12028 let result = unsafe { o.contents.result };
12029 unsafe { o.contents.result = std::ptr::null_mut() };
12030 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
12032 let err = unsafe { o.contents.err };
12033 unsafe { o.contents.err = std::ptr::null_mut(); }
12034 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
12038 result_ok: o.result_ok,
12042 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12043 fn clone(&self) -> Self {
12044 if self.result_ok {
12045 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12046 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
12049 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12050 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12056 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
12057 /// but with all dynamically-allocated buffers duplicated in new buffers.
12058 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12060 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
12061 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
12062 /// A pointer to the contents in the success state.
12063 /// Reading from this pointer when `result_ok` is not set is undefined.
12064 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
12065 /// A pointer to the contents in the error state.
12066 /// Reading from this pointer when `result_ok` is set is undefined.
12067 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12070 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
12071 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12073 pub struct CResult_NodeAnnouncementDecodeErrorZ {
12074 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
12075 /// `err` or `result` depending on the state of `result_ok`.
12076 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
12077 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
12078 pub result_ok: bool,
12081 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
12082 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
12083 CResult_NodeAnnouncementDecodeErrorZ {
12084 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
12085 result: Box::into_raw(Box::new(o)),
12091 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
12092 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
12093 CResult_NodeAnnouncementDecodeErrorZ {
12094 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
12095 err: Box::into_raw(Box::new(e)),
12101 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
12102 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
12103 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
12104 fn drop(&mut self) {
12105 if self.result_ok {
12106 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12107 let _ = unsafe { Box::from_raw(self.contents.result) };
12110 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12111 let _ = unsafe { Box::from_raw(self.contents.err) };
12116 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
12117 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12118 let contents = if o.result_ok {
12119 let result = unsafe { o.contents.result };
12120 unsafe { o.contents.result = std::ptr::null_mut() };
12121 CResult_NodeAnnouncementDecodeErrorZPtr { result }
12123 let err = unsafe { o.contents.err };
12124 unsafe { o.contents.err = std::ptr::null_mut(); }
12125 CResult_NodeAnnouncementDecodeErrorZPtr { err }
12129 result_ok: o.result_ok,
12133 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
12134 fn clone(&self) -> Self {
12135 if self.result_ok {
12136 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
12137 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
12140 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
12141 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12147 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
12148 /// but with all dynamically-allocated buffers duplicated in new buffers.
12149 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12151 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
12152 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
12153 /// A pointer to the contents in the success state.
12154 /// Reading from this pointer when `result_ok` is not set is undefined.
12155 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
12156 /// A pointer to the contents in the error state.
12157 /// Reading from this pointer when `result_ok` is set is undefined.
12158 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12161 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
12162 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
12163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12164 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
12165 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
12166 /// `err` or `result` depending on the state of `result_ok`.
12167 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
12168 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
12169 pub result_ok: bool,
12172 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
12173 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
12174 CResult_QueryShortChannelIdsDecodeErrorZ {
12175 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12176 result: Box::into_raw(Box::new(o)),
12182 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
12183 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
12184 CResult_QueryShortChannelIdsDecodeErrorZ {
12185 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12186 err: Box::into_raw(Box::new(e)),
12192 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
12193 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
12194 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
12195 fn drop(&mut self) {
12196 if self.result_ok {
12197 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12198 let _ = unsafe { Box::from_raw(self.contents.result) };
12201 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12202 let _ = unsafe { Box::from_raw(self.contents.err) };
12207 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
12208 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
12209 let contents = if o.result_ok {
12210 let result = unsafe { o.contents.result };
12211 unsafe { o.contents.result = std::ptr::null_mut() };
12212 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
12214 let err = unsafe { o.contents.err };
12215 unsafe { o.contents.err = std::ptr::null_mut(); }
12216 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
12220 result_ok: o.result_ok,
12224 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
12225 fn clone(&self) -> Self {
12226 if self.result_ok {
12227 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12228 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
12231 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12232 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12238 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
12239 /// but with all dynamically-allocated buffers duplicated in new buffers.
12240 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
12242 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
12243 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12244 /// A pointer to the contents in the success state.
12245 /// Reading from this pointer when `result_ok` is not set is undefined.
12246 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
12247 /// A pointer to the contents in the error state.
12248 /// Reading from this pointer when `result_ok` is set is undefined.
12249 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12252 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
12253 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
12254 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12255 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12256 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
12257 /// `err` or `result` depending on the state of `result_ok`.
12258 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
12259 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
12260 pub result_ok: bool,
12263 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
12264 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12265 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12266 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12267 result: Box::into_raw(Box::new(o)),
12273 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
12274 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12275 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12276 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12277 err: Box::into_raw(Box::new(e)),
12283 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
12284 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
12285 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12286 fn drop(&mut self) {
12287 if self.result_ok {
12288 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12289 let _ = unsafe { Box::from_raw(self.contents.result) };
12292 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12293 let _ = unsafe { Box::from_raw(self.contents.err) };
12298 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12299 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
12300 let contents = if o.result_ok {
12301 let result = unsafe { o.contents.result };
12302 unsafe { o.contents.result = std::ptr::null_mut() };
12303 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
12305 let err = unsafe { o.contents.err };
12306 unsafe { o.contents.err = std::ptr::null_mut(); }
12307 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
12311 result_ok: o.result_ok,
12315 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12316 fn clone(&self) -> Self {
12317 if self.result_ok {
12318 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12319 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
12322 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12323 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12329 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
12330 /// but with all dynamically-allocated buffers duplicated in new buffers.
12331 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
12333 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
12334 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
12335 /// A pointer to the contents in the success state.
12336 /// Reading from this pointer when `result_ok` is not set is undefined.
12337 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
12338 /// A pointer to the contents in the error state.
12339 /// Reading from this pointer when `result_ok` is set is undefined.
12340 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12343 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
12344 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12346 pub struct CResult_QueryChannelRangeDecodeErrorZ {
12347 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
12348 /// `err` or `result` depending on the state of `result_ok`.
12349 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
12350 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
12351 pub result_ok: bool,
12354 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
12355 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
12356 CResult_QueryChannelRangeDecodeErrorZ {
12357 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12358 result: Box::into_raw(Box::new(o)),
12364 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
12365 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
12366 CResult_QueryChannelRangeDecodeErrorZ {
12367 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12368 err: Box::into_raw(Box::new(e)),
12374 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
12375 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
12376 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
12377 fn drop(&mut self) {
12378 if self.result_ok {
12379 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12380 let _ = unsafe { Box::from_raw(self.contents.result) };
12383 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12384 let _ = unsafe { Box::from_raw(self.contents.err) };
12389 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
12390 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12391 let contents = if o.result_ok {
12392 let result = unsafe { o.contents.result };
12393 unsafe { o.contents.result = std::ptr::null_mut() };
12394 CResult_QueryChannelRangeDecodeErrorZPtr { result }
12396 let err = unsafe { o.contents.err };
12397 unsafe { o.contents.err = std::ptr::null_mut(); }
12398 CResult_QueryChannelRangeDecodeErrorZPtr { err }
12402 result_ok: o.result_ok,
12406 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
12407 fn clone(&self) -> Self {
12408 if self.result_ok {
12409 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12410 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
12413 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12414 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12420 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
12421 /// but with all dynamically-allocated buffers duplicated in new buffers.
12422 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12424 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
12425 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
12426 /// A pointer to the contents in the success state.
12427 /// Reading from this pointer when `result_ok` is not set is undefined.
12428 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
12429 /// A pointer to the contents in the error state.
12430 /// Reading from this pointer when `result_ok` is set is undefined.
12431 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12434 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12435 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12436 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12437 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
12438 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12439 /// `err` or `result` depending on the state of `result_ok`.
12440 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
12441 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12442 pub result_ok: bool,
12445 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
12446 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
12447 CResult_ReplyChannelRangeDecodeErrorZ {
12448 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12449 result: Box::into_raw(Box::new(o)),
12455 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
12456 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
12457 CResult_ReplyChannelRangeDecodeErrorZ {
12458 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12459 err: Box::into_raw(Box::new(e)),
12465 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
12466 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
12467 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
12468 fn drop(&mut self) {
12469 if self.result_ok {
12470 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12471 let _ = unsafe { Box::from_raw(self.contents.result) };
12474 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12475 let _ = unsafe { Box::from_raw(self.contents.err) };
12480 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
12481 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12482 let contents = if o.result_ok {
12483 let result = unsafe { o.contents.result };
12484 unsafe { o.contents.result = std::ptr::null_mut() };
12485 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
12487 let err = unsafe { o.contents.err };
12488 unsafe { o.contents.err = std::ptr::null_mut(); }
12489 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
12493 result_ok: o.result_ok,
12497 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
12498 fn clone(&self) -> Self {
12499 if self.result_ok {
12500 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12501 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
12504 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12505 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12511 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
12512 /// but with all dynamically-allocated buffers duplicated in new buffers.
12513 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12515 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
12516 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
12517 /// A pointer to the contents in the success state.
12518 /// Reading from this pointer when `result_ok` is not set is undefined.
12519 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
12520 /// A pointer to the contents in the error state.
12521 /// Reading from this pointer when `result_ok` is set is undefined.
12522 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12525 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12526 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12528 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
12529 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12530 /// `err` or `result` depending on the state of `result_ok`.
12531 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
12532 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12533 pub result_ok: bool,
12536 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
12537 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
12538 CResult_GossipTimestampFilterDecodeErrorZ {
12539 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12540 result: Box::into_raw(Box::new(o)),
12546 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
12547 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
12548 CResult_GossipTimestampFilterDecodeErrorZ {
12549 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12550 err: Box::into_raw(Box::new(e)),
12556 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
12557 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
12558 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
12559 fn drop(&mut self) {
12560 if self.result_ok {
12561 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12562 let _ = unsafe { Box::from_raw(self.contents.result) };
12565 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12566 let _ = unsafe { Box::from_raw(self.contents.err) };
12571 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
12572 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
12573 let contents = if o.result_ok {
12574 let result = unsafe { o.contents.result };
12575 unsafe { o.contents.result = std::ptr::null_mut() };
12576 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
12578 let err = unsafe { o.contents.err };
12579 unsafe { o.contents.err = std::ptr::null_mut(); }
12580 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
12584 result_ok: o.result_ok,
12588 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
12589 fn clone(&self) -> Self {
12590 if self.result_ok {
12591 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12592 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
12595 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12596 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12602 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
12603 /// but with all dynamically-allocated buffers duplicated in new buffers.
12604 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
12606 /// The contents of CResult_InvoiceSignOrCreationErrorZ
12607 pub union CResult_InvoiceSignOrCreationErrorZPtr {
12608 /// A pointer to the contents in the success state.
12609 /// Reading from this pointer when `result_ok` is not set is undefined.
12610 pub result: *mut crate::lightning_invoice::Invoice,
12611 /// A pointer to the contents in the error state.
12612 /// Reading from this pointer when `result_ok` is set is undefined.
12613 pub err: *mut crate::lightning_invoice::SignOrCreationError,
12616 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12617 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12619 pub struct CResult_InvoiceSignOrCreationErrorZ {
12620 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
12621 /// `err` or `result` depending on the state of `result_ok`.
12622 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
12623 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
12624 pub result_ok: bool,
12627 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
12628 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
12629 CResult_InvoiceSignOrCreationErrorZ {
12630 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12631 result: Box::into_raw(Box::new(o)),
12637 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
12638 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
12639 CResult_InvoiceSignOrCreationErrorZ {
12640 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12641 err: Box::into_raw(Box::new(e)),
12647 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
12648 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
12649 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
12650 fn drop(&mut self) {
12651 if self.result_ok {
12652 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12653 let _ = unsafe { Box::from_raw(self.contents.result) };
12656 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12657 let _ = unsafe { Box::from_raw(self.contents.err) };
12662 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
12663 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
12664 let contents = if o.result_ok {
12665 let result = unsafe { o.contents.result };
12666 unsafe { o.contents.result = std::ptr::null_mut() };
12667 CResult_InvoiceSignOrCreationErrorZPtr { result }
12669 let err = unsafe { o.contents.err };
12670 unsafe { o.contents.err = std::ptr::null_mut(); }
12671 CResult_InvoiceSignOrCreationErrorZPtr { err }
12675 result_ok: o.result_ok,
12679 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
12680 fn clone(&self) -> Self {
12681 if self.result_ok {
12682 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12683 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12686 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12687 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
12693 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
12694 /// but with all dynamically-allocated buffers duplicated in new buffers.
12695 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
12697 /// An enum which can either contain a crate::lightning::chain::Filter or not
12698 pub enum COption_FilterZ {
12699 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
12700 Some(crate::lightning::chain::Filter),
12701 /// When we're in this state, this COption_FilterZ contains nothing
12704 impl COption_FilterZ {
12705 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12706 if let Self::Some(_) = self { true } else { false }
12708 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12711 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
12712 if let Self::Some(v) = self { v } else { unreachable!() }
12716 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
12717 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
12718 COption_FilterZ::Some(o)
12721 /// Constructs a new COption_FilterZ containing nothing
12722 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
12723 COption_FilterZ::None
12726 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
12727 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
12729 /// The contents of CResult_LockedChannelMonitorNoneZ
12730 pub union CResult_LockedChannelMonitorNoneZPtr {
12731 /// A pointer to the contents in the success state.
12732 /// Reading from this pointer when `result_ok` is not set is undefined.
12733 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
12734 /// Note that this value is always NULL, as there are no contents in the Err variant
12735 pub err: *mut std::ffi::c_void,
12738 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
12739 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
12740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12741 pub struct CResult_LockedChannelMonitorNoneZ {
12742 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
12743 /// `err` or `result` depending on the state of `result_ok`.
12744 pub contents: CResult_LockedChannelMonitorNoneZPtr,
12745 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
12746 pub result_ok: bool,
12749 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
12750 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
12751 CResult_LockedChannelMonitorNoneZ {
12752 contents: CResult_LockedChannelMonitorNoneZPtr {
12753 result: Box::into_raw(Box::new(o)),
12759 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
12760 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
12761 CResult_LockedChannelMonitorNoneZ {
12762 contents: CResult_LockedChannelMonitorNoneZPtr {
12763 err: std::ptr::null_mut(),
12769 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
12770 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
12771 impl Drop for CResult_LockedChannelMonitorNoneZ {
12772 fn drop(&mut self) {
12773 if self.result_ok {
12774 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12775 let _ = unsafe { Box::from_raw(self.contents.result) };
12781 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
12782 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
12783 let contents = if o.result_ok {
12784 let result = unsafe { o.contents.result };
12785 unsafe { o.contents.result = std::ptr::null_mut() };
12786 CResult_LockedChannelMonitorNoneZPtr { result }
12788 let _ = unsafe { Box::from_raw(o.contents.err) };
12789 o.contents.err = std::ptr::null_mut();
12790 CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
12794 result_ok: o.result_ok,
12799 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
12800 /// This corresponds to std::vector in C++
12801 pub struct CVec_OutPointZ {
12802 /// The elements in the array.
12803 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12804 pub data: *mut crate::lightning::chain::transaction::OutPoint,
12805 /// The number of elements pointed to by `data`.
12808 impl CVec_OutPointZ {
12809 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
12810 if self.datalen == 0 { return Vec::new(); }
12811 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12812 self.data = std::ptr::null_mut();
12816 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
12817 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
12820 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
12821 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
12822 let datalen = v.len();
12823 let data = Box::into_raw(v.into_boxed_slice());
12824 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12828 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12829 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
12830 impl Drop for CVec_OutPointZ {
12831 fn drop(&mut self) {
12832 if self.datalen == 0 { return; }
12833 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
12836 impl Clone for CVec_OutPointZ {
12837 fn clone(&self) -> Self {
12838 let mut res = Vec::new();
12839 if self.datalen == 0 { return Self::from(res); }
12840 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });