2 /// The contents of CResult_ChannelConfigDecodeErrorZ
3 pub union CResult_ChannelConfigDecodeErrorZPtr {
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::lightning::util::config::ChannelConfig,
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::lightning::ln::msgs::DecodeError,
12 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
13 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_ChannelConfigDecodeErrorZ {
16 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
17 /// `err` or `result` depending on the state of `result_ok`.
18 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
19 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
23 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
24 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
25 CResult_ChannelConfigDecodeErrorZ {
26 contents: CResult_ChannelConfigDecodeErrorZPtr {
27 result: Box::into_raw(Box::new(o)),
33 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
34 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
35 CResult_ChannelConfigDecodeErrorZ {
36 contents: CResult_ChannelConfigDecodeErrorZPtr {
37 err: Box::into_raw(Box::new(e)),
43 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
44 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
45 impl Drop for CResult_ChannelConfigDecodeErrorZ {
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::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
59 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> 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_ChannelConfigDecodeErrorZPtr { result }
65 let err = unsafe { o.contents.err };
66 unsafe { o.contents.err = std::ptr::null_mut(); }
67 CResult_ChannelConfigDecodeErrorZPtr { err }
71 result_ok: o.result_ok,
75 impl Clone for CResult_ChannelConfigDecodeErrorZ {
76 fn clone(&self) -> Self {
78 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
79 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
82 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
83 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
89 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
90 /// but with all dynamically-allocated buffers duplicated in new buffers.
91 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
93 /// The contents of CResult_OutPointDecodeErrorZ
94 pub union CResult_OutPointDecodeErrorZPtr {
95 /// A pointer to the contents in the success state.
96 /// Reading from this pointer when `result_ok` is not set is undefined.
97 pub result: *mut crate::lightning::chain::transaction::OutPoint,
98 /// A pointer to the contents in the error state.
99 /// Reading from this pointer when `result_ok` is set is undefined.
100 pub err: *mut crate::lightning::ln::msgs::DecodeError,
103 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
104 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
106 pub struct CResult_OutPointDecodeErrorZ {
107 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
108 /// `err` or `result` depending on the state of `result_ok`.
109 pub contents: CResult_OutPointDecodeErrorZPtr,
110 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
114 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
115 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
116 CResult_OutPointDecodeErrorZ {
117 contents: CResult_OutPointDecodeErrorZPtr {
118 result: Box::into_raw(Box::new(o)),
124 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
125 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
126 CResult_OutPointDecodeErrorZ {
127 contents: CResult_OutPointDecodeErrorZPtr {
128 err: Box::into_raw(Box::new(e)),
134 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
135 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
136 impl Drop for CResult_OutPointDecodeErrorZ {
139 if unsafe { !(self.contents.result as *mut ()).is_null() } {
140 let _ = unsafe { Box::from_raw(self.contents.result) };
143 if unsafe { !(self.contents.err as *mut ()).is_null() } {
144 let _ = unsafe { Box::from_raw(self.contents.err) };
149 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
150 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
151 let contents = if o.result_ok {
152 let result = unsafe { o.contents.result };
153 unsafe { o.contents.result = std::ptr::null_mut() };
154 CResult_OutPointDecodeErrorZPtr { result }
156 let err = unsafe { o.contents.err };
157 unsafe { o.contents.err = std::ptr::null_mut(); }
158 CResult_OutPointDecodeErrorZPtr { err }
162 result_ok: o.result_ok,
166 impl Clone for CResult_OutPointDecodeErrorZ {
167 fn clone(&self) -> Self {
169 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
170 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
173 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
174 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
180 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
181 /// but with all dynamically-allocated buffers duplicated in new buffers.
182 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
184 /// The contents of CResult_SecretKeyErrorZ
185 pub union CResult_SecretKeyErrorZPtr {
186 /// A pointer to the contents in the success state.
187 /// Reading from this pointer when `result_ok` is not set is undefined.
188 pub result: *mut crate::c_types::SecretKey,
189 /// A pointer to the contents in the error state.
190 /// Reading from this pointer when `result_ok` is set is undefined.
191 pub err: *mut crate::c_types::Secp256k1Error,
194 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
195 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
197 pub struct CResult_SecretKeyErrorZ {
198 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
199 /// `err` or `result` depending on the state of `result_ok`.
200 pub contents: CResult_SecretKeyErrorZPtr,
201 /// Whether this CResult_SecretKeyErrorZ represents a success state.
205 /// Creates a new CResult_SecretKeyErrorZ in the success state.
206 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
207 CResult_SecretKeyErrorZ {
208 contents: CResult_SecretKeyErrorZPtr {
209 result: Box::into_raw(Box::new(o)),
215 /// Creates a new CResult_SecretKeyErrorZ in the error state.
216 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
217 CResult_SecretKeyErrorZ {
218 contents: CResult_SecretKeyErrorZPtr {
219 err: Box::into_raw(Box::new(e)),
225 /// Frees any resources used by the CResult_SecretKeyErrorZ.
226 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
227 impl Drop for CResult_SecretKeyErrorZ {
230 if unsafe { !(self.contents.result as *mut ()).is_null() } {
231 let _ = unsafe { Box::from_raw(self.contents.result) };
234 if unsafe { !(self.contents.err as *mut ()).is_null() } {
235 let _ = unsafe { Box::from_raw(self.contents.err) };
240 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
241 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
242 let contents = if o.result_ok {
243 let result = unsafe { o.contents.result };
244 unsafe { o.contents.result = std::ptr::null_mut() };
245 CResult_SecretKeyErrorZPtr { result }
247 let err = unsafe { o.contents.err };
248 unsafe { o.contents.err = std::ptr::null_mut(); }
249 CResult_SecretKeyErrorZPtr { err }
253 result_ok: o.result_ok,
258 /// The contents of CResult_PublicKeyErrorZ
259 pub union CResult_PublicKeyErrorZPtr {
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::c_types::PublicKey,
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::c_types::Secp256k1Error,
268 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
269 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_PublicKeyErrorZ {
272 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
273 /// `err` or `result` depending on the state of `result_ok`.
274 pub contents: CResult_PublicKeyErrorZPtr,
275 /// Whether this CResult_PublicKeyErrorZ represents a success state.
279 /// Creates a new CResult_PublicKeyErrorZ in the success state.
280 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
281 CResult_PublicKeyErrorZ {
282 contents: CResult_PublicKeyErrorZPtr {
283 result: Box::into_raw(Box::new(o)),
289 /// Creates a new CResult_PublicKeyErrorZ in the error state.
290 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
291 CResult_PublicKeyErrorZ {
292 contents: CResult_PublicKeyErrorZPtr {
293 err: Box::into_raw(Box::new(e)),
299 /// Frees any resources used by the CResult_PublicKeyErrorZ.
300 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
301 impl Drop for CResult_PublicKeyErrorZ {
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::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
315 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> 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_PublicKeyErrorZPtr { result }
321 let err = unsafe { o.contents.err };
322 unsafe { o.contents.err = std::ptr::null_mut(); }
323 CResult_PublicKeyErrorZPtr { err }
327 result_ok: o.result_ok,
332 /// The contents of CResult_TxCreationKeysDecodeErrorZ
333 pub union CResult_TxCreationKeysDecodeErrorZPtr {
334 /// A pointer to the contents in the success state.
335 /// Reading from this pointer when `result_ok` is not set is undefined.
336 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
337 /// A pointer to the contents in the error state.
338 /// Reading from this pointer when `result_ok` is set is undefined.
339 pub err: *mut crate::lightning::ln::msgs::DecodeError,
342 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
343 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
345 pub struct CResult_TxCreationKeysDecodeErrorZ {
346 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
347 /// `err` or `result` depending on the state of `result_ok`.
348 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
349 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
353 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
354 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
355 CResult_TxCreationKeysDecodeErrorZ {
356 contents: CResult_TxCreationKeysDecodeErrorZPtr {
357 result: Box::into_raw(Box::new(o)),
363 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
364 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
365 CResult_TxCreationKeysDecodeErrorZ {
366 contents: CResult_TxCreationKeysDecodeErrorZPtr {
367 err: Box::into_raw(Box::new(e)),
373 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
374 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
375 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
379 let _ = unsafe { Box::from_raw(self.contents.result) };
382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
383 let _ = unsafe { Box::from_raw(self.contents.err) };
388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
389 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
390 let contents = if o.result_ok {
391 let result = unsafe { o.contents.result };
392 unsafe { o.contents.result = std::ptr::null_mut() };
393 CResult_TxCreationKeysDecodeErrorZPtr { result }
395 let err = unsafe { o.contents.err };
396 unsafe { o.contents.err = std::ptr::null_mut(); }
397 CResult_TxCreationKeysDecodeErrorZPtr { err }
401 result_ok: o.result_ok,
405 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
406 fn clone(&self) -> Self {
408 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
409 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
412 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
413 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
419 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
420 /// but with all dynamically-allocated buffers duplicated in new buffers.
421 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { orig.clone() }
423 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
424 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
425 /// A pointer to the contents in the success state.
426 /// Reading from this pointer when `result_ok` is not set is undefined.
427 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
428 /// A pointer to the contents in the error state.
429 /// Reading from this pointer when `result_ok` is set is undefined.
430 pub err: *mut crate::lightning::ln::msgs::DecodeError,
433 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
434 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
436 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
437 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
438 /// `err` or `result` depending on the state of `result_ok`.
439 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
440 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
444 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
445 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
446 CResult_ChannelPublicKeysDecodeErrorZ {
447 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
448 result: Box::into_raw(Box::new(o)),
454 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
455 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
456 CResult_ChannelPublicKeysDecodeErrorZ {
457 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
458 err: Box::into_raw(Box::new(e)),
464 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
465 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
466 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
470 let _ = unsafe { Box::from_raw(self.contents.result) };
473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
474 let _ = unsafe { Box::from_raw(self.contents.err) };
479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
481 let contents = if o.result_ok {
482 let result = unsafe { o.contents.result };
483 unsafe { o.contents.result = std::ptr::null_mut() };
484 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
486 let err = unsafe { o.contents.err };
487 unsafe { o.contents.err = std::ptr::null_mut(); }
488 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
492 result_ok: o.result_ok,
496 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
497 fn clone(&self) -> Self {
499 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
500 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
503 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
504 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
510 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
511 /// but with all dynamically-allocated buffers duplicated in new buffers.
512 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { orig.clone() }
514 /// The contents of CResult_TxCreationKeysErrorZ
515 pub union CResult_TxCreationKeysErrorZPtr {
516 /// A pointer to the contents in the success state.
517 /// Reading from this pointer when `result_ok` is not set is undefined.
518 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
519 /// A pointer to the contents in the error state.
520 /// Reading from this pointer when `result_ok` is set is undefined.
521 pub err: *mut crate::c_types::Secp256k1Error,
524 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
525 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
527 pub struct CResult_TxCreationKeysErrorZ {
528 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
529 /// `err` or `result` depending on the state of `result_ok`.
530 pub contents: CResult_TxCreationKeysErrorZPtr,
531 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
535 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
536 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
537 CResult_TxCreationKeysErrorZ {
538 contents: CResult_TxCreationKeysErrorZPtr {
539 result: Box::into_raw(Box::new(o)),
545 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
546 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
547 CResult_TxCreationKeysErrorZ {
548 contents: CResult_TxCreationKeysErrorZPtr {
549 err: Box::into_raw(Box::new(e)),
555 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
556 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
557 impl Drop for CResult_TxCreationKeysErrorZ {
560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
561 let _ = unsafe { Box::from_raw(self.contents.result) };
564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
565 let _ = unsafe { Box::from_raw(self.contents.err) };
570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
571 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
572 let contents = if o.result_ok {
573 let result = unsafe { o.contents.result };
574 unsafe { o.contents.result = std::ptr::null_mut() };
575 CResult_TxCreationKeysErrorZPtr { result }
577 let err = unsafe { o.contents.err };
578 unsafe { o.contents.err = std::ptr::null_mut(); }
579 CResult_TxCreationKeysErrorZPtr { err }
583 result_ok: o.result_ok,
589 /// An enum which can either contain a u32 or not
590 pub enum COption_u32Z {
591 /// When we're in this state, this COption_u32Z contains a u32
593 /// When we're in this state, this COption_u32Z contains nothing
597 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
598 if let Self::Some(_) = self { true } else { false }
600 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
601 if let Self::Some(v) = self { v } else { unreachable!() }
605 /// Constructs a new COption_u32Z containing a u32
606 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
607 COption_u32Z::Some(o)
610 /// Constructs a new COption_u32Z containing nothing
611 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
615 /// Frees any resources associated with the u32, if we are in the Some state
616 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
618 /// Creates a new COption_u32Z which has the same data as `orig`
619 /// but with all dynamically-allocated buffers duplicated in new buffers.
620 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { orig.clone() }
622 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
623 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
624 /// A pointer to the contents in the success state.
625 /// Reading from this pointer when `result_ok` is not set is undefined.
626 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
627 /// A pointer to the contents in the error state.
628 /// Reading from this pointer when `result_ok` is set is undefined.
629 pub err: *mut crate::lightning::ln::msgs::DecodeError,
632 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
633 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
635 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
636 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
637 /// `err` or `result` depending on the state of `result_ok`.
638 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
639 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
643 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
644 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
645 CResult_HTLCOutputInCommitmentDecodeErrorZ {
646 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
647 result: Box::into_raw(Box::new(o)),
653 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
654 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
655 CResult_HTLCOutputInCommitmentDecodeErrorZ {
656 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
657 err: Box::into_raw(Box::new(e)),
663 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
664 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
665 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
668 if unsafe { !(self.contents.result as *mut ()).is_null() } {
669 let _ = unsafe { Box::from_raw(self.contents.result) };
672 if unsafe { !(self.contents.err as *mut ()).is_null() } {
673 let _ = unsafe { Box::from_raw(self.contents.err) };
678 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
679 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
680 let contents = if o.result_ok {
681 let result = unsafe { o.contents.result };
682 unsafe { o.contents.result = std::ptr::null_mut() };
683 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
685 let err = unsafe { o.contents.err };
686 unsafe { o.contents.err = std::ptr::null_mut(); }
687 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
691 result_ok: o.result_ok,
695 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
696 fn clone(&self) -> Self {
698 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
699 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
702 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
703 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
709 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
710 /// but with all dynamically-allocated buffers duplicated in new buffers.
711 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
713 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
714 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
715 /// A pointer to the contents in the success state.
716 /// Reading from this pointer when `result_ok` is not set is undefined.
717 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
718 /// A pointer to the contents in the error state.
719 /// Reading from this pointer when `result_ok` is set is undefined.
720 pub err: *mut crate::lightning::ln::msgs::DecodeError,
723 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
724 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
726 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
727 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
728 /// `err` or `result` depending on the state of `result_ok`.
729 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
730 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
734 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
735 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
736 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
737 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
738 result: Box::into_raw(Box::new(o)),
744 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
745 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
746 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
747 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
748 err: Box::into_raw(Box::new(e)),
754 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
755 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
756 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
759 if unsafe { !(self.contents.result as *mut ()).is_null() } {
760 let _ = unsafe { Box::from_raw(self.contents.result) };
763 if unsafe { !(self.contents.err as *mut ()).is_null() } {
764 let _ = unsafe { Box::from_raw(self.contents.err) };
769 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
770 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
771 let contents = if o.result_ok {
772 let result = unsafe { o.contents.result };
773 unsafe { o.contents.result = std::ptr::null_mut() };
774 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
776 let err = unsafe { o.contents.err };
777 unsafe { o.contents.err = std::ptr::null_mut(); }
778 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
782 result_ok: o.result_ok,
786 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
787 fn clone(&self) -> Self {
789 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
790 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
793 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
794 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
800 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
801 /// but with all dynamically-allocated buffers duplicated in new buffers.
802 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
804 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
805 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
806 /// A pointer to the contents in the success state.
807 /// Reading from this pointer when `result_ok` is not set is undefined.
808 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
809 /// A pointer to the contents in the error state.
810 /// Reading from this pointer when `result_ok` is set is undefined.
811 pub err: *mut crate::lightning::ln::msgs::DecodeError,
814 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
815 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
816 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
817 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
818 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
819 /// `err` or `result` depending on the state of `result_ok`.
820 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
821 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
825 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
826 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
827 CResult_ChannelTransactionParametersDecodeErrorZ {
828 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
829 result: Box::into_raw(Box::new(o)),
835 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
836 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
837 CResult_ChannelTransactionParametersDecodeErrorZ {
838 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
839 err: Box::into_raw(Box::new(e)),
845 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
846 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
847 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
850 if unsafe { !(self.contents.result as *mut ()).is_null() } {
851 let _ = unsafe { Box::from_raw(self.contents.result) };
854 if unsafe { !(self.contents.err as *mut ()).is_null() } {
855 let _ = unsafe { Box::from_raw(self.contents.err) };
860 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
861 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
862 let contents = if o.result_ok {
863 let result = unsafe { o.contents.result };
864 unsafe { o.contents.result = std::ptr::null_mut() };
865 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
867 let err = unsafe { o.contents.err };
868 unsafe { o.contents.err = std::ptr::null_mut(); }
869 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
873 result_ok: o.result_ok,
877 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
878 fn clone(&self) -> Self {
880 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
881 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
884 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
885 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
891 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
892 /// but with all dynamically-allocated buffers duplicated in new buffers.
893 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
895 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
896 /// This corresponds to std::vector in C++
897 pub struct CVec_SignatureZ {
898 /// The elements in the array.
899 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
900 pub data: *mut crate::c_types::Signature,
901 /// The number of elements pointed to by `data`.
904 impl CVec_SignatureZ {
905 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
906 if self.datalen == 0 { return Vec::new(); }
907 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
908 self.data = std::ptr::null_mut();
912 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
913 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
916 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
917 fn from(v: Vec<crate::c_types::Signature>) -> Self {
918 let datalen = v.len();
919 let data = Box::into_raw(v.into_boxed_slice());
920 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
924 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
925 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
926 impl Drop for CVec_SignatureZ {
928 if self.datalen == 0 { return; }
929 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
932 impl Clone for CVec_SignatureZ {
933 fn clone(&self) -> Self {
934 let mut res = Vec::new();
935 if self.datalen == 0 { return Self::from(res); }
936 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
941 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
942 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
943 /// A pointer to the contents in the success state.
944 /// Reading from this pointer when `result_ok` is not set is undefined.
945 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
946 /// A pointer to the contents in the error state.
947 /// Reading from this pointer when `result_ok` is set is undefined.
948 pub err: *mut crate::lightning::ln::msgs::DecodeError,
951 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
952 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
953 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
954 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
955 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
956 /// `err` or `result` depending on the state of `result_ok`.
957 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
958 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
962 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
963 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
964 CResult_HolderCommitmentTransactionDecodeErrorZ {
965 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
966 result: Box::into_raw(Box::new(o)),
972 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
973 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
974 CResult_HolderCommitmentTransactionDecodeErrorZ {
975 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
976 err: Box::into_raw(Box::new(e)),
982 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
983 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
984 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
987 if unsafe { !(self.contents.result as *mut ()).is_null() } {
988 let _ = unsafe { Box::from_raw(self.contents.result) };
991 if unsafe { !(self.contents.err as *mut ()).is_null() } {
992 let _ = unsafe { Box::from_raw(self.contents.err) };
997 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
998 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
999 let contents = if o.result_ok {
1000 let result = unsafe { o.contents.result };
1001 unsafe { o.contents.result = std::ptr::null_mut() };
1002 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1004 let err = unsafe { o.contents.err };
1005 unsafe { o.contents.err = std::ptr::null_mut(); }
1006 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1010 result_ok: o.result_ok,
1014 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1015 fn clone(&self) -> Self {
1017 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1018 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1021 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1022 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1028 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1029 /// but with all dynamically-allocated buffers duplicated in new buffers.
1030 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
1032 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1033 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1034 /// A pointer to the contents in the success state.
1035 /// Reading from this pointer when `result_ok` is not set is undefined.
1036 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1037 /// A pointer to the contents in the error state.
1038 /// Reading from this pointer when `result_ok` is set is undefined.
1039 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1042 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1043 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1045 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1046 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1047 /// `err` or `result` depending on the state of `result_ok`.
1048 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1049 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1050 pub result_ok: bool,
1053 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1054 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1055 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1056 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1057 result: Box::into_raw(Box::new(o)),
1063 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1064 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1065 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1066 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1067 err: Box::into_raw(Box::new(e)),
1073 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1074 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1075 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1076 fn drop(&mut self) {
1078 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1079 let _ = unsafe { Box::from_raw(self.contents.result) };
1082 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1083 let _ = unsafe { Box::from_raw(self.contents.err) };
1088 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1089 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1090 let contents = if o.result_ok {
1091 let result = unsafe { o.contents.result };
1092 unsafe { o.contents.result = std::ptr::null_mut() };
1093 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1095 let err = unsafe { o.contents.err };
1096 unsafe { o.contents.err = std::ptr::null_mut(); }
1097 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1101 result_ok: o.result_ok,
1105 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1106 fn clone(&self) -> Self {
1108 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1109 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1112 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1113 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1119 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1120 /// but with all dynamically-allocated buffers duplicated in new buffers.
1121 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
1123 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1124 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1125 /// A pointer to the contents in the success state.
1126 /// Reading from this pointer when `result_ok` is not set is undefined.
1127 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1128 /// A pointer to the contents in the error state.
1129 /// Reading from this pointer when `result_ok` is set is undefined.
1130 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1133 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1134 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1136 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1137 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1138 /// `err` or `result` depending on the state of `result_ok`.
1139 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1140 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1141 pub result_ok: bool,
1144 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1145 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1146 CResult_CommitmentTransactionDecodeErrorZ {
1147 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1148 result: Box::into_raw(Box::new(o)),
1154 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1155 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1156 CResult_CommitmentTransactionDecodeErrorZ {
1157 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1158 err: Box::into_raw(Box::new(e)),
1164 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1165 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1166 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1167 fn drop(&mut self) {
1169 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1170 let _ = unsafe { Box::from_raw(self.contents.result) };
1173 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1174 let _ = unsafe { Box::from_raw(self.contents.err) };
1179 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1180 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1181 let contents = if o.result_ok {
1182 let result = unsafe { o.contents.result };
1183 unsafe { o.contents.result = std::ptr::null_mut() };
1184 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1186 let err = unsafe { o.contents.err };
1187 unsafe { o.contents.err = std::ptr::null_mut(); }
1188 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1192 result_ok: o.result_ok,
1196 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1197 fn clone(&self) -> Self {
1199 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1200 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1203 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1204 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1210 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1211 /// but with all dynamically-allocated buffers duplicated in new buffers.
1212 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
1214 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1215 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1216 /// A pointer to the contents in the success state.
1217 /// Reading from this pointer when `result_ok` is not set is undefined.
1218 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1219 /// Note that this value is always NULL, as there are no contents in the Err variant
1220 pub err: *mut std::ffi::c_void,
1223 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1224 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1225 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1226 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1227 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1228 /// `err` or `result` depending on the state of `result_ok`.
1229 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1230 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1231 pub result_ok: bool,
1234 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1235 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1236 CResult_TrustedCommitmentTransactionNoneZ {
1237 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1238 result: Box::into_raw(Box::new(o)),
1244 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1245 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1246 CResult_TrustedCommitmentTransactionNoneZ {
1247 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1248 err: std::ptr::null_mut(),
1254 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1255 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1256 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1257 fn drop(&mut self) {
1259 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1260 let _ = unsafe { Box::from_raw(self.contents.result) };
1266 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1267 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1268 let contents = if o.result_ok {
1269 let result = unsafe { o.contents.result };
1270 unsafe { o.contents.result = std::ptr::null_mut() };
1271 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1273 let _ = unsafe { Box::from_raw(o.contents.err) };
1274 o.contents.err = std::ptr::null_mut();
1275 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1279 result_ok: o.result_ok,
1284 /// The contents of CResult_CVec_SignatureZNoneZ
1285 pub union CResult_CVec_SignatureZNoneZPtr {
1286 /// A pointer to the contents in the success state.
1287 /// Reading from this pointer when `result_ok` is not set is undefined.
1288 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1289 /// Note that this value is always NULL, as there are no contents in the Err variant
1290 pub err: *mut std::ffi::c_void,
1293 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1294 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1296 pub struct CResult_CVec_SignatureZNoneZ {
1297 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1298 /// `err` or `result` depending on the state of `result_ok`.
1299 pub contents: CResult_CVec_SignatureZNoneZPtr,
1300 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1301 pub result_ok: bool,
1304 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1305 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1306 CResult_CVec_SignatureZNoneZ {
1307 contents: CResult_CVec_SignatureZNoneZPtr {
1308 result: Box::into_raw(Box::new(o)),
1314 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1315 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1316 CResult_CVec_SignatureZNoneZ {
1317 contents: CResult_CVec_SignatureZNoneZPtr {
1318 err: std::ptr::null_mut(),
1324 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1325 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1326 impl Drop for CResult_CVec_SignatureZNoneZ {
1327 fn drop(&mut self) {
1329 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1330 let _ = unsafe { Box::from_raw(self.contents.result) };
1336 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1337 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1338 let contents = if o.result_ok {
1339 let result = unsafe { o.contents.result };
1340 unsafe { o.contents.result = std::ptr::null_mut() };
1341 CResult_CVec_SignatureZNoneZPtr { result }
1343 let _ = unsafe { Box::from_raw(o.contents.err) };
1344 o.contents.err = std::ptr::null_mut();
1345 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1349 result_ok: o.result_ok,
1353 impl Clone for CResult_CVec_SignatureZNoneZ {
1354 fn clone(&self) -> Self {
1356 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1357 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1360 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1361 err: std::ptr::null_mut()
1367 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1368 /// but with all dynamically-allocated buffers duplicated in new buffers.
1369 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
1371 /// The contents of CResult_SiPrefixNoneZ
1372 pub union CResult_SiPrefixNoneZPtr {
1373 /// A pointer to the contents in the success state.
1374 /// Reading from this pointer when `result_ok` is not set is undefined.
1375 pub result: *mut crate::lightning_invoice::SiPrefix,
1376 /// Note that this value is always NULL, as there are no contents in the Err variant
1377 pub err: *mut std::ffi::c_void,
1380 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
1381 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
1382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1383 pub struct CResult_SiPrefixNoneZ {
1384 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
1385 /// `err` or `result` depending on the state of `result_ok`.
1386 pub contents: CResult_SiPrefixNoneZPtr,
1387 /// Whether this CResult_SiPrefixNoneZ represents a success state.
1388 pub result_ok: bool,
1391 /// Creates a new CResult_SiPrefixNoneZ in the success state.
1392 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
1393 CResult_SiPrefixNoneZ {
1394 contents: CResult_SiPrefixNoneZPtr {
1395 result: Box::into_raw(Box::new(o)),
1401 /// Creates a new CResult_SiPrefixNoneZ in the error state.
1402 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
1403 CResult_SiPrefixNoneZ {
1404 contents: CResult_SiPrefixNoneZPtr {
1405 err: std::ptr::null_mut(),
1411 /// Frees any resources used by the CResult_SiPrefixNoneZ.
1412 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
1413 impl Drop for CResult_SiPrefixNoneZ {
1414 fn drop(&mut self) {
1416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1417 let _ = unsafe { Box::from_raw(self.contents.result) };
1423 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
1424 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
1425 let contents = if o.result_ok {
1426 let result = unsafe { o.contents.result };
1427 unsafe { o.contents.result = std::ptr::null_mut() };
1428 CResult_SiPrefixNoneZPtr { result }
1430 let _ = unsafe { Box::from_raw(o.contents.err) };
1431 o.contents.err = std::ptr::null_mut();
1432 CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
1436 result_ok: o.result_ok,
1440 impl Clone for CResult_SiPrefixNoneZ {
1441 fn clone(&self) -> Self {
1443 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
1444 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
1447 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
1448 err: std::ptr::null_mut()
1454 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
1455 /// but with all dynamically-allocated buffers duplicated in new buffers.
1456 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
1458 /// The contents of CResult_InvoiceNoneZ
1459 pub union CResult_InvoiceNoneZPtr {
1460 /// A pointer to the contents in the success state.
1461 /// Reading from this pointer when `result_ok` is not set is undefined.
1462 pub result: *mut crate::lightning_invoice::Invoice,
1463 /// Note that this value is always NULL, as there are no contents in the Err variant
1464 pub err: *mut std::ffi::c_void,
1467 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
1468 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
1469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1470 pub struct CResult_InvoiceNoneZ {
1471 /// The contents of this CResult_InvoiceNoneZ, accessible via either
1472 /// `err` or `result` depending on the state of `result_ok`.
1473 pub contents: CResult_InvoiceNoneZPtr,
1474 /// Whether this CResult_InvoiceNoneZ represents a success state.
1475 pub result_ok: bool,
1478 /// Creates a new CResult_InvoiceNoneZ in the success state.
1479 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
1480 CResult_InvoiceNoneZ {
1481 contents: CResult_InvoiceNoneZPtr {
1482 result: Box::into_raw(Box::new(o)),
1488 /// Creates a new CResult_InvoiceNoneZ in the error state.
1489 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
1490 CResult_InvoiceNoneZ {
1491 contents: CResult_InvoiceNoneZPtr {
1492 err: std::ptr::null_mut(),
1498 /// Frees any resources used by the CResult_InvoiceNoneZ.
1499 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
1500 impl Drop for CResult_InvoiceNoneZ {
1501 fn drop(&mut self) {
1503 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1504 let _ = unsafe { Box::from_raw(self.contents.result) };
1510 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
1511 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
1512 let contents = if o.result_ok {
1513 let result = unsafe { o.contents.result };
1514 unsafe { o.contents.result = std::ptr::null_mut() };
1515 CResult_InvoiceNoneZPtr { result }
1517 let _ = unsafe { Box::from_raw(o.contents.err) };
1518 o.contents.err = std::ptr::null_mut();
1519 CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
1523 result_ok: o.result_ok,
1527 impl Clone for CResult_InvoiceNoneZ {
1528 fn clone(&self) -> Self {
1530 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
1531 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
1534 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
1535 err: std::ptr::null_mut()
1541 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
1542 /// but with all dynamically-allocated buffers duplicated in new buffers.
1543 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
1545 /// The contents of CResult_SignedRawInvoiceNoneZ
1546 pub union CResult_SignedRawInvoiceNoneZPtr {
1547 /// A pointer to the contents in the success state.
1548 /// Reading from this pointer when `result_ok` is not set is undefined.
1549 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
1550 /// Note that this value is always NULL, as there are no contents in the Err variant
1551 pub err: *mut std::ffi::c_void,
1554 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
1555 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
1556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1557 pub struct CResult_SignedRawInvoiceNoneZ {
1558 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
1559 /// `err` or `result` depending on the state of `result_ok`.
1560 pub contents: CResult_SignedRawInvoiceNoneZPtr,
1561 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
1562 pub result_ok: bool,
1565 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
1566 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
1567 CResult_SignedRawInvoiceNoneZ {
1568 contents: CResult_SignedRawInvoiceNoneZPtr {
1569 result: Box::into_raw(Box::new(o)),
1575 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
1576 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
1577 CResult_SignedRawInvoiceNoneZ {
1578 contents: CResult_SignedRawInvoiceNoneZPtr {
1579 err: std::ptr::null_mut(),
1585 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
1586 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
1587 impl Drop for CResult_SignedRawInvoiceNoneZ {
1588 fn drop(&mut self) {
1590 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1591 let _ = unsafe { Box::from_raw(self.contents.result) };
1597 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
1598 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
1599 let contents = if o.result_ok {
1600 let result = unsafe { o.contents.result };
1601 unsafe { o.contents.result = std::ptr::null_mut() };
1602 CResult_SignedRawInvoiceNoneZPtr { result }
1604 let _ = unsafe { Box::from_raw(o.contents.err) };
1605 o.contents.err = std::ptr::null_mut();
1606 CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
1610 result_ok: o.result_ok,
1614 impl Clone for CResult_SignedRawInvoiceNoneZ {
1615 fn clone(&self) -> Self {
1617 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
1618 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
1621 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
1622 err: std::ptr::null_mut()
1628 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
1629 /// but with all dynamically-allocated buffers duplicated in new buffers.
1630 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
1632 /// A dynamically-allocated array of u8s of arbitrary size.
1633 /// This corresponds to std::vector in C++
1634 pub struct CVec_u8Z {
1635 /// The elements in the array.
1636 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1638 /// The number of elements pointed to by `data`.
1642 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
1643 if self.datalen == 0 { return Vec::new(); }
1644 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1645 self.data = std::ptr::null_mut();
1649 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
1650 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1653 impl From<Vec<u8>> for CVec_u8Z {
1654 fn from(v: Vec<u8>) -> Self {
1655 let datalen = v.len();
1656 let data = Box::into_raw(v.into_boxed_slice());
1657 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1661 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1662 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
1663 impl Drop for CVec_u8Z {
1664 fn drop(&mut self) {
1665 if self.datalen == 0 { return; }
1666 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1669 impl Clone for CVec_u8Z {
1670 fn clone(&self) -> Self {
1671 let mut res = Vec::new();
1672 if self.datalen == 0 { return Self::from(res); }
1673 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1678 /// A tuple of 3 elements. See the individual fields for the types contained.
1679 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1680 /// The element at position 0
1681 pub a: crate::lightning_invoice::RawInvoice,
1682 /// The element at position 1
1683 pub b: crate::c_types::ThirtyTwoBytes,
1684 /// The element at position 2
1685 pub c: crate::lightning_invoice::InvoiceSignature,
1687 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1688 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
1696 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1697 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
1698 (self.a, self.b, self.c)
1701 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
1703 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 {
1704 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
1708 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
1709 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
1711 /// The contents of CResult_PayeePubKeyErrorZ
1712 pub union CResult_PayeePubKeyErrorZPtr {
1713 /// A pointer to the contents in the success state.
1714 /// Reading from this pointer when `result_ok` is not set is undefined.
1715 pub result: *mut crate::lightning_invoice::PayeePubKey,
1716 /// A pointer to the contents in the error state.
1717 /// Reading from this pointer when `result_ok` is set is undefined.
1718 pub err: *mut crate::c_types::Secp256k1Error,
1721 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
1722 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
1723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1724 pub struct CResult_PayeePubKeyErrorZ {
1725 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
1726 /// `err` or `result` depending on the state of `result_ok`.
1727 pub contents: CResult_PayeePubKeyErrorZPtr,
1728 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
1729 pub result_ok: bool,
1732 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
1733 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
1734 CResult_PayeePubKeyErrorZ {
1735 contents: CResult_PayeePubKeyErrorZPtr {
1736 result: Box::into_raw(Box::new(o)),
1742 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
1743 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
1744 CResult_PayeePubKeyErrorZ {
1745 contents: CResult_PayeePubKeyErrorZPtr {
1746 err: Box::into_raw(Box::new(e)),
1752 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
1753 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
1754 impl Drop for CResult_PayeePubKeyErrorZ {
1755 fn drop(&mut self) {
1757 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1758 let _ = unsafe { Box::from_raw(self.contents.result) };
1761 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1762 let _ = unsafe { Box::from_raw(self.contents.err) };
1767 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
1768 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
1769 let contents = if o.result_ok {
1770 let result = unsafe { o.contents.result };
1771 unsafe { o.contents.result = std::ptr::null_mut() };
1772 CResult_PayeePubKeyErrorZPtr { result }
1774 let err = unsafe { o.contents.err };
1775 unsafe { o.contents.err = std::ptr::null_mut(); }
1776 CResult_PayeePubKeyErrorZPtr { err }
1780 result_ok: o.result_ok,
1785 /// A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
1786 /// This corresponds to std::vector in C++
1787 pub struct CVec_RouteHintZ {
1788 /// The elements in the array.
1789 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1790 pub data: *mut crate::lightning_invoice::RouteHint,
1791 /// The number of elements pointed to by `data`.
1794 impl CVec_RouteHintZ {
1795 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::RouteHint> {
1796 if self.datalen == 0 { return Vec::new(); }
1797 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1798 self.data = std::ptr::null_mut();
1802 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::RouteHint] {
1803 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1806 impl From<Vec<crate::lightning_invoice::RouteHint>> for CVec_RouteHintZ {
1807 fn from(v: Vec<crate::lightning_invoice::RouteHint>) -> Self {
1808 let datalen = v.len();
1809 let data = Box::into_raw(v.into_boxed_slice());
1810 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1814 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1815 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1816 impl Drop for CVec_RouteHintZ {
1817 fn drop(&mut self) {
1818 if self.datalen == 0 { return; }
1819 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1822 impl Clone for CVec_RouteHintZ {
1823 fn clone(&self) -> Self {
1824 let mut res = Vec::new();
1825 if self.datalen == 0 { return Self::from(res); }
1826 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1832 /// An enum which can either contain a u64 or not
1833 pub enum COption_u64Z {
1834 /// When we're in this state, this COption_u64Z contains a u64
1836 /// When we're in this state, this COption_u64Z contains nothing
1840 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1841 if let Self::Some(_) = self { true } else { false }
1843 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1844 if let Self::Some(v) = self { v } else { unreachable!() }
1848 /// Constructs a new COption_u64Z containing a u64
1849 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1850 COption_u64Z::Some(o)
1853 /// Constructs a new COption_u64Z containing nothing
1854 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1858 /// Frees any resources associated with the u64, if we are in the Some state
1859 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1861 /// Creates a new COption_u64Z which has the same data as `orig`
1862 /// but with all dynamically-allocated buffers duplicated in new buffers.
1863 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1865 /// The contents of CResult_PositiveTimestampCreationErrorZ
1866 pub union CResult_PositiveTimestampCreationErrorZPtr {
1867 /// A pointer to the contents in the success state.
1868 /// Reading from this pointer when `result_ok` is not set is undefined.
1869 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
1870 /// A pointer to the contents in the error state.
1871 /// Reading from this pointer when `result_ok` is set is undefined.
1872 pub err: *mut crate::lightning_invoice::CreationError,
1875 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
1876 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
1877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1878 pub struct CResult_PositiveTimestampCreationErrorZ {
1879 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
1880 /// `err` or `result` depending on the state of `result_ok`.
1881 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
1882 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
1883 pub result_ok: bool,
1886 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
1887 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
1888 CResult_PositiveTimestampCreationErrorZ {
1889 contents: CResult_PositiveTimestampCreationErrorZPtr {
1890 result: Box::into_raw(Box::new(o)),
1896 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
1897 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
1898 CResult_PositiveTimestampCreationErrorZ {
1899 contents: CResult_PositiveTimestampCreationErrorZPtr {
1900 err: Box::into_raw(Box::new(e)),
1906 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
1907 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
1908 impl Drop for CResult_PositiveTimestampCreationErrorZ {
1909 fn drop(&mut self) {
1911 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1912 let _ = unsafe { Box::from_raw(self.contents.result) };
1915 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1916 let _ = unsafe { Box::from_raw(self.contents.err) };
1921 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
1922 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
1923 let contents = if o.result_ok {
1924 let result = unsafe { o.contents.result };
1925 unsafe { o.contents.result = std::ptr::null_mut() };
1926 CResult_PositiveTimestampCreationErrorZPtr { result }
1928 let err = unsafe { o.contents.err };
1929 unsafe { o.contents.err = std::ptr::null_mut(); }
1930 CResult_PositiveTimestampCreationErrorZPtr { err }
1934 result_ok: o.result_ok,
1938 impl Clone for CResult_PositiveTimestampCreationErrorZ {
1939 fn clone(&self) -> Self {
1941 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
1942 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
1945 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
1946 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
1952 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
1953 /// but with all dynamically-allocated buffers duplicated in new buffers.
1954 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
1956 /// The contents of CResult_NoneSemanticErrorZ
1957 pub union CResult_NoneSemanticErrorZPtr {
1958 /// Note that this value is always NULL, as there are no contents in the OK variant
1959 pub result: *mut std::ffi::c_void,
1960 /// A pointer to the contents in the error state.
1961 /// Reading from this pointer when `result_ok` is set is undefined.
1962 pub err: *mut crate::lightning_invoice::SemanticError,
1965 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
1966 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
1967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1968 pub struct CResult_NoneSemanticErrorZ {
1969 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
1970 /// `err` or `result` depending on the state of `result_ok`.
1971 pub contents: CResult_NoneSemanticErrorZPtr,
1972 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
1973 pub result_ok: bool,
1976 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
1977 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
1978 CResult_NoneSemanticErrorZ {
1979 contents: CResult_NoneSemanticErrorZPtr {
1980 result: std::ptr::null_mut(),
1986 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
1987 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
1988 CResult_NoneSemanticErrorZ {
1989 contents: CResult_NoneSemanticErrorZPtr {
1990 err: Box::into_raw(Box::new(e)),
1996 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
1997 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
1998 impl Drop for CResult_NoneSemanticErrorZ {
1999 fn drop(&mut self) {
2002 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2003 let _ = unsafe { Box::from_raw(self.contents.err) };
2008 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
2009 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
2010 let contents = if o.result_ok {
2011 let _ = unsafe { Box::from_raw(o.contents.result) };
2012 o.contents.result = std::ptr::null_mut();
2013 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
2015 let err = unsafe { o.contents.err };
2016 unsafe { o.contents.err = std::ptr::null_mut(); }
2017 CResult_NoneSemanticErrorZPtr { err }
2021 result_ok: o.result_ok,
2025 impl Clone for CResult_NoneSemanticErrorZ {
2026 fn clone(&self) -> Self {
2028 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
2029 result: std::ptr::null_mut()
2032 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
2033 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
2039 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
2040 /// but with all dynamically-allocated buffers duplicated in new buffers.
2041 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
2043 /// The contents of CResult_InvoiceSemanticErrorZ
2044 pub union CResult_InvoiceSemanticErrorZPtr {
2045 /// A pointer to the contents in the success state.
2046 /// Reading from this pointer when `result_ok` is not set is undefined.
2047 pub result: *mut crate::lightning_invoice::Invoice,
2048 /// A pointer to the contents in the error state.
2049 /// Reading from this pointer when `result_ok` is set is undefined.
2050 pub err: *mut crate::lightning_invoice::SemanticError,
2053 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
2054 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
2055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2056 pub struct CResult_InvoiceSemanticErrorZ {
2057 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
2058 /// `err` or `result` depending on the state of `result_ok`.
2059 pub contents: CResult_InvoiceSemanticErrorZPtr,
2060 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
2061 pub result_ok: bool,
2064 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
2065 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
2066 CResult_InvoiceSemanticErrorZ {
2067 contents: CResult_InvoiceSemanticErrorZPtr {
2068 result: Box::into_raw(Box::new(o)),
2074 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
2075 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
2076 CResult_InvoiceSemanticErrorZ {
2077 contents: CResult_InvoiceSemanticErrorZPtr {
2078 err: Box::into_raw(Box::new(e)),
2084 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
2085 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
2086 impl Drop for CResult_InvoiceSemanticErrorZ {
2087 fn drop(&mut self) {
2089 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2090 let _ = unsafe { Box::from_raw(self.contents.result) };
2093 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2094 let _ = unsafe { Box::from_raw(self.contents.err) };
2099 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
2100 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
2101 let contents = if o.result_ok {
2102 let result = unsafe { o.contents.result };
2103 unsafe { o.contents.result = std::ptr::null_mut() };
2104 CResult_InvoiceSemanticErrorZPtr { result }
2106 let err = unsafe { o.contents.err };
2107 unsafe { o.contents.err = std::ptr::null_mut(); }
2108 CResult_InvoiceSemanticErrorZPtr { err }
2112 result_ok: o.result_ok,
2116 impl Clone for CResult_InvoiceSemanticErrorZ {
2117 fn clone(&self) -> Self {
2119 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
2120 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
2123 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
2124 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
2130 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
2131 /// but with all dynamically-allocated buffers duplicated in new buffers.
2132 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
2134 /// The contents of CResult_DescriptionCreationErrorZ
2135 pub union CResult_DescriptionCreationErrorZPtr {
2136 /// A pointer to the contents in the success state.
2137 /// Reading from this pointer when `result_ok` is not set is undefined.
2138 pub result: *mut crate::lightning_invoice::Description,
2139 /// A pointer to the contents in the error state.
2140 /// Reading from this pointer when `result_ok` is set is undefined.
2141 pub err: *mut crate::lightning_invoice::CreationError,
2144 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
2145 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
2146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2147 pub struct CResult_DescriptionCreationErrorZ {
2148 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
2149 /// `err` or `result` depending on the state of `result_ok`.
2150 pub contents: CResult_DescriptionCreationErrorZPtr,
2151 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
2152 pub result_ok: bool,
2155 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
2156 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
2157 CResult_DescriptionCreationErrorZ {
2158 contents: CResult_DescriptionCreationErrorZPtr {
2159 result: Box::into_raw(Box::new(o)),
2165 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
2166 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
2167 CResult_DescriptionCreationErrorZ {
2168 contents: CResult_DescriptionCreationErrorZPtr {
2169 err: Box::into_raw(Box::new(e)),
2175 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
2176 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
2177 impl Drop for CResult_DescriptionCreationErrorZ {
2178 fn drop(&mut self) {
2180 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2181 let _ = unsafe { Box::from_raw(self.contents.result) };
2184 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2185 let _ = unsafe { Box::from_raw(self.contents.err) };
2190 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
2191 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
2192 let contents = if o.result_ok {
2193 let result = unsafe { o.contents.result };
2194 unsafe { o.contents.result = std::ptr::null_mut() };
2195 CResult_DescriptionCreationErrorZPtr { result }
2197 let err = unsafe { o.contents.err };
2198 unsafe { o.contents.err = std::ptr::null_mut(); }
2199 CResult_DescriptionCreationErrorZPtr { err }
2203 result_ok: o.result_ok,
2207 impl Clone for CResult_DescriptionCreationErrorZ {
2208 fn clone(&self) -> Self {
2210 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
2211 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
2214 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
2215 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2221 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
2222 /// but with all dynamically-allocated buffers duplicated in new buffers.
2223 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
2225 /// The contents of CResult_ExpiryTimeCreationErrorZ
2226 pub union CResult_ExpiryTimeCreationErrorZPtr {
2227 /// A pointer to the contents in the success state.
2228 /// Reading from this pointer when `result_ok` is not set is undefined.
2229 pub result: *mut crate::lightning_invoice::ExpiryTime,
2230 /// A pointer to the contents in the error state.
2231 /// Reading from this pointer when `result_ok` is set is undefined.
2232 pub err: *mut crate::lightning_invoice::CreationError,
2235 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
2236 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
2237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2238 pub struct CResult_ExpiryTimeCreationErrorZ {
2239 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
2240 /// `err` or `result` depending on the state of `result_ok`.
2241 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
2242 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
2243 pub result_ok: bool,
2246 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
2247 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
2248 CResult_ExpiryTimeCreationErrorZ {
2249 contents: CResult_ExpiryTimeCreationErrorZPtr {
2250 result: Box::into_raw(Box::new(o)),
2256 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
2257 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
2258 CResult_ExpiryTimeCreationErrorZ {
2259 contents: CResult_ExpiryTimeCreationErrorZPtr {
2260 err: Box::into_raw(Box::new(e)),
2266 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
2267 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
2268 impl Drop for CResult_ExpiryTimeCreationErrorZ {
2269 fn drop(&mut self) {
2271 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2272 let _ = unsafe { Box::from_raw(self.contents.result) };
2275 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2276 let _ = unsafe { Box::from_raw(self.contents.err) };
2281 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
2282 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
2283 let contents = if o.result_ok {
2284 let result = unsafe { o.contents.result };
2285 unsafe { o.contents.result = std::ptr::null_mut() };
2286 CResult_ExpiryTimeCreationErrorZPtr { result }
2288 let err = unsafe { o.contents.err };
2289 unsafe { o.contents.err = std::ptr::null_mut(); }
2290 CResult_ExpiryTimeCreationErrorZPtr { err }
2294 result_ok: o.result_ok,
2298 impl Clone for CResult_ExpiryTimeCreationErrorZ {
2299 fn clone(&self) -> Self {
2301 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
2302 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
2305 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
2306 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2312 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
2313 /// but with all dynamically-allocated buffers duplicated in new buffers.
2314 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
2316 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2317 /// This corresponds to std::vector in C++
2318 pub struct CVec_RouteHintHopZ {
2319 /// The elements in the array.
2320 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2321 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2322 /// The number of elements pointed to by `data`.
2325 impl CVec_RouteHintHopZ {
2326 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2327 if self.datalen == 0 { return Vec::new(); }
2328 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2329 self.data = std::ptr::null_mut();
2333 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2334 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2337 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2338 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2339 let datalen = v.len();
2340 let data = Box::into_raw(v.into_boxed_slice());
2341 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2345 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2346 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2347 impl Drop for CVec_RouteHintHopZ {
2348 fn drop(&mut self) {
2349 if self.datalen == 0 { return; }
2350 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2353 impl Clone for CVec_RouteHintHopZ {
2354 fn clone(&self) -> Self {
2355 let mut res = Vec::new();
2356 if self.datalen == 0 { return Self::from(res); }
2357 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2362 /// The contents of CResult_RouteHintCreationErrorZ
2363 pub union CResult_RouteHintCreationErrorZPtr {
2364 /// A pointer to the contents in the success state.
2365 /// Reading from this pointer when `result_ok` is not set is undefined.
2366 pub result: *mut crate::lightning_invoice::RouteHint,
2367 /// A pointer to the contents in the error state.
2368 /// Reading from this pointer when `result_ok` is set is undefined.
2369 pub err: *mut crate::lightning_invoice::CreationError,
2372 /// A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
2373 /// containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
2374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2375 pub struct CResult_RouteHintCreationErrorZ {
2376 /// The contents of this CResult_RouteHintCreationErrorZ, accessible via either
2377 /// `err` or `result` depending on the state of `result_ok`.
2378 pub contents: CResult_RouteHintCreationErrorZPtr,
2379 /// Whether this CResult_RouteHintCreationErrorZ represents a success state.
2380 pub result_ok: bool,
2383 /// Creates a new CResult_RouteHintCreationErrorZ in the success state.
2384 pub extern "C" fn CResult_RouteHintCreationErrorZ_ok(o: crate::lightning_invoice::RouteHint) -> CResult_RouteHintCreationErrorZ {
2385 CResult_RouteHintCreationErrorZ {
2386 contents: CResult_RouteHintCreationErrorZPtr {
2387 result: Box::into_raw(Box::new(o)),
2393 /// Creates a new CResult_RouteHintCreationErrorZ in the error state.
2394 pub extern "C" fn CResult_RouteHintCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_RouteHintCreationErrorZ {
2395 CResult_RouteHintCreationErrorZ {
2396 contents: CResult_RouteHintCreationErrorZPtr {
2397 err: Box::into_raw(Box::new(e)),
2403 /// Frees any resources used by the CResult_RouteHintCreationErrorZ.
2404 pub extern "C" fn CResult_RouteHintCreationErrorZ_free(_res: CResult_RouteHintCreationErrorZ) { }
2405 impl Drop for CResult_RouteHintCreationErrorZ {
2406 fn drop(&mut self) {
2408 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2409 let _ = unsafe { Box::from_raw(self.contents.result) };
2412 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2413 let _ = unsafe { Box::from_raw(self.contents.err) };
2418 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>> for CResult_RouteHintCreationErrorZ {
2419 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>) -> Self {
2420 let contents = if o.result_ok {
2421 let result = unsafe { o.contents.result };
2422 unsafe { o.contents.result = std::ptr::null_mut() };
2423 CResult_RouteHintCreationErrorZPtr { result }
2425 let err = unsafe { o.contents.err };
2426 unsafe { o.contents.err = std::ptr::null_mut(); }
2427 CResult_RouteHintCreationErrorZPtr { err }
2431 result_ok: o.result_ok,
2435 impl Clone for CResult_RouteHintCreationErrorZ {
2436 fn clone(&self) -> Self {
2438 Self { result_ok: true, contents: CResult_RouteHintCreationErrorZPtr {
2439 result: Box::into_raw(Box::new(<crate::lightning_invoice::RouteHint>::clone(unsafe { &*self.contents.result })))
2442 Self { result_ok: false, contents: CResult_RouteHintCreationErrorZPtr {
2443 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2449 /// Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
2450 /// but with all dynamically-allocated buffers duplicated in new buffers.
2451 pub extern "C" fn CResult_RouteHintCreationErrorZ_clone(orig: &CResult_RouteHintCreationErrorZ) -> CResult_RouteHintCreationErrorZ { orig.clone() }
2453 /// The contents of CResult_StringErrorZ
2454 pub union CResult_StringErrorZPtr {
2455 /// A pointer to the contents in the success state.
2456 /// Reading from this pointer when `result_ok` is not set is undefined.
2457 pub result: *mut crate::c_types::Str,
2458 /// A pointer to the contents in the error state.
2459 /// Reading from this pointer when `result_ok` is set is undefined.
2460 pub err: *mut crate::c_types::Secp256k1Error,
2463 /// A CResult_StringErrorZ represents the result of a fallible operation,
2464 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
2465 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2466 pub struct CResult_StringErrorZ {
2467 /// The contents of this CResult_StringErrorZ, accessible via either
2468 /// `err` or `result` depending on the state of `result_ok`.
2469 pub contents: CResult_StringErrorZPtr,
2470 /// Whether this CResult_StringErrorZ represents a success state.
2471 pub result_ok: bool,
2474 /// Creates a new CResult_StringErrorZ in the success state.
2475 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
2476 CResult_StringErrorZ {
2477 contents: CResult_StringErrorZPtr {
2478 result: Box::into_raw(Box::new(o)),
2484 /// Creates a new CResult_StringErrorZ in the error state.
2485 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
2486 CResult_StringErrorZ {
2487 contents: CResult_StringErrorZPtr {
2488 err: Box::into_raw(Box::new(e)),
2494 /// Frees any resources used by the CResult_StringErrorZ.
2495 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
2496 impl Drop for CResult_StringErrorZ {
2497 fn drop(&mut self) {
2499 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2500 let _ = unsafe { Box::from_raw(self.contents.result) };
2503 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2504 let _ = unsafe { Box::from_raw(self.contents.err) };
2509 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
2510 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
2511 let contents = if o.result_ok {
2512 let result = unsafe { o.contents.result };
2513 unsafe { o.contents.result = std::ptr::null_mut() };
2514 CResult_StringErrorZPtr { result }
2516 let err = unsafe { o.contents.err };
2517 unsafe { o.contents.err = std::ptr::null_mut(); }
2518 CResult_StringErrorZPtr { err }
2522 result_ok: o.result_ok,
2527 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
2528 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2529 /// A pointer to the contents in the success state.
2530 /// Reading from this pointer when `result_ok` is not set is undefined.
2531 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
2532 /// A pointer to the contents in the error state.
2533 /// Reading from this pointer when `result_ok` is set is undefined.
2534 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2537 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
2538 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2540 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
2541 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
2542 /// `err` or `result` depending on the state of `result_ok`.
2543 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
2544 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
2545 pub result_ok: bool,
2548 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
2549 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2550 CResult_ChannelMonitorUpdateDecodeErrorZ {
2551 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2552 result: Box::into_raw(Box::new(o)),
2558 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
2559 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2560 CResult_ChannelMonitorUpdateDecodeErrorZ {
2561 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2562 err: Box::into_raw(Box::new(e)),
2568 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
2569 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
2570 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
2571 fn drop(&mut self) {
2573 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2574 let _ = unsafe { Box::from_raw(self.contents.result) };
2577 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2578 let _ = unsafe { Box::from_raw(self.contents.err) };
2583 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
2584 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
2585 let contents = if o.result_ok {
2586 let result = unsafe { o.contents.result };
2587 unsafe { o.contents.result = std::ptr::null_mut() };
2588 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
2590 let err = unsafe { o.contents.err };
2591 unsafe { o.contents.err = std::ptr::null_mut(); }
2592 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
2596 result_ok: o.result_ok,
2600 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
2601 fn clone(&self) -> Self {
2603 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2604 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
2607 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2608 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2614 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
2615 /// but with all dynamically-allocated buffers duplicated in new buffers.
2616 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
2618 /// The contents of CResult_HTLCUpdateDecodeErrorZ
2619 pub union CResult_HTLCUpdateDecodeErrorZPtr {
2620 /// A pointer to the contents in the success state.
2621 /// Reading from this pointer when `result_ok` is not set is undefined.
2622 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
2623 /// A pointer to the contents in the error state.
2624 /// Reading from this pointer when `result_ok` is set is undefined.
2625 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2628 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
2629 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2631 pub struct CResult_HTLCUpdateDecodeErrorZ {
2632 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
2633 /// `err` or `result` depending on the state of `result_ok`.
2634 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
2635 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
2636 pub result_ok: bool,
2639 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
2640 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
2641 CResult_HTLCUpdateDecodeErrorZ {
2642 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2643 result: Box::into_raw(Box::new(o)),
2649 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
2650 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
2651 CResult_HTLCUpdateDecodeErrorZ {
2652 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2653 err: Box::into_raw(Box::new(e)),
2659 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
2660 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
2661 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
2662 fn drop(&mut self) {
2664 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2665 let _ = unsafe { Box::from_raw(self.contents.result) };
2668 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2669 let _ = unsafe { Box::from_raw(self.contents.err) };
2674 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
2675 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
2676 let contents = if o.result_ok {
2677 let result = unsafe { o.contents.result };
2678 unsafe { o.contents.result = std::ptr::null_mut() };
2679 CResult_HTLCUpdateDecodeErrorZPtr { result }
2681 let err = unsafe { o.contents.err };
2682 unsafe { o.contents.err = std::ptr::null_mut(); }
2683 CResult_HTLCUpdateDecodeErrorZPtr { err }
2687 result_ok: o.result_ok,
2691 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
2692 fn clone(&self) -> Self {
2694 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2695 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
2698 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2699 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2705 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
2706 /// but with all dynamically-allocated buffers duplicated in new buffers.
2707 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
2709 /// The contents of CResult_NoneMonitorUpdateErrorZ
2710 pub union CResult_NoneMonitorUpdateErrorZPtr {
2711 /// Note that this value is always NULL, as there are no contents in the OK variant
2712 pub result: *mut std::ffi::c_void,
2713 /// A pointer to the contents in the error state.
2714 /// Reading from this pointer when `result_ok` is set is undefined.
2715 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
2718 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
2719 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
2720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2721 pub struct CResult_NoneMonitorUpdateErrorZ {
2722 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
2723 /// `err` or `result` depending on the state of `result_ok`.
2724 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
2725 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
2726 pub result_ok: bool,
2729 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
2730 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
2731 CResult_NoneMonitorUpdateErrorZ {
2732 contents: CResult_NoneMonitorUpdateErrorZPtr {
2733 result: std::ptr::null_mut(),
2739 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
2740 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
2741 CResult_NoneMonitorUpdateErrorZ {
2742 contents: CResult_NoneMonitorUpdateErrorZPtr {
2743 err: Box::into_raw(Box::new(e)),
2749 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
2750 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
2751 impl Drop for CResult_NoneMonitorUpdateErrorZ {
2752 fn drop(&mut self) {
2755 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2756 let _ = unsafe { Box::from_raw(self.contents.err) };
2761 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
2762 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
2763 let contents = if o.result_ok {
2764 let _ = unsafe { Box::from_raw(o.contents.result) };
2765 o.contents.result = std::ptr::null_mut();
2766 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
2768 let err = unsafe { o.contents.err };
2769 unsafe { o.contents.err = std::ptr::null_mut(); }
2770 CResult_NoneMonitorUpdateErrorZPtr { err }
2774 result_ok: o.result_ok,
2778 impl Clone for CResult_NoneMonitorUpdateErrorZ {
2779 fn clone(&self) -> Self {
2781 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
2782 result: std::ptr::null_mut()
2785 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
2786 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
2792 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
2793 /// but with all dynamically-allocated buffers duplicated in new buffers.
2794 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
2796 /// A tuple of 2 elements. See the individual fields for the types contained.
2797 pub struct C2Tuple_OutPointScriptZ {
2798 /// The element at position 0
2799 pub a: crate::lightning::chain::transaction::OutPoint,
2800 /// The element at position 1
2801 pub b: crate::c_types::derived::CVec_u8Z,
2803 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
2804 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
2811 impl C2Tuple_OutPointScriptZ {
2812 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
2816 impl Clone for C2Tuple_OutPointScriptZ {
2817 fn clone(&self) -> Self {
2825 /// Creates a new tuple which has the same data as `orig`
2826 /// but with all dynamically-allocated buffers duplicated in new buffers.
2827 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
2828 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
2830 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
2831 C2Tuple_OutPointScriptZ { a, b, }
2835 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
2836 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
2838 /// A tuple of 2 elements. See the individual fields for the types contained.
2839 pub struct C2Tuple_u32ScriptZ {
2840 /// The element at position 0
2842 /// The element at position 1
2843 pub b: crate::c_types::derived::CVec_u8Z,
2845 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
2846 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
2853 impl C2Tuple_u32ScriptZ {
2854 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
2858 impl Clone for C2Tuple_u32ScriptZ {
2859 fn clone(&self) -> Self {
2867 /// Creates a new tuple which has the same data as `orig`
2868 /// but with all dynamically-allocated buffers duplicated in new buffers.
2869 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
2870 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
2872 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
2873 C2Tuple_u32ScriptZ { a, b, }
2877 /// Frees any resources used by the C2Tuple_u32ScriptZ.
2878 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
2880 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
2881 /// This corresponds to std::vector in C++
2882 pub struct CVec_C2Tuple_u32ScriptZZ {
2883 /// The elements in the array.
2884 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2885 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
2886 /// The number of elements pointed to by `data`.
2889 impl CVec_C2Tuple_u32ScriptZZ {
2890 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
2891 if self.datalen == 0 { return Vec::new(); }
2892 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2893 self.data = std::ptr::null_mut();
2897 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
2898 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2901 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
2902 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
2903 let datalen = v.len();
2904 let data = Box::into_raw(v.into_boxed_slice());
2905 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2910 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
2911 impl Drop for CVec_C2Tuple_u32ScriptZZ {
2912 fn drop(&mut self) {
2913 if self.datalen == 0 { return; }
2914 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2917 impl Clone for CVec_C2Tuple_u32ScriptZZ {
2918 fn clone(&self) -> Self {
2919 let mut res = Vec::new();
2920 if self.datalen == 0 { return Self::from(res); }
2921 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2926 /// A tuple of 2 elements. See the individual fields for the types contained.
2927 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2928 /// The element at position 0
2929 pub a: crate::c_types::ThirtyTwoBytes,
2930 /// The element at position 1
2931 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
2933 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2934 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
2941 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2942 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
2946 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
2948 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 {
2949 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
2953 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
2954 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
2956 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
2957 /// This corresponds to std::vector in C++
2958 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2959 /// The elements in the array.
2960 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2961 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
2962 /// The number of elements pointed to by `data`.
2965 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2966 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
2967 if self.datalen == 0 { return Vec::new(); }
2968 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2969 self.data = std::ptr::null_mut();
2973 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
2974 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2977 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2978 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
2979 let datalen = v.len();
2980 let data = Box::into_raw(v.into_boxed_slice());
2981 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2985 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2986 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
2987 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2988 fn drop(&mut self) {
2989 if self.datalen == 0 { return; }
2990 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2994 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2995 /// This corresponds to std::vector in C++
2996 pub struct CVec_MonitorEventZ {
2997 /// The elements in the array.
2998 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2999 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3000 /// The number of elements pointed to by `data`.
3003 impl CVec_MonitorEventZ {
3004 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3005 if self.datalen == 0 { return Vec::new(); }
3006 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3007 self.data = std::ptr::null_mut();
3011 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3012 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3015 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3016 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3017 let datalen = v.len();
3018 let data = Box::into_raw(v.into_boxed_slice());
3019 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3023 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3024 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3025 impl Drop for CVec_MonitorEventZ {
3026 fn drop(&mut self) {
3027 if self.datalen == 0 { return; }
3028 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3031 impl Clone for CVec_MonitorEventZ {
3032 fn clone(&self) -> Self {
3033 let mut res = Vec::new();
3034 if self.datalen == 0 { return Self::from(res); }
3035 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3040 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
3041 /// This corresponds to std::vector in C++
3042 pub struct CVec_EventZ {
3043 /// The elements in the array.
3044 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3045 pub data: *mut crate::lightning::util::events::Event,
3046 /// The number of elements pointed to by `data`.
3050 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
3051 if self.datalen == 0 { return Vec::new(); }
3052 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3053 self.data = std::ptr::null_mut();
3057 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
3058 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3061 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
3062 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
3063 let datalen = v.len();
3064 let data = Box::into_raw(v.into_boxed_slice());
3065 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3069 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3070 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
3071 impl Drop for CVec_EventZ {
3072 fn drop(&mut self) {
3073 if self.datalen == 0 { return; }
3074 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3077 impl Clone for CVec_EventZ {
3078 fn clone(&self) -> Self {
3079 let mut res = Vec::new();
3080 if self.datalen == 0 { return Self::from(res); }
3081 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3086 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
3087 /// This corresponds to std::vector in C++
3088 pub struct CVec_TransactionZ {
3089 /// The elements in the array.
3090 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3091 pub data: *mut crate::c_types::Transaction,
3092 /// The number of elements pointed to by `data`.
3095 impl CVec_TransactionZ {
3096 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
3097 if self.datalen == 0 { return Vec::new(); }
3098 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3099 self.data = std::ptr::null_mut();
3103 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
3104 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3107 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
3108 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
3109 let datalen = v.len();
3110 let data = Box::into_raw(v.into_boxed_slice());
3111 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3115 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3116 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
3117 impl Drop for CVec_TransactionZ {
3118 fn drop(&mut self) {
3119 if self.datalen == 0 { return; }
3120 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3124 /// A tuple of 2 elements. See the individual fields for the types contained.
3125 pub struct C2Tuple_usizeTransactionZ {
3126 /// The element at position 0
3128 /// The element at position 1
3129 pub b: crate::c_types::Transaction,
3131 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3132 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3139 impl C2Tuple_usizeTransactionZ {
3140 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3144 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3146 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3147 C2Tuple_usizeTransactionZ { a, b, }
3151 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3152 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3154 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3155 /// This corresponds to std::vector in C++
3156 pub struct CVec_C2Tuple_usizeTransactionZZ {
3157 /// The elements in the array.
3158 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3159 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3160 /// The number of elements pointed to by `data`.
3163 impl CVec_C2Tuple_usizeTransactionZZ {
3164 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3165 if self.datalen == 0 { return Vec::new(); }
3166 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3167 self.data = std::ptr::null_mut();
3171 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3172 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3175 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3176 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3177 let datalen = v.len();
3178 let data = Box::into_raw(v.into_boxed_slice());
3179 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3183 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3184 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3185 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3186 fn drop(&mut self) {
3187 if self.datalen == 0 { return; }
3188 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3192 /// A tuple of 2 elements. See the individual fields for the types contained.
3193 pub struct C2Tuple_u32TxOutZ {
3194 /// The element at position 0
3196 /// The element at position 1
3197 pub b: crate::c_types::TxOut,
3199 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
3200 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
3207 impl C2Tuple_u32TxOutZ {
3208 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
3212 impl Clone for C2Tuple_u32TxOutZ {
3213 fn clone(&self) -> Self {
3221 /// Creates a new tuple which has the same data as `orig`
3222 /// but with all dynamically-allocated buffers duplicated in new buffers.
3223 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
3224 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
3226 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
3227 C2Tuple_u32TxOutZ { a, b, }
3231 /// Frees any resources used by the C2Tuple_u32TxOutZ.
3232 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
3234 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
3235 /// This corresponds to std::vector in C++
3236 pub struct CVec_C2Tuple_u32TxOutZZ {
3237 /// The elements in the array.
3238 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3239 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
3240 /// The number of elements pointed to by `data`.
3243 impl CVec_C2Tuple_u32TxOutZZ {
3244 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
3245 if self.datalen == 0 { return Vec::new(); }
3246 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3247 self.data = std::ptr::null_mut();
3251 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
3252 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3255 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
3256 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
3257 let datalen = v.len();
3258 let data = Box::into_raw(v.into_boxed_slice());
3259 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3263 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3264 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
3265 impl Drop for CVec_C2Tuple_u32TxOutZZ {
3266 fn drop(&mut self) {
3267 if self.datalen == 0 { return; }
3268 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3271 impl Clone for CVec_C2Tuple_u32TxOutZZ {
3272 fn clone(&self) -> Self {
3273 let mut res = Vec::new();
3274 if self.datalen == 0 { return Self::from(res); }
3275 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3280 /// A tuple of 2 elements. See the individual fields for the types contained.
3281 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3282 /// The element at position 0
3283 pub a: crate::c_types::ThirtyTwoBytes,
3284 /// The element at position 1
3285 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
3287 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3288 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
3295 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3296 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3300 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
3302 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 {
3303 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3307 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
3308 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3310 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
3311 /// This corresponds to std::vector in C++
3312 pub struct CVec_TransactionOutputsZ {
3313 /// The elements in the array.
3314 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3315 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3316 /// The number of elements pointed to by `data`.
3319 impl CVec_TransactionOutputsZ {
3320 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3321 if self.datalen == 0 { return Vec::new(); }
3322 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3323 self.data = std::ptr::null_mut();
3327 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3328 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3331 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
3332 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3333 let datalen = v.len();
3334 let data = Box::into_raw(v.into_boxed_slice());
3335 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3339 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3340 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
3341 impl Drop for CVec_TransactionOutputsZ {
3342 fn drop(&mut self) {
3343 if self.datalen == 0 { return; }
3344 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3348 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3349 /// This corresponds to std::vector in C++
3350 pub struct CVec_TxidZ {
3351 /// The elements in the array.
3352 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3353 pub data: *mut crate::c_types::ThirtyTwoBytes,
3354 /// The number of elements pointed to by `data`.
3358 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3359 if self.datalen == 0 { return Vec::new(); }
3360 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3361 self.data = std::ptr::null_mut();
3365 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3366 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3369 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3370 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3371 let datalen = v.len();
3372 let data = Box::into_raw(v.into_boxed_slice());
3373 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3377 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3378 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3379 impl Drop for CVec_TxidZ {
3380 fn drop(&mut self) {
3381 if self.datalen == 0 { return; }
3382 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3386 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3387 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3388 /// Note that this value is always NULL, as there are no contents in the OK variant
3389 pub result: *mut std::ffi::c_void,
3390 /// A pointer to the contents in the error state.
3391 /// Reading from this pointer when `result_ok` is set is undefined.
3392 pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
3395 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3396 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
3397 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3398 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3399 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3400 /// `err` or `result` depending on the state of `result_ok`.
3401 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3402 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3403 pub result_ok: bool,
3406 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3407 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3408 CResult_NoneChannelMonitorUpdateErrZ {
3409 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3410 result: std::ptr::null_mut(),
3416 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3417 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3418 CResult_NoneChannelMonitorUpdateErrZ {
3419 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3420 err: Box::into_raw(Box::new(e)),
3426 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3427 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3428 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3429 fn drop(&mut self) {
3432 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3433 let _ = unsafe { Box::from_raw(self.contents.err) };
3438 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3439 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
3440 let contents = if o.result_ok {
3441 let _ = unsafe { Box::from_raw(o.contents.result) };
3442 o.contents.result = std::ptr::null_mut();
3443 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
3445 let err = unsafe { o.contents.err };
3446 unsafe { o.contents.err = std::ptr::null_mut(); }
3447 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3451 result_ok: o.result_ok,
3455 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3456 fn clone(&self) -> Self {
3458 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3459 result: std::ptr::null_mut()
3462 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3463 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3469 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3470 /// but with all dynamically-allocated buffers duplicated in new buffers.
3471 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
3473 /// A tuple of 2 elements. See the individual fields for the types contained.
3474 pub struct C2Tuple_BlockHashChannelMonitorZ {
3475 /// The element at position 0
3476 pub a: crate::c_types::ThirtyTwoBytes,
3477 /// The element at position 1
3478 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3480 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3481 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3488 impl C2Tuple_BlockHashChannelMonitorZ {
3489 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3493 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3495 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3496 C2Tuple_BlockHashChannelMonitorZ { a, b, }
3500 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3501 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3503 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3504 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3505 /// A pointer to the contents in the success state.
3506 /// Reading from this pointer when `result_ok` is not set is undefined.
3507 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3508 /// A pointer to the contents in the error state.
3509 /// Reading from this pointer when `result_ok` is set is undefined.
3510 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3513 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
3514 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3516 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3517 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
3518 /// `err` or `result` depending on the state of `result_ok`.
3519 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
3520 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
3521 pub result_ok: bool,
3524 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
3525 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3526 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3527 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3528 result: Box::into_raw(Box::new(o)),
3534 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
3535 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3536 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3537 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3538 err: Box::into_raw(Box::new(e)),
3544 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
3545 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
3546 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3547 fn drop(&mut self) {
3549 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3550 let _ = unsafe { Box::from_raw(self.contents.result) };
3553 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3554 let _ = unsafe { Box::from_raw(self.contents.err) };
3559 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3560 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3561 let contents = if o.result_ok {
3562 let result = unsafe { o.contents.result };
3563 unsafe { o.contents.result = std::ptr::null_mut() };
3564 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
3566 let err = unsafe { o.contents.err };
3567 unsafe { o.contents.err = std::ptr::null_mut(); }
3568 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
3572 result_ok: o.result_ok,
3577 /// The contents of CResult_RouteHopDecodeErrorZ
3578 pub union CResult_RouteHopDecodeErrorZPtr {
3579 /// A pointer to the contents in the success state.
3580 /// Reading from this pointer when `result_ok` is not set is undefined.
3581 pub result: *mut crate::lightning::routing::router::RouteHop,
3582 /// A pointer to the contents in the error state.
3583 /// Reading from this pointer when `result_ok` is set is undefined.
3584 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3587 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3588 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3589 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3590 pub struct CResult_RouteHopDecodeErrorZ {
3591 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3592 /// `err` or `result` depending on the state of `result_ok`.
3593 pub contents: CResult_RouteHopDecodeErrorZPtr,
3594 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3595 pub result_ok: bool,
3598 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
3599 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
3600 CResult_RouteHopDecodeErrorZ {
3601 contents: CResult_RouteHopDecodeErrorZPtr {
3602 result: Box::into_raw(Box::new(o)),
3608 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
3609 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
3610 CResult_RouteHopDecodeErrorZ {
3611 contents: CResult_RouteHopDecodeErrorZPtr {
3612 err: Box::into_raw(Box::new(e)),
3618 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
3619 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
3620 impl Drop for CResult_RouteHopDecodeErrorZ {
3621 fn drop(&mut self) {
3623 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3624 let _ = unsafe { Box::from_raw(self.contents.result) };
3627 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3628 let _ = unsafe { Box::from_raw(self.contents.err) };
3633 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
3634 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3635 let contents = if o.result_ok {
3636 let result = unsafe { o.contents.result };
3637 unsafe { o.contents.result = std::ptr::null_mut() };
3638 CResult_RouteHopDecodeErrorZPtr { result }
3640 let err = unsafe { o.contents.err };
3641 unsafe { o.contents.err = std::ptr::null_mut(); }
3642 CResult_RouteHopDecodeErrorZPtr { err }
3646 result_ok: o.result_ok,
3650 impl Clone for CResult_RouteHopDecodeErrorZ {
3651 fn clone(&self) -> Self {
3653 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
3654 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
3657 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
3658 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3664 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
3665 /// but with all dynamically-allocated buffers duplicated in new buffers.
3666 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { orig.clone() }
3668 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3669 /// This corresponds to std::vector in C++
3670 pub struct CVec_RouteHopZ {
3671 /// The elements in the array.
3672 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3673 pub data: *mut crate::lightning::routing::router::RouteHop,
3674 /// The number of elements pointed to by `data`.
3677 impl CVec_RouteHopZ {
3678 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3679 if self.datalen == 0 { return Vec::new(); }
3680 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3681 self.data = std::ptr::null_mut();
3685 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3686 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3689 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3690 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3691 let datalen = v.len();
3692 let data = Box::into_raw(v.into_boxed_slice());
3693 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3697 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3698 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3699 impl Drop for CVec_RouteHopZ {
3700 fn drop(&mut self) {
3701 if self.datalen == 0 { return; }
3702 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3705 impl Clone for CVec_RouteHopZ {
3706 fn clone(&self) -> Self {
3707 let mut res = Vec::new();
3708 if self.datalen == 0 { return Self::from(res); }
3709 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3714 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3715 /// This corresponds to std::vector in C++
3716 pub struct CVec_CVec_RouteHopZZ {
3717 /// The elements in the array.
3718 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3719 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3720 /// The number of elements pointed to by `data`.
3723 impl CVec_CVec_RouteHopZZ {
3724 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3725 if self.datalen == 0 { return Vec::new(); }
3726 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3727 self.data = std::ptr::null_mut();
3731 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3732 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3735 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3736 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3737 let datalen = v.len();
3738 let data = Box::into_raw(v.into_boxed_slice());
3739 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3744 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3745 impl Drop for CVec_CVec_RouteHopZZ {
3746 fn drop(&mut self) {
3747 if self.datalen == 0 { return; }
3748 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3751 impl Clone for CVec_CVec_RouteHopZZ {
3752 fn clone(&self) -> Self {
3753 let mut res = Vec::new();
3754 if self.datalen == 0 { return Self::from(res); }
3755 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3760 /// The contents of CResult_RouteDecodeErrorZ
3761 pub union CResult_RouteDecodeErrorZPtr {
3762 /// A pointer to the contents in the success state.
3763 /// Reading from this pointer when `result_ok` is not set is undefined.
3764 pub result: *mut crate::lightning::routing::router::Route,
3765 /// A pointer to the contents in the error state.
3766 /// Reading from this pointer when `result_ok` is set is undefined.
3767 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3770 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3771 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3773 pub struct CResult_RouteDecodeErrorZ {
3774 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3775 /// `err` or `result` depending on the state of `result_ok`.
3776 pub contents: CResult_RouteDecodeErrorZPtr,
3777 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3778 pub result_ok: bool,
3781 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3782 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3783 CResult_RouteDecodeErrorZ {
3784 contents: CResult_RouteDecodeErrorZPtr {
3785 result: Box::into_raw(Box::new(o)),
3791 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3792 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3793 CResult_RouteDecodeErrorZ {
3794 contents: CResult_RouteDecodeErrorZPtr {
3795 err: Box::into_raw(Box::new(e)),
3801 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3802 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3803 impl Drop for CResult_RouteDecodeErrorZ {
3804 fn drop(&mut self) {
3806 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3807 let _ = unsafe { Box::from_raw(self.contents.result) };
3810 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3811 let _ = unsafe { Box::from_raw(self.contents.err) };
3816 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3817 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3818 let contents = if o.result_ok {
3819 let result = unsafe { o.contents.result };
3820 unsafe { o.contents.result = std::ptr::null_mut() };
3821 CResult_RouteDecodeErrorZPtr { result }
3823 let err = unsafe { o.contents.err };
3824 unsafe { o.contents.err = std::ptr::null_mut(); }
3825 CResult_RouteDecodeErrorZPtr { err }
3829 result_ok: o.result_ok,
3833 impl Clone for CResult_RouteDecodeErrorZ {
3834 fn clone(&self) -> Self {
3836 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3837 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3840 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3841 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3847 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3848 /// but with all dynamically-allocated buffers duplicated in new buffers.
3849 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
3851 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3852 /// This corresponds to std::vector in C++
3853 pub struct CVec_ChannelDetailsZ {
3854 /// The elements in the array.
3855 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3856 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3857 /// The number of elements pointed to by `data`.
3860 impl CVec_ChannelDetailsZ {
3861 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3862 if self.datalen == 0 { return Vec::new(); }
3863 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3864 self.data = std::ptr::null_mut();
3868 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3869 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3872 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3873 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3874 let datalen = v.len();
3875 let data = Box::into_raw(v.into_boxed_slice());
3876 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3880 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3881 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3882 impl Drop for CVec_ChannelDetailsZ {
3883 fn drop(&mut self) {
3884 if self.datalen == 0 { return; }
3885 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3888 impl Clone for CVec_ChannelDetailsZ {
3889 fn clone(&self) -> Self {
3890 let mut res = Vec::new();
3891 if self.datalen == 0 { return Self::from(res); }
3892 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3897 /// The contents of CResult_RouteLightningErrorZ
3898 pub union CResult_RouteLightningErrorZPtr {
3899 /// A pointer to the contents in the success state.
3900 /// Reading from this pointer when `result_ok` is not set is undefined.
3901 pub result: *mut crate::lightning::routing::router::Route,
3902 /// A pointer to the contents in the error state.
3903 /// Reading from this pointer when `result_ok` is set is undefined.
3904 pub err: *mut crate::lightning::ln::msgs::LightningError,
3907 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3908 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3910 pub struct CResult_RouteLightningErrorZ {
3911 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3912 /// `err` or `result` depending on the state of `result_ok`.
3913 pub contents: CResult_RouteLightningErrorZPtr,
3914 /// Whether this CResult_RouteLightningErrorZ represents a success state.
3915 pub result_ok: bool,
3918 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3919 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3920 CResult_RouteLightningErrorZ {
3921 contents: CResult_RouteLightningErrorZPtr {
3922 result: Box::into_raw(Box::new(o)),
3928 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3929 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3930 CResult_RouteLightningErrorZ {
3931 contents: CResult_RouteLightningErrorZPtr {
3932 err: Box::into_raw(Box::new(e)),
3938 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3939 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3940 impl Drop for CResult_RouteLightningErrorZ {
3941 fn drop(&mut self) {
3943 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3944 let _ = unsafe { Box::from_raw(self.contents.result) };
3947 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3948 let _ = unsafe { Box::from_raw(self.contents.err) };
3953 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3954 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3955 let contents = if o.result_ok {
3956 let result = unsafe { o.contents.result };
3957 unsafe { o.contents.result = std::ptr::null_mut() };
3958 CResult_RouteLightningErrorZPtr { result }
3960 let err = unsafe { o.contents.err };
3961 unsafe { o.contents.err = std::ptr::null_mut(); }
3962 CResult_RouteLightningErrorZPtr { err }
3966 result_ok: o.result_ok,
3970 impl Clone for CResult_RouteLightningErrorZ {
3971 fn clone(&self) -> Self {
3973 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3974 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3977 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3978 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3984 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3985 /// but with all dynamically-allocated buffers duplicated in new buffers.
3986 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
3988 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3989 /// This corresponds to std::vector in C++
3990 pub struct CVec_MessageSendEventZ {
3991 /// The elements in the array.
3992 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3993 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3994 /// The number of elements pointed to by `data`.
3997 impl CVec_MessageSendEventZ {
3998 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3999 if self.datalen == 0 { return Vec::new(); }
4000 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4001 self.data = std::ptr::null_mut();
4005 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
4006 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4009 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
4010 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
4011 let datalen = v.len();
4012 let data = Box::into_raw(v.into_boxed_slice());
4013 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4017 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4018 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
4019 impl Drop for CVec_MessageSendEventZ {
4020 fn drop(&mut self) {
4021 if self.datalen == 0 { return; }
4022 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4025 impl Clone for CVec_MessageSendEventZ {
4026 fn clone(&self) -> Self {
4027 let mut res = Vec::new();
4028 if self.datalen == 0 { return Self::from(res); }
4029 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4034 /// The contents of CResult_boolLightningErrorZ
4035 pub union CResult_boolLightningErrorZPtr {
4036 /// A pointer to the contents in the success state.
4037 /// Reading from this pointer when `result_ok` is not set is undefined.
4038 pub result: *mut bool,
4039 /// A pointer to the contents in the error state.
4040 /// Reading from this pointer when `result_ok` is set is undefined.
4041 pub err: *mut crate::lightning::ln::msgs::LightningError,
4044 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
4045 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4047 pub struct CResult_boolLightningErrorZ {
4048 /// The contents of this CResult_boolLightningErrorZ, accessible via either
4049 /// `err` or `result` depending on the state of `result_ok`.
4050 pub contents: CResult_boolLightningErrorZPtr,
4051 /// Whether this CResult_boolLightningErrorZ represents a success state.
4052 pub result_ok: bool,
4055 /// Creates a new CResult_boolLightningErrorZ in the success state.
4056 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
4057 CResult_boolLightningErrorZ {
4058 contents: CResult_boolLightningErrorZPtr {
4059 result: Box::into_raw(Box::new(o)),
4065 /// Creates a new CResult_boolLightningErrorZ in the error state.
4066 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
4067 CResult_boolLightningErrorZ {
4068 contents: CResult_boolLightningErrorZPtr {
4069 err: Box::into_raw(Box::new(e)),
4075 /// Frees any resources used by the CResult_boolLightningErrorZ.
4076 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
4077 impl Drop for CResult_boolLightningErrorZ {
4078 fn drop(&mut self) {
4080 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4081 let _ = unsafe { Box::from_raw(self.contents.result) };
4084 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4085 let _ = unsafe { Box::from_raw(self.contents.err) };
4090 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4091 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4092 let contents = if o.result_ok {
4093 let result = unsafe { o.contents.result };
4094 unsafe { o.contents.result = std::ptr::null_mut() };
4095 CResult_boolLightningErrorZPtr { result }
4097 let err = unsafe { o.contents.err };
4098 unsafe { o.contents.err = std::ptr::null_mut(); }
4099 CResult_boolLightningErrorZPtr { err }
4103 result_ok: o.result_ok,
4107 impl Clone for CResult_boolLightningErrorZ {
4108 fn clone(&self) -> Self {
4110 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4111 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4114 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4115 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4121 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4122 /// but with all dynamically-allocated buffers duplicated in new buffers.
4123 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
4125 /// A tuple of 3 elements. See the individual fields for the types contained.
4126 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4127 /// The element at position 0
4128 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4129 /// The element at position 1
4130 pub b: crate::lightning::ln::msgs::ChannelUpdate,
4131 /// The element at position 2
4132 pub c: crate::lightning::ln::msgs::ChannelUpdate,
4134 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4135 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4143 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4144 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4145 (self.a, self.b, self.c)
4148 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4149 fn clone(&self) -> Self {
4158 /// Creates a new tuple which has the same data as `orig`
4159 /// but with all dynamically-allocated buffers duplicated in new buffers.
4160 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
4161 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4163 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 {
4164 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
4168 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
4169 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
4171 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4172 /// This corresponds to std::vector in C++
4173 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4174 /// The elements in the array.
4175 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4176 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
4177 /// The number of elements pointed to by `data`.
4180 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4181 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
4182 if self.datalen == 0 { return Vec::new(); }
4183 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4184 self.data = std::ptr::null_mut();
4188 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
4189 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4192 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4193 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
4194 let datalen = v.len();
4195 let data = Box::into_raw(v.into_boxed_slice());
4196 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4200 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4201 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
4202 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4203 fn drop(&mut self) {
4204 if self.datalen == 0 { return; }
4205 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4208 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4209 fn clone(&self) -> Self {
4210 let mut res = Vec::new();
4211 if self.datalen == 0 { return Self::from(res); }
4212 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4217 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4218 /// This corresponds to std::vector in C++
4219 pub struct CVec_NodeAnnouncementZ {
4220 /// The elements in the array.
4221 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4222 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
4223 /// The number of elements pointed to by `data`.
4226 impl CVec_NodeAnnouncementZ {
4227 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
4228 if self.datalen == 0 { return Vec::new(); }
4229 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4230 self.data = std::ptr::null_mut();
4234 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
4235 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4238 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
4239 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
4240 let datalen = v.len();
4241 let data = Box::into_raw(v.into_boxed_slice());
4242 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4246 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4247 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
4248 impl Drop for CVec_NodeAnnouncementZ {
4249 fn drop(&mut self) {
4250 if self.datalen == 0 { return; }
4251 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4254 impl Clone for CVec_NodeAnnouncementZ {
4255 fn clone(&self) -> Self {
4256 let mut res = Vec::new();
4257 if self.datalen == 0 { return Self::from(res); }
4258 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4263 /// The contents of CResult_NoneLightningErrorZ
4264 pub union CResult_NoneLightningErrorZPtr {
4265 /// Note that this value is always NULL, as there are no contents in the OK variant
4266 pub result: *mut std::ffi::c_void,
4267 /// A pointer to the contents in the error state.
4268 /// Reading from this pointer when `result_ok` is set is undefined.
4269 pub err: *mut crate::lightning::ln::msgs::LightningError,
4272 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4273 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4274 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4275 pub struct CResult_NoneLightningErrorZ {
4276 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
4277 /// `err` or `result` depending on the state of `result_ok`.
4278 pub contents: CResult_NoneLightningErrorZPtr,
4279 /// Whether this CResult_NoneLightningErrorZ represents a success state.
4280 pub result_ok: bool,
4283 /// Creates a new CResult_NoneLightningErrorZ in the success state.
4284 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
4285 CResult_NoneLightningErrorZ {
4286 contents: CResult_NoneLightningErrorZPtr {
4287 result: std::ptr::null_mut(),
4293 /// Creates a new CResult_NoneLightningErrorZ in the error state.
4294 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
4295 CResult_NoneLightningErrorZ {
4296 contents: CResult_NoneLightningErrorZPtr {
4297 err: Box::into_raw(Box::new(e)),
4303 /// Frees any resources used by the CResult_NoneLightningErrorZ.
4304 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
4305 impl Drop for CResult_NoneLightningErrorZ {
4306 fn drop(&mut self) {
4309 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4310 let _ = unsafe { Box::from_raw(self.contents.err) };
4315 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
4316 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
4317 let contents = if o.result_ok {
4318 let _ = unsafe { Box::from_raw(o.contents.result) };
4319 o.contents.result = std::ptr::null_mut();
4320 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
4322 let err = unsafe { o.contents.err };
4323 unsafe { o.contents.err = std::ptr::null_mut(); }
4324 CResult_NoneLightningErrorZPtr { err }
4328 result_ok: o.result_ok,
4332 impl Clone for CResult_NoneLightningErrorZ {
4333 fn clone(&self) -> Self {
4335 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
4336 result: std::ptr::null_mut()
4339 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
4340 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4346 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
4347 /// but with all dynamically-allocated buffers duplicated in new buffers.
4348 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
4350 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4351 /// This corresponds to std::vector in C++
4352 pub struct CVec_PublicKeyZ {
4353 /// The elements in the array.
4354 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4355 pub data: *mut crate::c_types::PublicKey,
4356 /// The number of elements pointed to by `data`.
4359 impl CVec_PublicKeyZ {
4360 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4361 if self.datalen == 0 { return Vec::new(); }
4362 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4363 self.data = std::ptr::null_mut();
4367 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4368 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4371 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4372 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4373 let datalen = v.len();
4374 let data = Box::into_raw(v.into_boxed_slice());
4375 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4379 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4380 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4381 impl Drop for CVec_PublicKeyZ {
4382 fn drop(&mut self) {
4383 if self.datalen == 0 { return; }
4384 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4388 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
4389 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
4390 /// A pointer to the contents in the success state.
4391 /// Reading from this pointer when `result_ok` is not set is undefined.
4392 pub result: *mut crate::c_types::derived::CVec_u8Z,
4393 /// A pointer to the contents in the error state.
4394 /// Reading from this pointer when `result_ok` is set is undefined.
4395 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4398 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4399 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4401 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
4402 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4403 /// `err` or `result` depending on the state of `result_ok`.
4404 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
4405 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4406 pub result_ok: bool,
4409 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
4410 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
4411 CResult_CVec_u8ZPeerHandleErrorZ {
4412 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4413 result: Box::into_raw(Box::new(o)),
4419 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
4420 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
4421 CResult_CVec_u8ZPeerHandleErrorZ {
4422 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4423 err: Box::into_raw(Box::new(e)),
4429 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
4430 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
4431 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
4432 fn drop(&mut self) {
4434 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4435 let _ = unsafe { Box::from_raw(self.contents.result) };
4438 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4439 let _ = unsafe { Box::from_raw(self.contents.err) };
4444 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
4445 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4446 let contents = if o.result_ok {
4447 let result = unsafe { o.contents.result };
4448 unsafe { o.contents.result = std::ptr::null_mut() };
4449 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
4451 let err = unsafe { o.contents.err };
4452 unsafe { o.contents.err = std::ptr::null_mut(); }
4453 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
4457 result_ok: o.result_ok,
4461 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
4462 fn clone(&self) -> Self {
4464 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4465 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
4468 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4469 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4475 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
4476 /// but with all dynamically-allocated buffers duplicated in new buffers.
4477 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
4479 /// The contents of CResult_NonePeerHandleErrorZ
4480 pub union CResult_NonePeerHandleErrorZPtr {
4481 /// Note that this value is always NULL, as there are no contents in the OK variant
4482 pub result: *mut std::ffi::c_void,
4483 /// A pointer to the contents in the error state.
4484 /// Reading from this pointer when `result_ok` is set is undefined.
4485 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4488 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4489 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4491 pub struct CResult_NonePeerHandleErrorZ {
4492 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4493 /// `err` or `result` depending on the state of `result_ok`.
4494 pub contents: CResult_NonePeerHandleErrorZPtr,
4495 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
4496 pub result_ok: bool,
4499 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
4500 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
4501 CResult_NonePeerHandleErrorZ {
4502 contents: CResult_NonePeerHandleErrorZPtr {
4503 result: std::ptr::null_mut(),
4509 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
4510 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
4511 CResult_NonePeerHandleErrorZ {
4512 contents: CResult_NonePeerHandleErrorZPtr {
4513 err: Box::into_raw(Box::new(e)),
4519 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
4520 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
4521 impl Drop for CResult_NonePeerHandleErrorZ {
4522 fn drop(&mut self) {
4525 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4526 let _ = unsafe { Box::from_raw(self.contents.err) };
4531 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
4532 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4533 let contents = if o.result_ok {
4534 let _ = unsafe { Box::from_raw(o.contents.result) };
4535 o.contents.result = std::ptr::null_mut();
4536 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
4538 let err = unsafe { o.contents.err };
4539 unsafe { o.contents.err = std::ptr::null_mut(); }
4540 CResult_NonePeerHandleErrorZPtr { err }
4544 result_ok: o.result_ok,
4548 impl Clone for CResult_NonePeerHandleErrorZ {
4549 fn clone(&self) -> Self {
4551 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
4552 result: std::ptr::null_mut()
4555 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
4556 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4562 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
4563 /// but with all dynamically-allocated buffers duplicated in new buffers.
4564 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
4566 /// The contents of CResult_boolPeerHandleErrorZ
4567 pub union CResult_boolPeerHandleErrorZPtr {
4568 /// A pointer to the contents in the success state.
4569 /// Reading from this pointer when `result_ok` is not set is undefined.
4570 pub result: *mut bool,
4571 /// A pointer to the contents in the error state.
4572 /// Reading from this pointer when `result_ok` is set is undefined.
4573 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4576 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4577 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4579 pub struct CResult_boolPeerHandleErrorZ {
4580 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4581 /// `err` or `result` depending on the state of `result_ok`.
4582 pub contents: CResult_boolPeerHandleErrorZPtr,
4583 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
4584 pub result_ok: bool,
4587 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
4588 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
4589 CResult_boolPeerHandleErrorZ {
4590 contents: CResult_boolPeerHandleErrorZPtr {
4591 result: Box::into_raw(Box::new(o)),
4597 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
4598 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
4599 CResult_boolPeerHandleErrorZ {
4600 contents: CResult_boolPeerHandleErrorZPtr {
4601 err: Box::into_raw(Box::new(e)),
4607 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
4608 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
4609 impl Drop for CResult_boolPeerHandleErrorZ {
4610 fn drop(&mut self) {
4612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4613 let _ = unsafe { Box::from_raw(self.contents.result) };
4616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4617 let _ = unsafe { Box::from_raw(self.contents.err) };
4622 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
4623 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4624 let contents = if o.result_ok {
4625 let result = unsafe { o.contents.result };
4626 unsafe { o.contents.result = std::ptr::null_mut() };
4627 CResult_boolPeerHandleErrorZPtr { result }
4629 let err = unsafe { o.contents.err };
4630 unsafe { o.contents.err = std::ptr::null_mut(); }
4631 CResult_boolPeerHandleErrorZPtr { err }
4635 result_ok: o.result_ok,
4639 impl Clone for CResult_boolPeerHandleErrorZ {
4640 fn clone(&self) -> Self {
4642 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
4643 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4646 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
4647 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4653 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
4654 /// but with all dynamically-allocated buffers duplicated in new buffers.
4655 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
4657 /// The contents of CResult_TxOutAccessErrorZ
4658 pub union CResult_TxOutAccessErrorZPtr {
4659 /// A pointer to the contents in the success state.
4660 /// Reading from this pointer when `result_ok` is not set is undefined.
4661 pub result: *mut crate::c_types::TxOut,
4662 /// A pointer to the contents in the error state.
4663 /// Reading from this pointer when `result_ok` is set is undefined.
4664 pub err: *mut crate::lightning::chain::AccessError,
4667 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4668 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4670 pub struct CResult_TxOutAccessErrorZ {
4671 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
4672 /// `err` or `result` depending on the state of `result_ok`.
4673 pub contents: CResult_TxOutAccessErrorZPtr,
4674 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
4675 pub result_ok: bool,
4678 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
4679 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
4680 CResult_TxOutAccessErrorZ {
4681 contents: CResult_TxOutAccessErrorZPtr {
4682 result: Box::into_raw(Box::new(o)),
4688 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
4689 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
4690 CResult_TxOutAccessErrorZ {
4691 contents: CResult_TxOutAccessErrorZPtr {
4692 err: Box::into_raw(Box::new(e)),
4698 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
4699 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
4700 impl Drop for CResult_TxOutAccessErrorZ {
4701 fn drop(&mut self) {
4703 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4704 let _ = unsafe { Box::from_raw(self.contents.result) };
4707 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4708 let _ = unsafe { Box::from_raw(self.contents.err) };
4713 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
4714 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
4715 let contents = if o.result_ok {
4716 let result = unsafe { o.contents.result };
4717 unsafe { o.contents.result = std::ptr::null_mut() };
4718 CResult_TxOutAccessErrorZPtr { result }
4720 let err = unsafe { o.contents.err };
4721 unsafe { o.contents.err = std::ptr::null_mut(); }
4722 CResult_TxOutAccessErrorZPtr { err }
4726 result_ok: o.result_ok,
4730 impl Clone for CResult_TxOutAccessErrorZ {
4731 fn clone(&self) -> Self {
4733 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
4734 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
4737 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
4738 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
4744 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
4745 /// but with all dynamically-allocated buffers duplicated in new buffers.
4746 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
4748 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4749 pub enum COption_C2Tuple_usizeTransactionZZ {
4750 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4751 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4752 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4755 impl COption_C2Tuple_usizeTransactionZZ {
4756 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4757 if let Self::Some(_) = self { true } else { false }
4759 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4760 if let Self::Some(v) = self { v } else { unreachable!() }
4764 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4765 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4766 COption_C2Tuple_usizeTransactionZZ::Some(o)
4769 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4770 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4771 COption_C2Tuple_usizeTransactionZZ::None
4774 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4775 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4777 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4778 /// This corresponds to std::vector in C++
4779 pub struct CVec_SpendableOutputDescriptorZ {
4780 /// The elements in the array.
4781 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4782 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4783 /// The number of elements pointed to by `data`.
4786 impl CVec_SpendableOutputDescriptorZ {
4787 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
4788 if self.datalen == 0 { return Vec::new(); }
4789 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4790 self.data = std::ptr::null_mut();
4794 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
4795 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4798 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
4799 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
4800 let datalen = v.len();
4801 let data = Box::into_raw(v.into_boxed_slice());
4802 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4806 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4807 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
4808 impl Drop for CVec_SpendableOutputDescriptorZ {
4809 fn drop(&mut self) {
4810 if self.datalen == 0 { return; }
4811 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4814 impl Clone for CVec_SpendableOutputDescriptorZ {
4815 fn clone(&self) -> Self {
4816 let mut res = Vec::new();
4817 if self.datalen == 0 { return Self::from(res); }
4818 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4823 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4824 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
4825 /// A pointer to the contents in the success state.
4826 /// Reading from this pointer when `result_ok` is not set is undefined.
4827 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
4828 /// A pointer to the contents in the error state.
4829 /// Reading from this pointer when `result_ok` is set is undefined.
4830 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4833 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4834 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4835 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4836 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
4837 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4838 /// `err` or `result` depending on the state of `result_ok`.
4839 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
4840 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4841 pub result_ok: bool,
4844 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
4845 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4846 CResult_DirectionalChannelInfoDecodeErrorZ {
4847 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4848 result: Box::into_raw(Box::new(o)),
4854 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
4855 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4856 CResult_DirectionalChannelInfoDecodeErrorZ {
4857 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4858 err: Box::into_raw(Box::new(e)),
4864 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
4865 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
4866 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
4867 fn drop(&mut self) {
4869 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4870 let _ = unsafe { Box::from_raw(self.contents.result) };
4873 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4874 let _ = unsafe { Box::from_raw(self.contents.err) };
4879 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
4880 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4881 let contents = if o.result_ok {
4882 let result = unsafe { o.contents.result };
4883 unsafe { o.contents.result = std::ptr::null_mut() };
4884 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
4886 let err = unsafe { o.contents.err };
4887 unsafe { o.contents.err = std::ptr::null_mut(); }
4888 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
4892 result_ok: o.result_ok,
4896 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
4897 fn clone(&self) -> Self {
4899 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4900 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
4903 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4904 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4910 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
4911 /// but with all dynamically-allocated buffers duplicated in new buffers.
4912 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
4914 /// The contents of CResult_ChannelInfoDecodeErrorZ
4915 pub union CResult_ChannelInfoDecodeErrorZPtr {
4916 /// A pointer to the contents in the success state.
4917 /// Reading from this pointer when `result_ok` is not set is undefined.
4918 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
4919 /// A pointer to the contents in the error state.
4920 /// Reading from this pointer when `result_ok` is set is undefined.
4921 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4924 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4925 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4926 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4927 pub struct CResult_ChannelInfoDecodeErrorZ {
4928 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4929 /// `err` or `result` depending on the state of `result_ok`.
4930 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
4931 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4932 pub result_ok: bool,
4935 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
4936 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
4937 CResult_ChannelInfoDecodeErrorZ {
4938 contents: CResult_ChannelInfoDecodeErrorZPtr {
4939 result: Box::into_raw(Box::new(o)),
4945 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
4946 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
4947 CResult_ChannelInfoDecodeErrorZ {
4948 contents: CResult_ChannelInfoDecodeErrorZPtr {
4949 err: Box::into_raw(Box::new(e)),
4955 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
4956 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
4957 impl Drop for CResult_ChannelInfoDecodeErrorZ {
4958 fn drop(&mut self) {
4960 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4961 let _ = unsafe { Box::from_raw(self.contents.result) };
4964 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4965 let _ = unsafe { Box::from_raw(self.contents.err) };
4970 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
4971 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4972 let contents = if o.result_ok {
4973 let result = unsafe { o.contents.result };
4974 unsafe { o.contents.result = std::ptr::null_mut() };
4975 CResult_ChannelInfoDecodeErrorZPtr { result }
4977 let err = unsafe { o.contents.err };
4978 unsafe { o.contents.err = std::ptr::null_mut(); }
4979 CResult_ChannelInfoDecodeErrorZPtr { err }
4983 result_ok: o.result_ok,
4987 impl Clone for CResult_ChannelInfoDecodeErrorZ {
4988 fn clone(&self) -> Self {
4990 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
4991 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
4994 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
4995 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5001 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5002 /// but with all dynamically-allocated buffers duplicated in new buffers.
5003 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
5005 /// The contents of CResult_RoutingFeesDecodeErrorZ
5006 pub union CResult_RoutingFeesDecodeErrorZPtr {
5007 /// A pointer to the contents in the success state.
5008 /// Reading from this pointer when `result_ok` is not set is undefined.
5009 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
5010 /// A pointer to the contents in the error state.
5011 /// Reading from this pointer when `result_ok` is set is undefined.
5012 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5015 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5016 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5017 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5018 pub struct CResult_RoutingFeesDecodeErrorZ {
5019 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5020 /// `err` or `result` depending on the state of `result_ok`.
5021 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5022 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5023 pub result_ok: bool,
5026 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5027 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5028 CResult_RoutingFeesDecodeErrorZ {
5029 contents: CResult_RoutingFeesDecodeErrorZPtr {
5030 result: Box::into_raw(Box::new(o)),
5036 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5037 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5038 CResult_RoutingFeesDecodeErrorZ {
5039 contents: CResult_RoutingFeesDecodeErrorZPtr {
5040 err: Box::into_raw(Box::new(e)),
5046 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5047 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5048 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5049 fn drop(&mut self) {
5051 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5052 let _ = unsafe { Box::from_raw(self.contents.result) };
5055 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5056 let _ = unsafe { Box::from_raw(self.contents.err) };
5061 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5062 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5063 let contents = if o.result_ok {
5064 let result = unsafe { o.contents.result };
5065 unsafe { o.contents.result = std::ptr::null_mut() };
5066 CResult_RoutingFeesDecodeErrorZPtr { result }
5068 let err = unsafe { o.contents.err };
5069 unsafe { o.contents.err = std::ptr::null_mut(); }
5070 CResult_RoutingFeesDecodeErrorZPtr { err }
5074 result_ok: o.result_ok,
5078 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5079 fn clone(&self) -> Self {
5081 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5082 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
5085 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5086 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5092 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5093 /// but with all dynamically-allocated buffers duplicated in new buffers.
5094 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
5096 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5097 /// This corresponds to std::vector in C++
5098 pub struct CVec_NetAddressZ {
5099 /// The elements in the array.
5100 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5101 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5102 /// The number of elements pointed to by `data`.
5105 impl CVec_NetAddressZ {
5106 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5107 if self.datalen == 0 { return Vec::new(); }
5108 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5109 self.data = std::ptr::null_mut();
5113 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5114 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5117 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5118 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5119 let datalen = v.len();
5120 let data = Box::into_raw(v.into_boxed_slice());
5121 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5125 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5126 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5127 impl Drop for CVec_NetAddressZ {
5128 fn drop(&mut self) {
5129 if self.datalen == 0 { return; }
5130 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5133 impl Clone for CVec_NetAddressZ {
5134 fn clone(&self) -> Self {
5135 let mut res = Vec::new();
5136 if self.datalen == 0 { return Self::from(res); }
5137 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5142 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5143 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5144 /// A pointer to the contents in the success state.
5145 /// Reading from this pointer when `result_ok` is not set is undefined.
5146 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
5147 /// A pointer to the contents in the error state.
5148 /// Reading from this pointer when `result_ok` is set is undefined.
5149 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5152 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5153 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5154 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5155 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5156 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5157 /// `err` or `result` depending on the state of `result_ok`.
5158 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5159 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5160 pub result_ok: bool,
5163 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5164 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5165 CResult_NodeAnnouncementInfoDecodeErrorZ {
5166 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5167 result: Box::into_raw(Box::new(o)),
5173 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5174 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5175 CResult_NodeAnnouncementInfoDecodeErrorZ {
5176 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5177 err: Box::into_raw(Box::new(e)),
5183 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5184 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5185 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5186 fn drop(&mut self) {
5188 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5189 let _ = unsafe { Box::from_raw(self.contents.result) };
5192 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5193 let _ = unsafe { Box::from_raw(self.contents.err) };
5198 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5199 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5200 let contents = if o.result_ok {
5201 let result = unsafe { o.contents.result };
5202 unsafe { o.contents.result = std::ptr::null_mut() };
5203 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5205 let err = unsafe { o.contents.err };
5206 unsafe { o.contents.err = std::ptr::null_mut(); }
5207 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5211 result_ok: o.result_ok,
5215 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5216 fn clone(&self) -> Self {
5218 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5219 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5222 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5223 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5229 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5230 /// but with all dynamically-allocated buffers duplicated in new buffers.
5231 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
5233 /// A dynamically-allocated array of u64s of arbitrary size.
5234 /// This corresponds to std::vector in C++
5235 pub struct CVec_u64Z {
5236 /// The elements in the array.
5237 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5239 /// The number of elements pointed to by `data`.
5243 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5244 if self.datalen == 0 { return Vec::new(); }
5245 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5246 self.data = std::ptr::null_mut();
5250 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5251 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5254 impl From<Vec<u64>> for CVec_u64Z {
5255 fn from(v: Vec<u64>) -> Self {
5256 let datalen = v.len();
5257 let data = Box::into_raw(v.into_boxed_slice());
5258 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5262 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5263 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5264 impl Drop for CVec_u64Z {
5265 fn drop(&mut self) {
5266 if self.datalen == 0 { return; }
5267 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5270 impl Clone for CVec_u64Z {
5271 fn clone(&self) -> Self {
5272 let mut res = Vec::new();
5273 if self.datalen == 0 { return Self::from(res); }
5274 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5279 /// The contents of CResult_NodeInfoDecodeErrorZ
5280 pub union CResult_NodeInfoDecodeErrorZPtr {
5281 /// A pointer to the contents in the success state.
5282 /// Reading from this pointer when `result_ok` is not set is undefined.
5283 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
5284 /// A pointer to the contents in the error state.
5285 /// Reading from this pointer when `result_ok` is set is undefined.
5286 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5289 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5290 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5291 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5292 pub struct CResult_NodeInfoDecodeErrorZ {
5293 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5294 /// `err` or `result` depending on the state of `result_ok`.
5295 pub contents: CResult_NodeInfoDecodeErrorZPtr,
5296 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5297 pub result_ok: bool,
5300 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5301 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5302 CResult_NodeInfoDecodeErrorZ {
5303 contents: CResult_NodeInfoDecodeErrorZPtr {
5304 result: Box::into_raw(Box::new(o)),
5310 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5311 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5312 CResult_NodeInfoDecodeErrorZ {
5313 contents: CResult_NodeInfoDecodeErrorZPtr {
5314 err: Box::into_raw(Box::new(e)),
5320 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5321 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5322 impl Drop for CResult_NodeInfoDecodeErrorZ {
5323 fn drop(&mut self) {
5325 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5326 let _ = unsafe { Box::from_raw(self.contents.result) };
5329 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5330 let _ = unsafe { Box::from_raw(self.contents.err) };
5335 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5336 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5337 let contents = if o.result_ok {
5338 let result = unsafe { o.contents.result };
5339 unsafe { o.contents.result = std::ptr::null_mut() };
5340 CResult_NodeInfoDecodeErrorZPtr { result }
5342 let err = unsafe { o.contents.err };
5343 unsafe { o.contents.err = std::ptr::null_mut(); }
5344 CResult_NodeInfoDecodeErrorZPtr { err }
5348 result_ok: o.result_ok,
5352 impl Clone for CResult_NodeInfoDecodeErrorZ {
5353 fn clone(&self) -> Self {
5355 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5356 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
5359 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5360 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5366 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5367 /// but with all dynamically-allocated buffers duplicated in new buffers.
5368 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
5370 /// The contents of CResult_NetworkGraphDecodeErrorZ
5371 pub union CResult_NetworkGraphDecodeErrorZPtr {
5372 /// A pointer to the contents in the success state.
5373 /// Reading from this pointer when `result_ok` is not set is undefined.
5374 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
5375 /// A pointer to the contents in the error state.
5376 /// Reading from this pointer when `result_ok` is set is undefined.
5377 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5380 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5381 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5383 pub struct CResult_NetworkGraphDecodeErrorZ {
5384 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5385 /// `err` or `result` depending on the state of `result_ok`.
5386 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5387 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5388 pub result_ok: bool,
5391 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5392 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5393 CResult_NetworkGraphDecodeErrorZ {
5394 contents: CResult_NetworkGraphDecodeErrorZPtr {
5395 result: Box::into_raw(Box::new(o)),
5401 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5402 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5403 CResult_NetworkGraphDecodeErrorZ {
5404 contents: CResult_NetworkGraphDecodeErrorZPtr {
5405 err: Box::into_raw(Box::new(e)),
5411 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5412 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5413 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5414 fn drop(&mut self) {
5416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5417 let _ = unsafe { Box::from_raw(self.contents.result) };
5420 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5421 let _ = unsafe { Box::from_raw(self.contents.err) };
5426 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5427 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5428 let contents = if o.result_ok {
5429 let result = unsafe { o.contents.result };
5430 unsafe { o.contents.result = std::ptr::null_mut() };
5431 CResult_NetworkGraphDecodeErrorZPtr { result }
5433 let err = unsafe { o.contents.err };
5434 unsafe { o.contents.err = std::ptr::null_mut(); }
5435 CResult_NetworkGraphDecodeErrorZPtr { err }
5439 result_ok: o.result_ok,
5443 impl Clone for CResult_NetworkGraphDecodeErrorZ {
5444 fn clone(&self) -> Self {
5446 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
5447 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
5450 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
5451 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5457 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
5458 /// but with all dynamically-allocated buffers duplicated in new buffers.
5459 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
5461 /// The contents of CResult_InitFeaturesDecodeErrorZ
5462 pub union CResult_InitFeaturesDecodeErrorZPtr {
5463 /// A pointer to the contents in the success state.
5464 /// Reading from this pointer when `result_ok` is not set is undefined.
5465 pub result: *mut crate::lightning::ln::features::InitFeatures,
5466 /// A pointer to the contents in the error state.
5467 /// Reading from this pointer when `result_ok` is set is undefined.
5468 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5471 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5472 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5474 pub struct CResult_InitFeaturesDecodeErrorZ {
5475 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5476 /// `err` or `result` depending on the state of `result_ok`.
5477 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5478 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5479 pub result_ok: bool,
5482 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5483 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5484 CResult_InitFeaturesDecodeErrorZ {
5485 contents: CResult_InitFeaturesDecodeErrorZPtr {
5486 result: Box::into_raw(Box::new(o)),
5492 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5493 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5494 CResult_InitFeaturesDecodeErrorZ {
5495 contents: CResult_InitFeaturesDecodeErrorZPtr {
5496 err: Box::into_raw(Box::new(e)),
5502 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5503 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5504 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5505 fn drop(&mut self) {
5507 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5508 let _ = unsafe { Box::from_raw(self.contents.result) };
5511 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5512 let _ = unsafe { Box::from_raw(self.contents.err) };
5517 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5518 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5519 let contents = if o.result_ok {
5520 let result = unsafe { o.contents.result };
5521 unsafe { o.contents.result = std::ptr::null_mut() };
5522 CResult_InitFeaturesDecodeErrorZPtr { result }
5524 let err = unsafe { o.contents.err };
5525 unsafe { o.contents.err = std::ptr::null_mut(); }
5526 CResult_InitFeaturesDecodeErrorZPtr { err }
5530 result_ok: o.result_ok,
5535 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5536 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5537 /// A pointer to the contents in the success state.
5538 /// Reading from this pointer when `result_ok` is not set is undefined.
5539 pub result: *mut crate::lightning::ln::features::NodeFeatures,
5540 /// A pointer to the contents in the error state.
5541 /// Reading from this pointer when `result_ok` is set is undefined.
5542 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5545 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5546 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5548 pub struct CResult_NodeFeaturesDecodeErrorZ {
5549 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5550 /// `err` or `result` depending on the state of `result_ok`.
5551 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5552 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5553 pub result_ok: bool,
5556 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5557 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5558 CResult_NodeFeaturesDecodeErrorZ {
5559 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5560 result: Box::into_raw(Box::new(o)),
5566 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5567 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5568 CResult_NodeFeaturesDecodeErrorZ {
5569 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5570 err: Box::into_raw(Box::new(e)),
5576 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5577 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5578 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5579 fn drop(&mut self) {
5581 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5582 let _ = unsafe { Box::from_raw(self.contents.result) };
5585 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5586 let _ = unsafe { Box::from_raw(self.contents.err) };
5591 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5592 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5593 let contents = if o.result_ok {
5594 let result = unsafe { o.contents.result };
5595 unsafe { o.contents.result = std::ptr::null_mut() };
5596 CResult_NodeFeaturesDecodeErrorZPtr { result }
5598 let err = unsafe { o.contents.err };
5599 unsafe { o.contents.err = std::ptr::null_mut(); }
5600 CResult_NodeFeaturesDecodeErrorZPtr { err }
5604 result_ok: o.result_ok,
5609 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5610 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5611 /// A pointer to the contents in the success state.
5612 /// Reading from this pointer when `result_ok` is not set is undefined.
5613 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5614 /// A pointer to the contents in the error state.
5615 /// Reading from this pointer when `result_ok` is set is undefined.
5616 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5619 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5620 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5622 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5623 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5624 /// `err` or `result` depending on the state of `result_ok`.
5625 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5626 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5627 pub result_ok: bool,
5630 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5631 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5632 CResult_ChannelFeaturesDecodeErrorZ {
5633 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5634 result: Box::into_raw(Box::new(o)),
5640 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5641 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5642 CResult_ChannelFeaturesDecodeErrorZ {
5643 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5644 err: Box::into_raw(Box::new(e)),
5650 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5651 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5652 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5653 fn drop(&mut self) {
5655 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5656 let _ = unsafe { Box::from_raw(self.contents.result) };
5659 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5660 let _ = unsafe { Box::from_raw(self.contents.err) };
5665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5666 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5667 let contents = if o.result_ok {
5668 let result = unsafe { o.contents.result };
5669 unsafe { o.contents.result = std::ptr::null_mut() };
5670 CResult_ChannelFeaturesDecodeErrorZPtr { result }
5672 let err = unsafe { o.contents.err };
5673 unsafe { o.contents.err = std::ptr::null_mut(); }
5674 CResult_ChannelFeaturesDecodeErrorZPtr { err }
5678 result_ok: o.result_ok,
5683 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
5684 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
5685 /// A pointer to the contents in the success state.
5686 /// Reading from this pointer when `result_ok` is not set is undefined.
5687 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
5688 /// A pointer to the contents in the error state.
5689 /// Reading from this pointer when `result_ok` is set is undefined.
5690 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5693 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5694 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5696 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
5697 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5698 /// `err` or `result` depending on the state of `result_ok`.
5699 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
5700 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5701 pub result_ok: bool,
5704 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
5705 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
5706 CResult_InvoiceFeaturesDecodeErrorZ {
5707 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5708 result: Box::into_raw(Box::new(o)),
5714 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
5715 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
5716 CResult_InvoiceFeaturesDecodeErrorZ {
5717 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5718 err: Box::into_raw(Box::new(e)),
5724 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
5725 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
5726 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
5727 fn drop(&mut self) {
5729 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5730 let _ = unsafe { Box::from_raw(self.contents.result) };
5733 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5734 let _ = unsafe { Box::from_raw(self.contents.err) };
5739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
5740 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5741 let contents = if o.result_ok {
5742 let result = unsafe { o.contents.result };
5743 unsafe { o.contents.result = std::ptr::null_mut() };
5744 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
5746 let err = unsafe { o.contents.err };
5747 unsafe { o.contents.err = std::ptr::null_mut(); }
5748 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
5752 result_ok: o.result_ok,
5757 /// The contents of CResult_NetAddressu8Z
5758 pub union CResult_NetAddressu8ZPtr {
5759 /// A pointer to the contents in the success state.
5760 /// Reading from this pointer when `result_ok` is not set is undefined.
5761 pub result: *mut crate::lightning::ln::msgs::NetAddress,
5762 /// A pointer to the contents in the error state.
5763 /// Reading from this pointer when `result_ok` is set is undefined.
5767 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
5768 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5769 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5770 pub struct CResult_NetAddressu8Z {
5771 /// The contents of this CResult_NetAddressu8Z, accessible via either
5772 /// `err` or `result` depending on the state of `result_ok`.
5773 pub contents: CResult_NetAddressu8ZPtr,
5774 /// Whether this CResult_NetAddressu8Z represents a success state.
5775 pub result_ok: bool,
5778 /// Creates a new CResult_NetAddressu8Z in the success state.
5779 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
5780 CResult_NetAddressu8Z {
5781 contents: CResult_NetAddressu8ZPtr {
5782 result: Box::into_raw(Box::new(o)),
5788 /// Creates a new CResult_NetAddressu8Z in the error state.
5789 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
5790 CResult_NetAddressu8Z {
5791 contents: CResult_NetAddressu8ZPtr {
5792 err: Box::into_raw(Box::new(e)),
5798 /// Frees any resources used by the CResult_NetAddressu8Z.
5799 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
5800 impl Drop for CResult_NetAddressu8Z {
5801 fn drop(&mut self) {
5803 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5804 let _ = unsafe { Box::from_raw(self.contents.result) };
5807 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5808 let _ = unsafe { Box::from_raw(self.contents.err) };
5813 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
5814 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
5815 let contents = if o.result_ok {
5816 let result = unsafe { o.contents.result };
5817 unsafe { o.contents.result = std::ptr::null_mut() };
5818 CResult_NetAddressu8ZPtr { result }
5820 let err = unsafe { o.contents.err };
5821 unsafe { o.contents.err = std::ptr::null_mut(); }
5822 CResult_NetAddressu8ZPtr { err }
5826 result_ok: o.result_ok,
5830 impl Clone for CResult_NetAddressu8Z {
5831 fn clone(&self) -> Self {
5833 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
5834 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
5837 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
5838 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
5844 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
5845 /// but with all dynamically-allocated buffers duplicated in new buffers.
5846 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
5848 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5849 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5850 /// A pointer to the contents in the success state.
5851 /// Reading from this pointer when `result_ok` is not set is undefined.
5852 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
5853 /// A pointer to the contents in the error state.
5854 /// Reading from this pointer when `result_ok` is set is undefined.
5855 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5858 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5859 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5861 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
5862 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5863 /// `err` or `result` depending on the state of `result_ok`.
5864 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
5865 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5866 pub result_ok: bool,
5869 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
5870 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5871 CResult_CResult_NetAddressu8ZDecodeErrorZ {
5872 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5873 result: Box::into_raw(Box::new(o)),
5879 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
5880 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5881 CResult_CResult_NetAddressu8ZDecodeErrorZ {
5882 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5883 err: Box::into_raw(Box::new(e)),
5889 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
5890 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
5891 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5892 fn drop(&mut self) {
5894 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5895 let _ = unsafe { Box::from_raw(self.contents.result) };
5898 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5899 let _ = unsafe { Box::from_raw(self.contents.err) };
5904 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5905 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
5906 let contents = if o.result_ok {
5907 let result = unsafe { o.contents.result };
5908 unsafe { o.contents.result = std::ptr::null_mut() };
5909 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
5911 let err = unsafe { o.contents.err };
5912 unsafe { o.contents.err = std::ptr::null_mut(); }
5913 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
5917 result_ok: o.result_ok,
5921 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5922 fn clone(&self) -> Self {
5924 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5925 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
5928 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5929 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5935 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
5936 /// but with all dynamically-allocated buffers duplicated in new buffers.
5937 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
5939 /// The contents of CResult_NetAddressDecodeErrorZ
5940 pub union CResult_NetAddressDecodeErrorZPtr {
5941 /// A pointer to the contents in the success state.
5942 /// Reading from this pointer when `result_ok` is not set is undefined.
5943 pub result: *mut crate::lightning::ln::msgs::NetAddress,
5944 /// A pointer to the contents in the error state.
5945 /// Reading from this pointer when `result_ok` is set is undefined.
5946 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5949 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
5950 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
5951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5952 pub struct CResult_NetAddressDecodeErrorZ {
5953 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
5954 /// `err` or `result` depending on the state of `result_ok`.
5955 pub contents: CResult_NetAddressDecodeErrorZPtr,
5956 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
5957 pub result_ok: bool,
5960 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
5961 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
5962 CResult_NetAddressDecodeErrorZ {
5963 contents: CResult_NetAddressDecodeErrorZPtr {
5964 result: Box::into_raw(Box::new(o)),
5970 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
5971 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
5972 CResult_NetAddressDecodeErrorZ {
5973 contents: CResult_NetAddressDecodeErrorZPtr {
5974 err: Box::into_raw(Box::new(e)),
5980 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
5981 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
5982 impl Drop for CResult_NetAddressDecodeErrorZ {
5983 fn drop(&mut self) {
5985 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5986 let _ = unsafe { Box::from_raw(self.contents.result) };
5989 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5990 let _ = unsafe { Box::from_raw(self.contents.err) };
5995 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
5996 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
5997 let contents = if o.result_ok {
5998 let result = unsafe { o.contents.result };
5999 unsafe { o.contents.result = std::ptr::null_mut() };
6000 CResult_NetAddressDecodeErrorZPtr { result }
6002 let err = unsafe { o.contents.err };
6003 unsafe { o.contents.err = std::ptr::null_mut(); }
6004 CResult_NetAddressDecodeErrorZPtr { err }
6008 result_ok: o.result_ok,
6012 impl Clone for CResult_NetAddressDecodeErrorZ {
6013 fn clone(&self) -> Self {
6015 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
6016 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
6019 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
6020 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6026 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
6027 /// but with all dynamically-allocated buffers duplicated in new buffers.
6028 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
6030 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
6031 /// This corresponds to std::vector in C++
6032 pub struct CVec_UpdateAddHTLCZ {
6033 /// The elements in the array.
6034 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6035 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
6036 /// The number of elements pointed to by `data`.
6039 impl CVec_UpdateAddHTLCZ {
6040 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
6041 if self.datalen == 0 { return Vec::new(); }
6042 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6043 self.data = std::ptr::null_mut();
6047 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
6048 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6051 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
6052 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
6053 let datalen = v.len();
6054 let data = Box::into_raw(v.into_boxed_slice());
6055 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6059 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6060 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
6061 impl Drop for CVec_UpdateAddHTLCZ {
6062 fn drop(&mut self) {
6063 if self.datalen == 0 { return; }
6064 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6067 impl Clone for CVec_UpdateAddHTLCZ {
6068 fn clone(&self) -> Self {
6069 let mut res = Vec::new();
6070 if self.datalen == 0 { return Self::from(res); }
6071 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6076 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
6077 /// This corresponds to std::vector in C++
6078 pub struct CVec_UpdateFulfillHTLCZ {
6079 /// The elements in the array.
6080 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6081 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
6082 /// The number of elements pointed to by `data`.
6085 impl CVec_UpdateFulfillHTLCZ {
6086 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
6087 if self.datalen == 0 { return Vec::new(); }
6088 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6089 self.data = std::ptr::null_mut();
6093 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
6094 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6097 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
6098 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
6099 let datalen = v.len();
6100 let data = Box::into_raw(v.into_boxed_slice());
6101 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6105 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6106 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
6107 impl Drop for CVec_UpdateFulfillHTLCZ {
6108 fn drop(&mut self) {
6109 if self.datalen == 0 { return; }
6110 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6113 impl Clone for CVec_UpdateFulfillHTLCZ {
6114 fn clone(&self) -> Self {
6115 let mut res = Vec::new();
6116 if self.datalen == 0 { return Self::from(res); }
6117 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6122 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
6123 /// This corresponds to std::vector in C++
6124 pub struct CVec_UpdateFailHTLCZ {
6125 /// The elements in the array.
6126 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6127 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
6128 /// The number of elements pointed to by `data`.
6131 impl CVec_UpdateFailHTLCZ {
6132 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
6133 if self.datalen == 0 { return Vec::new(); }
6134 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6135 self.data = std::ptr::null_mut();
6139 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
6140 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6143 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
6144 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
6145 let datalen = v.len();
6146 let data = Box::into_raw(v.into_boxed_slice());
6147 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6151 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6152 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
6153 impl Drop for CVec_UpdateFailHTLCZ {
6154 fn drop(&mut self) {
6155 if self.datalen == 0 { return; }
6156 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6159 impl Clone for CVec_UpdateFailHTLCZ {
6160 fn clone(&self) -> Self {
6161 let mut res = Vec::new();
6162 if self.datalen == 0 { return Self::from(res); }
6163 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6168 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6169 /// This corresponds to std::vector in C++
6170 pub struct CVec_UpdateFailMalformedHTLCZ {
6171 /// The elements in the array.
6172 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6173 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
6174 /// The number of elements pointed to by `data`.
6177 impl CVec_UpdateFailMalformedHTLCZ {
6178 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
6179 if self.datalen == 0 { return Vec::new(); }
6180 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6181 self.data = std::ptr::null_mut();
6185 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
6186 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6189 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
6190 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
6191 let datalen = v.len();
6192 let data = Box::into_raw(v.into_boxed_slice());
6193 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6197 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6198 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
6199 impl Drop for CVec_UpdateFailMalformedHTLCZ {
6200 fn drop(&mut self) {
6201 if self.datalen == 0 { return; }
6202 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6205 impl Clone for CVec_UpdateFailMalformedHTLCZ {
6206 fn clone(&self) -> Self {
6207 let mut res = Vec::new();
6208 if self.datalen == 0 { return Self::from(res); }
6209 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6214 /// The contents of CResult_AcceptChannelDecodeErrorZ
6215 pub union CResult_AcceptChannelDecodeErrorZPtr {
6216 /// A pointer to the contents in the success state.
6217 /// Reading from this pointer when `result_ok` is not set is undefined.
6218 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
6219 /// A pointer to the contents in the error state.
6220 /// Reading from this pointer when `result_ok` is set is undefined.
6221 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6224 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6225 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6227 pub struct CResult_AcceptChannelDecodeErrorZ {
6228 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6229 /// `err` or `result` depending on the state of `result_ok`.
6230 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
6231 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6232 pub result_ok: bool,
6235 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
6236 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
6237 CResult_AcceptChannelDecodeErrorZ {
6238 contents: CResult_AcceptChannelDecodeErrorZPtr {
6239 result: Box::into_raw(Box::new(o)),
6245 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
6246 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
6247 CResult_AcceptChannelDecodeErrorZ {
6248 contents: CResult_AcceptChannelDecodeErrorZPtr {
6249 err: Box::into_raw(Box::new(e)),
6255 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
6256 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
6257 impl Drop for CResult_AcceptChannelDecodeErrorZ {
6258 fn drop(&mut self) {
6260 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6261 let _ = unsafe { Box::from_raw(self.contents.result) };
6264 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6265 let _ = unsafe { Box::from_raw(self.contents.err) };
6270 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
6271 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
6272 let contents = if o.result_ok {
6273 let result = unsafe { o.contents.result };
6274 unsafe { o.contents.result = std::ptr::null_mut() };
6275 CResult_AcceptChannelDecodeErrorZPtr { result }
6277 let err = unsafe { o.contents.err };
6278 unsafe { o.contents.err = std::ptr::null_mut(); }
6279 CResult_AcceptChannelDecodeErrorZPtr { err }
6283 result_ok: o.result_ok,
6287 impl Clone for CResult_AcceptChannelDecodeErrorZ {
6288 fn clone(&self) -> Self {
6290 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
6291 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
6294 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
6295 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6301 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
6302 /// but with all dynamically-allocated buffers duplicated in new buffers.
6303 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
6305 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6306 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
6307 /// A pointer to the contents in the success state.
6308 /// Reading from this pointer when `result_ok` is not set is undefined.
6309 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
6310 /// A pointer to the contents in the error state.
6311 /// Reading from this pointer when `result_ok` is set is undefined.
6312 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6315 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6316 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6318 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
6319 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6320 /// `err` or `result` depending on the state of `result_ok`.
6321 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
6322 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6323 pub result_ok: bool,
6326 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
6327 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6328 CResult_AnnouncementSignaturesDecodeErrorZ {
6329 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6330 result: Box::into_raw(Box::new(o)),
6336 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
6337 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6338 CResult_AnnouncementSignaturesDecodeErrorZ {
6339 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6340 err: Box::into_raw(Box::new(e)),
6346 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
6347 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
6348 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
6349 fn drop(&mut self) {
6351 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6352 let _ = unsafe { Box::from_raw(self.contents.result) };
6355 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6356 let _ = unsafe { Box::from_raw(self.contents.err) };
6361 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
6362 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6363 let contents = if o.result_ok {
6364 let result = unsafe { o.contents.result };
6365 unsafe { o.contents.result = std::ptr::null_mut() };
6366 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
6368 let err = unsafe { o.contents.err };
6369 unsafe { o.contents.err = std::ptr::null_mut(); }
6370 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
6374 result_ok: o.result_ok,
6378 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
6379 fn clone(&self) -> Self {
6381 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6382 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
6385 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6386 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6392 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
6393 /// but with all dynamically-allocated buffers duplicated in new buffers.
6394 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
6396 /// The contents of CResult_ChannelReestablishDecodeErrorZ
6397 pub union CResult_ChannelReestablishDecodeErrorZPtr {
6398 /// A pointer to the contents in the success state.
6399 /// Reading from this pointer when `result_ok` is not set is undefined.
6400 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
6401 /// A pointer to the contents in the error state.
6402 /// Reading from this pointer when `result_ok` is set is undefined.
6403 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6406 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6407 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
6408 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6409 pub struct CResult_ChannelReestablishDecodeErrorZ {
6410 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6411 /// `err` or `result` depending on the state of `result_ok`.
6412 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
6413 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6414 pub result_ok: bool,
6417 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
6418 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
6419 CResult_ChannelReestablishDecodeErrorZ {
6420 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6421 result: Box::into_raw(Box::new(o)),
6427 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
6428 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
6429 CResult_ChannelReestablishDecodeErrorZ {
6430 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6431 err: Box::into_raw(Box::new(e)),
6437 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
6438 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
6439 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
6440 fn drop(&mut self) {
6442 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6443 let _ = unsafe { Box::from_raw(self.contents.result) };
6446 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6447 let _ = unsafe { Box::from_raw(self.contents.err) };
6452 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
6453 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
6454 let contents = if o.result_ok {
6455 let result = unsafe { o.contents.result };
6456 unsafe { o.contents.result = std::ptr::null_mut() };
6457 CResult_ChannelReestablishDecodeErrorZPtr { result }
6459 let err = unsafe { o.contents.err };
6460 unsafe { o.contents.err = std::ptr::null_mut(); }
6461 CResult_ChannelReestablishDecodeErrorZPtr { err }
6465 result_ok: o.result_ok,
6469 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
6470 fn clone(&self) -> Self {
6472 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6473 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
6476 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6477 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6483 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
6484 /// but with all dynamically-allocated buffers duplicated in new buffers.
6485 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
6487 /// The contents of CResult_ClosingSignedDecodeErrorZ
6488 pub union CResult_ClosingSignedDecodeErrorZPtr {
6489 /// A pointer to the contents in the success state.
6490 /// Reading from this pointer when `result_ok` is not set is undefined.
6491 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
6492 /// A pointer to the contents in the error state.
6493 /// Reading from this pointer when `result_ok` is set is undefined.
6494 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6497 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6498 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6500 pub struct CResult_ClosingSignedDecodeErrorZ {
6501 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6502 /// `err` or `result` depending on the state of `result_ok`.
6503 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
6504 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6505 pub result_ok: bool,
6508 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
6509 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
6510 CResult_ClosingSignedDecodeErrorZ {
6511 contents: CResult_ClosingSignedDecodeErrorZPtr {
6512 result: Box::into_raw(Box::new(o)),
6518 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
6519 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
6520 CResult_ClosingSignedDecodeErrorZ {
6521 contents: CResult_ClosingSignedDecodeErrorZPtr {
6522 err: Box::into_raw(Box::new(e)),
6528 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
6529 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
6530 impl Drop for CResult_ClosingSignedDecodeErrorZ {
6531 fn drop(&mut self) {
6533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6534 let _ = unsafe { Box::from_raw(self.contents.result) };
6537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6538 let _ = unsafe { Box::from_raw(self.contents.err) };
6543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
6544 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6545 let contents = if o.result_ok {
6546 let result = unsafe { o.contents.result };
6547 unsafe { o.contents.result = std::ptr::null_mut() };
6548 CResult_ClosingSignedDecodeErrorZPtr { result }
6550 let err = unsafe { o.contents.err };
6551 unsafe { o.contents.err = std::ptr::null_mut(); }
6552 CResult_ClosingSignedDecodeErrorZPtr { err }
6556 result_ok: o.result_ok,
6560 impl Clone for CResult_ClosingSignedDecodeErrorZ {
6561 fn clone(&self) -> Self {
6563 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
6564 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
6567 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
6568 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6574 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
6575 /// but with all dynamically-allocated buffers duplicated in new buffers.
6576 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
6578 /// The contents of CResult_CommitmentSignedDecodeErrorZ
6579 pub union CResult_CommitmentSignedDecodeErrorZPtr {
6580 /// A pointer to the contents in the success state.
6581 /// Reading from this pointer when `result_ok` is not set is undefined.
6582 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
6583 /// A pointer to the contents in the error state.
6584 /// Reading from this pointer when `result_ok` is set is undefined.
6585 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6588 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6589 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6591 pub struct CResult_CommitmentSignedDecodeErrorZ {
6592 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6593 /// `err` or `result` depending on the state of `result_ok`.
6594 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
6595 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6596 pub result_ok: bool,
6599 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
6600 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
6601 CResult_CommitmentSignedDecodeErrorZ {
6602 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6603 result: Box::into_raw(Box::new(o)),
6609 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
6610 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
6611 CResult_CommitmentSignedDecodeErrorZ {
6612 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6613 err: Box::into_raw(Box::new(e)),
6619 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
6620 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
6621 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
6622 fn drop(&mut self) {
6624 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6625 let _ = unsafe { Box::from_raw(self.contents.result) };
6628 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6629 let _ = unsafe { Box::from_raw(self.contents.err) };
6634 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
6635 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6636 let contents = if o.result_ok {
6637 let result = unsafe { o.contents.result };
6638 unsafe { o.contents.result = std::ptr::null_mut() };
6639 CResult_CommitmentSignedDecodeErrorZPtr { result }
6641 let err = unsafe { o.contents.err };
6642 unsafe { o.contents.err = std::ptr::null_mut(); }
6643 CResult_CommitmentSignedDecodeErrorZPtr { err }
6647 result_ok: o.result_ok,
6651 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
6652 fn clone(&self) -> Self {
6654 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6655 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
6658 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6659 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6665 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
6666 /// but with all dynamically-allocated buffers duplicated in new buffers.
6667 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
6669 /// The contents of CResult_FundingCreatedDecodeErrorZ
6670 pub union CResult_FundingCreatedDecodeErrorZPtr {
6671 /// A pointer to the contents in the success state.
6672 /// Reading from this pointer when `result_ok` is not set is undefined.
6673 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
6674 /// A pointer to the contents in the error state.
6675 /// Reading from this pointer when `result_ok` is set is undefined.
6676 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6679 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6680 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
6681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6682 pub struct CResult_FundingCreatedDecodeErrorZ {
6683 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6684 /// `err` or `result` depending on the state of `result_ok`.
6685 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
6686 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6687 pub result_ok: bool,
6690 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
6691 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
6692 CResult_FundingCreatedDecodeErrorZ {
6693 contents: CResult_FundingCreatedDecodeErrorZPtr {
6694 result: Box::into_raw(Box::new(o)),
6700 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
6701 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
6702 CResult_FundingCreatedDecodeErrorZ {
6703 contents: CResult_FundingCreatedDecodeErrorZPtr {
6704 err: Box::into_raw(Box::new(e)),
6710 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
6711 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
6712 impl Drop for CResult_FundingCreatedDecodeErrorZ {
6713 fn drop(&mut self) {
6715 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6716 let _ = unsafe { Box::from_raw(self.contents.result) };
6719 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6720 let _ = unsafe { Box::from_raw(self.contents.err) };
6725 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
6726 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
6727 let contents = if o.result_ok {
6728 let result = unsafe { o.contents.result };
6729 unsafe { o.contents.result = std::ptr::null_mut() };
6730 CResult_FundingCreatedDecodeErrorZPtr { result }
6732 let err = unsafe { o.contents.err };
6733 unsafe { o.contents.err = std::ptr::null_mut(); }
6734 CResult_FundingCreatedDecodeErrorZPtr { err }
6738 result_ok: o.result_ok,
6742 impl Clone for CResult_FundingCreatedDecodeErrorZ {
6743 fn clone(&self) -> Self {
6745 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
6746 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
6749 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
6750 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6756 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
6757 /// but with all dynamically-allocated buffers duplicated in new buffers.
6758 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
6760 /// The contents of CResult_FundingSignedDecodeErrorZ
6761 pub union CResult_FundingSignedDecodeErrorZPtr {
6762 /// A pointer to the contents in the success state.
6763 /// Reading from this pointer when `result_ok` is not set is undefined.
6764 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
6765 /// A pointer to the contents in the error state.
6766 /// Reading from this pointer when `result_ok` is set is undefined.
6767 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6770 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6771 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6773 pub struct CResult_FundingSignedDecodeErrorZ {
6774 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6775 /// `err` or `result` depending on the state of `result_ok`.
6776 pub contents: CResult_FundingSignedDecodeErrorZPtr,
6777 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6778 pub result_ok: bool,
6781 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
6782 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
6783 CResult_FundingSignedDecodeErrorZ {
6784 contents: CResult_FundingSignedDecodeErrorZPtr {
6785 result: Box::into_raw(Box::new(o)),
6791 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
6792 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
6793 CResult_FundingSignedDecodeErrorZ {
6794 contents: CResult_FundingSignedDecodeErrorZPtr {
6795 err: Box::into_raw(Box::new(e)),
6801 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
6802 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
6803 impl Drop for CResult_FundingSignedDecodeErrorZ {
6804 fn drop(&mut self) {
6806 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6807 let _ = unsafe { Box::from_raw(self.contents.result) };
6810 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6811 let _ = unsafe { Box::from_raw(self.contents.err) };
6816 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
6817 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6818 let contents = if o.result_ok {
6819 let result = unsafe { o.contents.result };
6820 unsafe { o.contents.result = std::ptr::null_mut() };
6821 CResult_FundingSignedDecodeErrorZPtr { result }
6823 let err = unsafe { o.contents.err };
6824 unsafe { o.contents.err = std::ptr::null_mut(); }
6825 CResult_FundingSignedDecodeErrorZPtr { err }
6829 result_ok: o.result_ok,
6833 impl Clone for CResult_FundingSignedDecodeErrorZ {
6834 fn clone(&self) -> Self {
6836 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
6837 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
6840 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
6841 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6847 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
6848 /// but with all dynamically-allocated buffers duplicated in new buffers.
6849 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
6851 /// The contents of CResult_FundingLockedDecodeErrorZ
6852 pub union CResult_FundingLockedDecodeErrorZPtr {
6853 /// A pointer to the contents in the success state.
6854 /// Reading from this pointer when `result_ok` is not set is undefined.
6855 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
6856 /// A pointer to the contents in the error state.
6857 /// Reading from this pointer when `result_ok` is set is undefined.
6858 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6861 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6862 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
6863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6864 pub struct CResult_FundingLockedDecodeErrorZ {
6865 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6866 /// `err` or `result` depending on the state of `result_ok`.
6867 pub contents: CResult_FundingLockedDecodeErrorZPtr,
6868 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6869 pub result_ok: bool,
6872 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
6873 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
6874 CResult_FundingLockedDecodeErrorZ {
6875 contents: CResult_FundingLockedDecodeErrorZPtr {
6876 result: Box::into_raw(Box::new(o)),
6882 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
6883 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
6884 CResult_FundingLockedDecodeErrorZ {
6885 contents: CResult_FundingLockedDecodeErrorZPtr {
6886 err: Box::into_raw(Box::new(e)),
6892 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
6893 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
6894 impl Drop for CResult_FundingLockedDecodeErrorZ {
6895 fn drop(&mut self) {
6897 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6898 let _ = unsafe { Box::from_raw(self.contents.result) };
6901 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6902 let _ = unsafe { Box::from_raw(self.contents.err) };
6907 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
6908 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
6909 let contents = if o.result_ok {
6910 let result = unsafe { o.contents.result };
6911 unsafe { o.contents.result = std::ptr::null_mut() };
6912 CResult_FundingLockedDecodeErrorZPtr { result }
6914 let err = unsafe { o.contents.err };
6915 unsafe { o.contents.err = std::ptr::null_mut(); }
6916 CResult_FundingLockedDecodeErrorZPtr { err }
6920 result_ok: o.result_ok,
6924 impl Clone for CResult_FundingLockedDecodeErrorZ {
6925 fn clone(&self) -> Self {
6927 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
6928 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
6931 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
6932 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6938 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
6939 /// but with all dynamically-allocated buffers duplicated in new buffers.
6940 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
6942 /// The contents of CResult_InitDecodeErrorZ
6943 pub union CResult_InitDecodeErrorZPtr {
6944 /// A pointer to the contents in the success state.
6945 /// Reading from this pointer when `result_ok` is not set is undefined.
6946 pub result: *mut crate::lightning::ln::msgs::Init,
6947 /// A pointer to the contents in the error state.
6948 /// Reading from this pointer when `result_ok` is set is undefined.
6949 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6952 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6953 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
6954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6955 pub struct CResult_InitDecodeErrorZ {
6956 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
6957 /// `err` or `result` depending on the state of `result_ok`.
6958 pub contents: CResult_InitDecodeErrorZPtr,
6959 /// Whether this CResult_InitDecodeErrorZ represents a success state.
6960 pub result_ok: bool,
6963 /// Creates a new CResult_InitDecodeErrorZ in the success state.
6964 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
6965 CResult_InitDecodeErrorZ {
6966 contents: CResult_InitDecodeErrorZPtr {
6967 result: Box::into_raw(Box::new(o)),
6973 /// Creates a new CResult_InitDecodeErrorZ in the error state.
6974 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
6975 CResult_InitDecodeErrorZ {
6976 contents: CResult_InitDecodeErrorZPtr {
6977 err: Box::into_raw(Box::new(e)),
6983 /// Frees any resources used by the CResult_InitDecodeErrorZ.
6984 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
6985 impl Drop for CResult_InitDecodeErrorZ {
6986 fn drop(&mut self) {
6988 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6989 let _ = unsafe { Box::from_raw(self.contents.result) };
6992 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6993 let _ = unsafe { Box::from_raw(self.contents.err) };
6998 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
6999 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
7000 let contents = if o.result_ok {
7001 let result = unsafe { o.contents.result };
7002 unsafe { o.contents.result = std::ptr::null_mut() };
7003 CResult_InitDecodeErrorZPtr { result }
7005 let err = unsafe { o.contents.err };
7006 unsafe { o.contents.err = std::ptr::null_mut(); }
7007 CResult_InitDecodeErrorZPtr { err }
7011 result_ok: o.result_ok,
7015 impl Clone for CResult_InitDecodeErrorZ {
7016 fn clone(&self) -> Self {
7018 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
7019 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
7022 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
7023 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7029 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
7030 /// but with all dynamically-allocated buffers duplicated in new buffers.
7031 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
7033 /// The contents of CResult_OpenChannelDecodeErrorZ
7034 pub union CResult_OpenChannelDecodeErrorZPtr {
7035 /// A pointer to the contents in the success state.
7036 /// Reading from this pointer when `result_ok` is not set is undefined.
7037 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
7038 /// A pointer to the contents in the error state.
7039 /// Reading from this pointer when `result_ok` is set is undefined.
7040 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7043 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
7044 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7046 pub struct CResult_OpenChannelDecodeErrorZ {
7047 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
7048 /// `err` or `result` depending on the state of `result_ok`.
7049 pub contents: CResult_OpenChannelDecodeErrorZPtr,
7050 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
7051 pub result_ok: bool,
7054 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
7055 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
7056 CResult_OpenChannelDecodeErrorZ {
7057 contents: CResult_OpenChannelDecodeErrorZPtr {
7058 result: Box::into_raw(Box::new(o)),
7064 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
7065 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
7066 CResult_OpenChannelDecodeErrorZ {
7067 contents: CResult_OpenChannelDecodeErrorZPtr {
7068 err: Box::into_raw(Box::new(e)),
7074 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
7075 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
7076 impl Drop for CResult_OpenChannelDecodeErrorZ {
7077 fn drop(&mut self) {
7079 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7080 let _ = unsafe { Box::from_raw(self.contents.result) };
7083 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7084 let _ = unsafe { Box::from_raw(self.contents.err) };
7089 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
7090 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
7091 let contents = if o.result_ok {
7092 let result = unsafe { o.contents.result };
7093 unsafe { o.contents.result = std::ptr::null_mut() };
7094 CResult_OpenChannelDecodeErrorZPtr { result }
7096 let err = unsafe { o.contents.err };
7097 unsafe { o.contents.err = std::ptr::null_mut(); }
7098 CResult_OpenChannelDecodeErrorZPtr { err }
7102 result_ok: o.result_ok,
7106 impl Clone for CResult_OpenChannelDecodeErrorZ {
7107 fn clone(&self) -> Self {
7109 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
7110 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
7113 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
7114 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7120 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
7121 /// but with all dynamically-allocated buffers duplicated in new buffers.
7122 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
7124 /// The contents of CResult_RevokeAndACKDecodeErrorZ
7125 pub union CResult_RevokeAndACKDecodeErrorZPtr {
7126 /// A pointer to the contents in the success state.
7127 /// Reading from this pointer when `result_ok` is not set is undefined.
7128 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
7129 /// A pointer to the contents in the error state.
7130 /// Reading from this pointer when `result_ok` is set is undefined.
7131 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7134 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
7135 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
7136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7137 pub struct CResult_RevokeAndACKDecodeErrorZ {
7138 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
7139 /// `err` or `result` depending on the state of `result_ok`.
7140 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
7141 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
7142 pub result_ok: bool,
7145 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
7146 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
7147 CResult_RevokeAndACKDecodeErrorZ {
7148 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7149 result: Box::into_raw(Box::new(o)),
7155 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
7156 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
7157 CResult_RevokeAndACKDecodeErrorZ {
7158 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7159 err: Box::into_raw(Box::new(e)),
7165 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
7166 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
7167 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
7168 fn drop(&mut self) {
7170 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7171 let _ = unsafe { Box::from_raw(self.contents.result) };
7174 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7175 let _ = unsafe { Box::from_raw(self.contents.err) };
7180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
7181 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
7182 let contents = if o.result_ok {
7183 let result = unsafe { o.contents.result };
7184 unsafe { o.contents.result = std::ptr::null_mut() };
7185 CResult_RevokeAndACKDecodeErrorZPtr { result }
7187 let err = unsafe { o.contents.err };
7188 unsafe { o.contents.err = std::ptr::null_mut(); }
7189 CResult_RevokeAndACKDecodeErrorZPtr { err }
7193 result_ok: o.result_ok,
7197 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
7198 fn clone(&self) -> Self {
7200 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7201 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
7204 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7205 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7211 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
7212 /// but with all dynamically-allocated buffers duplicated in new buffers.
7213 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
7215 /// The contents of CResult_ShutdownDecodeErrorZ
7216 pub union CResult_ShutdownDecodeErrorZPtr {
7217 /// A pointer to the contents in the success state.
7218 /// Reading from this pointer when `result_ok` is not set is undefined.
7219 pub result: *mut crate::lightning::ln::msgs::Shutdown,
7220 /// A pointer to the contents in the error state.
7221 /// Reading from this pointer when `result_ok` is set is undefined.
7222 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7225 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
7226 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
7227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7228 pub struct CResult_ShutdownDecodeErrorZ {
7229 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7230 /// `err` or `result` depending on the state of `result_ok`.
7231 pub contents: CResult_ShutdownDecodeErrorZPtr,
7232 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7233 pub result_ok: bool,
7236 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
7237 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
7238 CResult_ShutdownDecodeErrorZ {
7239 contents: CResult_ShutdownDecodeErrorZPtr {
7240 result: Box::into_raw(Box::new(o)),
7246 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
7247 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
7248 CResult_ShutdownDecodeErrorZ {
7249 contents: CResult_ShutdownDecodeErrorZPtr {
7250 err: Box::into_raw(Box::new(e)),
7256 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
7257 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
7258 impl Drop for CResult_ShutdownDecodeErrorZ {
7259 fn drop(&mut self) {
7261 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7262 let _ = unsafe { Box::from_raw(self.contents.result) };
7265 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7266 let _ = unsafe { Box::from_raw(self.contents.err) };
7271 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
7272 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
7273 let contents = if o.result_ok {
7274 let result = unsafe { o.contents.result };
7275 unsafe { o.contents.result = std::ptr::null_mut() };
7276 CResult_ShutdownDecodeErrorZPtr { result }
7278 let err = unsafe { o.contents.err };
7279 unsafe { o.contents.err = std::ptr::null_mut(); }
7280 CResult_ShutdownDecodeErrorZPtr { err }
7284 result_ok: o.result_ok,
7288 impl Clone for CResult_ShutdownDecodeErrorZ {
7289 fn clone(&self) -> Self {
7291 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
7292 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
7295 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
7296 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7302 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
7303 /// but with all dynamically-allocated buffers duplicated in new buffers.
7304 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
7306 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
7307 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
7308 /// A pointer to the contents in the success state.
7309 /// Reading from this pointer when `result_ok` is not set is undefined.
7310 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
7311 /// A pointer to the contents in the error state.
7312 /// Reading from this pointer when `result_ok` is set is undefined.
7313 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7316 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7317 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7319 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
7320 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7321 /// `err` or `result` depending on the state of `result_ok`.
7322 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
7323 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7324 pub result_ok: bool,
7327 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
7328 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
7329 CResult_UpdateFailHTLCDecodeErrorZ {
7330 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7331 result: Box::into_raw(Box::new(o)),
7337 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
7338 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
7339 CResult_UpdateFailHTLCDecodeErrorZ {
7340 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7341 err: Box::into_raw(Box::new(e)),
7347 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
7348 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
7349 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
7350 fn drop(&mut self) {
7352 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7353 let _ = unsafe { Box::from_raw(self.contents.result) };
7356 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7357 let _ = unsafe { Box::from_raw(self.contents.err) };
7362 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
7363 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7364 let contents = if o.result_ok {
7365 let result = unsafe { o.contents.result };
7366 unsafe { o.contents.result = std::ptr::null_mut() };
7367 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
7369 let err = unsafe { o.contents.err };
7370 unsafe { o.contents.err = std::ptr::null_mut(); }
7371 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
7375 result_ok: o.result_ok,
7379 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
7380 fn clone(&self) -> Self {
7382 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7383 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
7386 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7387 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7393 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
7394 /// but with all dynamically-allocated buffers duplicated in new buffers.
7395 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
7397 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7398 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7399 /// A pointer to the contents in the success state.
7400 /// Reading from this pointer when `result_ok` is not set is undefined.
7401 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
7402 /// A pointer to the contents in the error state.
7403 /// Reading from this pointer when `result_ok` is set is undefined.
7404 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7407 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7408 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7410 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7411 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7412 /// `err` or `result` depending on the state of `result_ok`.
7413 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
7414 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7415 pub result_ok: bool,
7418 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
7419 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7420 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7421 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7422 result: Box::into_raw(Box::new(o)),
7428 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
7429 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7430 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7431 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7432 err: Box::into_raw(Box::new(e)),
7438 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
7439 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
7440 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7441 fn drop(&mut self) {
7443 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7444 let _ = unsafe { Box::from_raw(self.contents.result) };
7447 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7448 let _ = unsafe { Box::from_raw(self.contents.err) };
7453 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7454 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7455 let contents = if o.result_ok {
7456 let result = unsafe { o.contents.result };
7457 unsafe { o.contents.result = std::ptr::null_mut() };
7458 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
7460 let err = unsafe { o.contents.err };
7461 unsafe { o.contents.err = std::ptr::null_mut(); }
7462 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
7466 result_ok: o.result_ok,
7470 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7471 fn clone(&self) -> Self {
7473 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7474 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
7477 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7478 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7484 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
7485 /// but with all dynamically-allocated buffers duplicated in new buffers.
7486 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
7488 /// The contents of CResult_UpdateFeeDecodeErrorZ
7489 pub union CResult_UpdateFeeDecodeErrorZPtr {
7490 /// A pointer to the contents in the success state.
7491 /// Reading from this pointer when `result_ok` is not set is undefined.
7492 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
7493 /// A pointer to the contents in the error state.
7494 /// Reading from this pointer when `result_ok` is set is undefined.
7495 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7498 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7499 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7501 pub struct CResult_UpdateFeeDecodeErrorZ {
7502 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7503 /// `err` or `result` depending on the state of `result_ok`.
7504 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
7505 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7506 pub result_ok: bool,
7509 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
7510 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
7511 CResult_UpdateFeeDecodeErrorZ {
7512 contents: CResult_UpdateFeeDecodeErrorZPtr {
7513 result: Box::into_raw(Box::new(o)),
7519 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
7520 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
7521 CResult_UpdateFeeDecodeErrorZ {
7522 contents: CResult_UpdateFeeDecodeErrorZPtr {
7523 err: Box::into_raw(Box::new(e)),
7529 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
7530 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
7531 impl Drop for CResult_UpdateFeeDecodeErrorZ {
7532 fn drop(&mut self) {
7534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7535 let _ = unsafe { Box::from_raw(self.contents.result) };
7538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7539 let _ = unsafe { Box::from_raw(self.contents.err) };
7544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
7545 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
7546 let contents = if o.result_ok {
7547 let result = unsafe { o.contents.result };
7548 unsafe { o.contents.result = std::ptr::null_mut() };
7549 CResult_UpdateFeeDecodeErrorZPtr { result }
7551 let err = unsafe { o.contents.err };
7552 unsafe { o.contents.err = std::ptr::null_mut(); }
7553 CResult_UpdateFeeDecodeErrorZPtr { err }
7557 result_ok: o.result_ok,
7561 impl Clone for CResult_UpdateFeeDecodeErrorZ {
7562 fn clone(&self) -> Self {
7564 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
7565 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
7568 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
7569 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7575 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
7576 /// but with all dynamically-allocated buffers duplicated in new buffers.
7577 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
7579 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7580 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7581 /// A pointer to the contents in the success state.
7582 /// Reading from this pointer when `result_ok` is not set is undefined.
7583 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
7584 /// A pointer to the contents in the error state.
7585 /// Reading from this pointer when `result_ok` is set is undefined.
7586 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7589 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7590 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7592 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
7593 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7594 /// `err` or `result` depending on the state of `result_ok`.
7595 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
7596 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7597 pub result_ok: bool,
7600 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
7601 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7602 CResult_UpdateFulfillHTLCDecodeErrorZ {
7603 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7604 result: Box::into_raw(Box::new(o)),
7610 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
7611 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7612 CResult_UpdateFulfillHTLCDecodeErrorZ {
7613 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7614 err: Box::into_raw(Box::new(e)),
7620 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
7621 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
7622 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
7623 fn drop(&mut self) {
7625 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7626 let _ = unsafe { Box::from_raw(self.contents.result) };
7629 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7630 let _ = unsafe { Box::from_raw(self.contents.err) };
7635 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
7636 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7637 let contents = if o.result_ok {
7638 let result = unsafe { o.contents.result };
7639 unsafe { o.contents.result = std::ptr::null_mut() };
7640 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
7642 let err = unsafe { o.contents.err };
7643 unsafe { o.contents.err = std::ptr::null_mut(); }
7644 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
7648 result_ok: o.result_ok,
7652 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
7653 fn clone(&self) -> Self {
7655 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7656 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
7659 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7660 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7666 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
7667 /// but with all dynamically-allocated buffers duplicated in new buffers.
7668 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
7670 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
7671 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
7672 /// A pointer to the contents in the success state.
7673 /// Reading from this pointer when `result_ok` is not set is undefined.
7674 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
7675 /// A pointer to the contents in the error state.
7676 /// Reading from this pointer when `result_ok` is set is undefined.
7677 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7680 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7681 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7683 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
7684 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7685 /// `err` or `result` depending on the state of `result_ok`.
7686 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
7687 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7688 pub result_ok: bool,
7691 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
7692 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
7693 CResult_UpdateAddHTLCDecodeErrorZ {
7694 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7695 result: Box::into_raw(Box::new(o)),
7701 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
7702 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
7703 CResult_UpdateAddHTLCDecodeErrorZ {
7704 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7705 err: Box::into_raw(Box::new(e)),
7711 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
7712 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
7713 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
7714 fn drop(&mut self) {
7716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7717 let _ = unsafe { Box::from_raw(self.contents.result) };
7720 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7721 let _ = unsafe { Box::from_raw(self.contents.err) };
7726 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
7727 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7728 let contents = if o.result_ok {
7729 let result = unsafe { o.contents.result };
7730 unsafe { o.contents.result = std::ptr::null_mut() };
7731 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
7733 let err = unsafe { o.contents.err };
7734 unsafe { o.contents.err = std::ptr::null_mut(); }
7735 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
7739 result_ok: o.result_ok,
7743 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
7744 fn clone(&self) -> Self {
7746 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7747 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
7750 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7751 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7757 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
7758 /// but with all dynamically-allocated buffers duplicated in new buffers.
7759 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
7761 /// The contents of CResult_PingDecodeErrorZ
7762 pub union CResult_PingDecodeErrorZPtr {
7763 /// A pointer to the contents in the success state.
7764 /// Reading from this pointer when `result_ok` is not set is undefined.
7765 pub result: *mut crate::lightning::ln::msgs::Ping,
7766 /// A pointer to the contents in the error state.
7767 /// Reading from this pointer when `result_ok` is set is undefined.
7768 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7771 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7772 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
7773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7774 pub struct CResult_PingDecodeErrorZ {
7775 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
7776 /// `err` or `result` depending on the state of `result_ok`.
7777 pub contents: CResult_PingDecodeErrorZPtr,
7778 /// Whether this CResult_PingDecodeErrorZ represents a success state.
7779 pub result_ok: bool,
7782 /// Creates a new CResult_PingDecodeErrorZ in the success state.
7783 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
7784 CResult_PingDecodeErrorZ {
7785 contents: CResult_PingDecodeErrorZPtr {
7786 result: Box::into_raw(Box::new(o)),
7792 /// Creates a new CResult_PingDecodeErrorZ in the error state.
7793 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
7794 CResult_PingDecodeErrorZ {
7795 contents: CResult_PingDecodeErrorZPtr {
7796 err: Box::into_raw(Box::new(e)),
7802 /// Frees any resources used by the CResult_PingDecodeErrorZ.
7803 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
7804 impl Drop for CResult_PingDecodeErrorZ {
7805 fn drop(&mut self) {
7807 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7808 let _ = unsafe { Box::from_raw(self.contents.result) };
7811 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7812 let _ = unsafe { Box::from_raw(self.contents.err) };
7817 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
7818 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
7819 let contents = if o.result_ok {
7820 let result = unsafe { o.contents.result };
7821 unsafe { o.contents.result = std::ptr::null_mut() };
7822 CResult_PingDecodeErrorZPtr { result }
7824 let err = unsafe { o.contents.err };
7825 unsafe { o.contents.err = std::ptr::null_mut(); }
7826 CResult_PingDecodeErrorZPtr { err }
7830 result_ok: o.result_ok,
7834 impl Clone for CResult_PingDecodeErrorZ {
7835 fn clone(&self) -> Self {
7837 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
7838 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
7841 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
7842 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7848 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
7849 /// but with all dynamically-allocated buffers duplicated in new buffers.
7850 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
7852 /// The contents of CResult_PongDecodeErrorZ
7853 pub union CResult_PongDecodeErrorZPtr {
7854 /// A pointer to the contents in the success state.
7855 /// Reading from this pointer when `result_ok` is not set is undefined.
7856 pub result: *mut crate::lightning::ln::msgs::Pong,
7857 /// A pointer to the contents in the error state.
7858 /// Reading from this pointer when `result_ok` is set is undefined.
7859 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7862 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7863 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
7864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7865 pub struct CResult_PongDecodeErrorZ {
7866 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
7867 /// `err` or `result` depending on the state of `result_ok`.
7868 pub contents: CResult_PongDecodeErrorZPtr,
7869 /// Whether this CResult_PongDecodeErrorZ represents a success state.
7870 pub result_ok: bool,
7873 /// Creates a new CResult_PongDecodeErrorZ in the success state.
7874 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
7875 CResult_PongDecodeErrorZ {
7876 contents: CResult_PongDecodeErrorZPtr {
7877 result: Box::into_raw(Box::new(o)),
7883 /// Creates a new CResult_PongDecodeErrorZ in the error state.
7884 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
7885 CResult_PongDecodeErrorZ {
7886 contents: CResult_PongDecodeErrorZPtr {
7887 err: Box::into_raw(Box::new(e)),
7893 /// Frees any resources used by the CResult_PongDecodeErrorZ.
7894 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
7895 impl Drop for CResult_PongDecodeErrorZ {
7896 fn drop(&mut self) {
7898 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7899 let _ = unsafe { Box::from_raw(self.contents.result) };
7902 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7903 let _ = unsafe { Box::from_raw(self.contents.err) };
7908 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
7909 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
7910 let contents = if o.result_ok {
7911 let result = unsafe { o.contents.result };
7912 unsafe { o.contents.result = std::ptr::null_mut() };
7913 CResult_PongDecodeErrorZPtr { result }
7915 let err = unsafe { o.contents.err };
7916 unsafe { o.contents.err = std::ptr::null_mut(); }
7917 CResult_PongDecodeErrorZPtr { err }
7921 result_ok: o.result_ok,
7925 impl Clone for CResult_PongDecodeErrorZ {
7926 fn clone(&self) -> Self {
7928 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
7929 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
7932 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
7933 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7939 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
7940 /// but with all dynamically-allocated buffers duplicated in new buffers.
7941 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
7943 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7944 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7945 /// A pointer to the contents in the success state.
7946 /// Reading from this pointer when `result_ok` is not set is undefined.
7947 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
7948 /// A pointer to the contents in the error state.
7949 /// Reading from this pointer when `result_ok` is set is undefined.
7950 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7953 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7954 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7956 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7957 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7958 /// `err` or `result` depending on the state of `result_ok`.
7959 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
7960 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7961 pub result_ok: bool,
7964 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
7965 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7966 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7967 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7968 result: Box::into_raw(Box::new(o)),
7974 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
7975 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7976 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7977 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7978 err: Box::into_raw(Box::new(e)),
7984 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
7985 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
7986 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7987 fn drop(&mut self) {
7989 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7990 let _ = unsafe { Box::from_raw(self.contents.result) };
7993 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7994 let _ = unsafe { Box::from_raw(self.contents.err) };
7999 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
8000 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8001 let contents = if o.result_ok {
8002 let result = unsafe { o.contents.result };
8003 unsafe { o.contents.result = std::ptr::null_mut() };
8004 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
8006 let err = unsafe { o.contents.err };
8007 unsafe { o.contents.err = std::ptr::null_mut(); }
8008 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
8012 result_ok: o.result_ok,
8016 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
8017 fn clone(&self) -> Self {
8019 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8020 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
8023 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8024 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8030 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
8031 /// but with all dynamically-allocated buffers duplicated in new buffers.
8032 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
8034 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
8035 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
8036 /// A pointer to the contents in the success state.
8037 /// Reading from this pointer when `result_ok` is not set is undefined.
8038 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
8039 /// A pointer to the contents in the error state.
8040 /// Reading from this pointer when `result_ok` is set is undefined.
8041 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8044 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8045 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8047 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
8048 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
8049 /// `err` or `result` depending on the state of `result_ok`.
8050 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
8051 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
8052 pub result_ok: bool,
8055 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
8056 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
8057 CResult_ChannelAnnouncementDecodeErrorZ {
8058 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8059 result: Box::into_raw(Box::new(o)),
8065 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
8066 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
8067 CResult_ChannelAnnouncementDecodeErrorZ {
8068 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8069 err: Box::into_raw(Box::new(e)),
8075 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
8076 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
8077 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
8078 fn drop(&mut self) {
8080 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8081 let _ = unsafe { Box::from_raw(self.contents.result) };
8084 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8085 let _ = unsafe { Box::from_raw(self.contents.err) };
8090 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
8091 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8092 let contents = if o.result_ok {
8093 let result = unsafe { o.contents.result };
8094 unsafe { o.contents.result = std::ptr::null_mut() };
8095 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
8097 let err = unsafe { o.contents.err };
8098 unsafe { o.contents.err = std::ptr::null_mut(); }
8099 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
8103 result_ok: o.result_ok,
8107 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
8108 fn clone(&self) -> Self {
8110 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8111 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
8114 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8115 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8121 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
8122 /// but with all dynamically-allocated buffers duplicated in new buffers.
8123 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
8125 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8126 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8127 /// A pointer to the contents in the success state.
8128 /// Reading from this pointer when `result_ok` is not set is undefined.
8129 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
8130 /// A pointer to the contents in the error state.
8131 /// Reading from this pointer when `result_ok` is set is undefined.
8132 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8135 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8136 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8138 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
8139 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8140 /// `err` or `result` depending on the state of `result_ok`.
8141 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
8142 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8143 pub result_ok: bool,
8146 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
8147 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8148 CResult_UnsignedChannelUpdateDecodeErrorZ {
8149 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8150 result: Box::into_raw(Box::new(o)),
8156 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
8157 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8158 CResult_UnsignedChannelUpdateDecodeErrorZ {
8159 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8160 err: Box::into_raw(Box::new(e)),
8166 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
8167 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
8168 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
8169 fn drop(&mut self) {
8171 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8172 let _ = unsafe { Box::from_raw(self.contents.result) };
8175 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8176 let _ = unsafe { Box::from_raw(self.contents.err) };
8181 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
8182 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8183 let contents = if o.result_ok {
8184 let result = unsafe { o.contents.result };
8185 unsafe { o.contents.result = std::ptr::null_mut() };
8186 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
8188 let err = unsafe { o.contents.err };
8189 unsafe { o.contents.err = std::ptr::null_mut(); }
8190 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
8194 result_ok: o.result_ok,
8198 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
8199 fn clone(&self) -> Self {
8201 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8202 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
8205 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8206 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8212 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
8213 /// but with all dynamically-allocated buffers duplicated in new buffers.
8214 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
8216 /// The contents of CResult_ChannelUpdateDecodeErrorZ
8217 pub union CResult_ChannelUpdateDecodeErrorZPtr {
8218 /// A pointer to the contents in the success state.
8219 /// Reading from this pointer when `result_ok` is not set is undefined.
8220 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
8221 /// A pointer to the contents in the error state.
8222 /// Reading from this pointer when `result_ok` is set is undefined.
8223 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8226 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8227 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8228 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8229 pub struct CResult_ChannelUpdateDecodeErrorZ {
8230 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8231 /// `err` or `result` depending on the state of `result_ok`.
8232 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
8233 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8234 pub result_ok: bool,
8237 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
8238 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
8239 CResult_ChannelUpdateDecodeErrorZ {
8240 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8241 result: Box::into_raw(Box::new(o)),
8247 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
8248 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
8249 CResult_ChannelUpdateDecodeErrorZ {
8250 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8251 err: Box::into_raw(Box::new(e)),
8257 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
8258 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
8259 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
8260 fn drop(&mut self) {
8262 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8263 let _ = unsafe { Box::from_raw(self.contents.result) };
8266 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8267 let _ = unsafe { Box::from_raw(self.contents.err) };
8272 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
8273 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8274 let contents = if o.result_ok {
8275 let result = unsafe { o.contents.result };
8276 unsafe { o.contents.result = std::ptr::null_mut() };
8277 CResult_ChannelUpdateDecodeErrorZPtr { result }
8279 let err = unsafe { o.contents.err };
8280 unsafe { o.contents.err = std::ptr::null_mut(); }
8281 CResult_ChannelUpdateDecodeErrorZPtr { err }
8285 result_ok: o.result_ok,
8289 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
8290 fn clone(&self) -> Self {
8292 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8293 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
8296 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8297 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8303 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
8304 /// but with all dynamically-allocated buffers duplicated in new buffers.
8305 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
8307 /// The contents of CResult_ErrorMessageDecodeErrorZ
8308 pub union CResult_ErrorMessageDecodeErrorZPtr {
8309 /// A pointer to the contents in the success state.
8310 /// Reading from this pointer when `result_ok` is not set is undefined.
8311 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
8312 /// A pointer to the contents in the error state.
8313 /// Reading from this pointer when `result_ok` is set is undefined.
8314 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8317 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8318 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
8319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8320 pub struct CResult_ErrorMessageDecodeErrorZ {
8321 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8322 /// `err` or `result` depending on the state of `result_ok`.
8323 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
8324 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8325 pub result_ok: bool,
8328 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
8329 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
8330 CResult_ErrorMessageDecodeErrorZ {
8331 contents: CResult_ErrorMessageDecodeErrorZPtr {
8332 result: Box::into_raw(Box::new(o)),
8338 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
8339 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
8340 CResult_ErrorMessageDecodeErrorZ {
8341 contents: CResult_ErrorMessageDecodeErrorZPtr {
8342 err: Box::into_raw(Box::new(e)),
8348 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
8349 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
8350 impl Drop for CResult_ErrorMessageDecodeErrorZ {
8351 fn drop(&mut self) {
8353 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8354 let _ = unsafe { Box::from_raw(self.contents.result) };
8357 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8358 let _ = unsafe { Box::from_raw(self.contents.err) };
8363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
8364 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
8365 let contents = if o.result_ok {
8366 let result = unsafe { o.contents.result };
8367 unsafe { o.contents.result = std::ptr::null_mut() };
8368 CResult_ErrorMessageDecodeErrorZPtr { result }
8370 let err = unsafe { o.contents.err };
8371 unsafe { o.contents.err = std::ptr::null_mut(); }
8372 CResult_ErrorMessageDecodeErrorZPtr { err }
8376 result_ok: o.result_ok,
8380 impl Clone for CResult_ErrorMessageDecodeErrorZ {
8381 fn clone(&self) -> Self {
8383 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
8384 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
8387 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
8388 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8394 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
8395 /// but with all dynamically-allocated buffers duplicated in new buffers.
8396 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
8398 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8399 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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::lightning::ln::msgs::UnsignedNodeAnnouncement,
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::msgs::DecodeError,
8408 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8409 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8411 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8412 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8413 /// `err` or `result` depending on the state of `result_ok`.
8414 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
8415 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8416 pub result_ok: bool,
8419 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
8420 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8421 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8422 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8423 result: Box::into_raw(Box::new(o)),
8429 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
8430 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8431 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8432 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8433 err: Box::into_raw(Box::new(e)),
8439 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
8440 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
8441 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
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::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8455 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> 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_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
8461 let err = unsafe { o.contents.err };
8462 unsafe { o.contents.err = std::ptr::null_mut(); }
8463 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
8467 result_ok: o.result_ok,
8471 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8472 fn clone(&self) -> Self {
8474 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8475 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8478 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8479 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8485 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
8486 /// but with all dynamically-allocated buffers duplicated in new buffers.
8487 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
8489 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
8490 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
8491 /// A pointer to the contents in the success state.
8492 /// Reading from this pointer when `result_ok` is not set is undefined.
8493 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
8494 /// A pointer to the contents in the error state.
8495 /// Reading from this pointer when `result_ok` is set is undefined.
8496 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8499 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8500 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8501 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8502 pub struct CResult_NodeAnnouncementDecodeErrorZ {
8503 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8504 /// `err` or `result` depending on the state of `result_ok`.
8505 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
8506 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8507 pub result_ok: bool,
8510 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
8511 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
8512 CResult_NodeAnnouncementDecodeErrorZ {
8513 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8514 result: Box::into_raw(Box::new(o)),
8520 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
8521 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
8522 CResult_NodeAnnouncementDecodeErrorZ {
8523 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8524 err: Box::into_raw(Box::new(e)),
8530 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
8531 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
8532 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
8533 fn drop(&mut self) {
8535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8536 let _ = unsafe { Box::from_raw(self.contents.result) };
8539 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8540 let _ = unsafe { Box::from_raw(self.contents.err) };
8545 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
8546 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8547 let contents = if o.result_ok {
8548 let result = unsafe { o.contents.result };
8549 unsafe { o.contents.result = std::ptr::null_mut() };
8550 CResult_NodeAnnouncementDecodeErrorZPtr { result }
8552 let err = unsafe { o.contents.err };
8553 unsafe { o.contents.err = std::ptr::null_mut(); }
8554 CResult_NodeAnnouncementDecodeErrorZPtr { err }
8558 result_ok: o.result_ok,
8562 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
8563 fn clone(&self) -> Self {
8565 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8566 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8569 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8570 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8576 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
8577 /// but with all dynamically-allocated buffers duplicated in new buffers.
8578 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
8580 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8581 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
8582 /// A pointer to the contents in the success state.
8583 /// Reading from this pointer when `result_ok` is not set is undefined.
8584 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
8585 /// A pointer to the contents in the error state.
8586 /// Reading from this pointer when `result_ok` is set is undefined.
8587 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8590 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8591 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
8592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8593 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
8594 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8595 /// `err` or `result` depending on the state of `result_ok`.
8596 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
8597 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8598 pub result_ok: bool,
8601 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
8602 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8603 CResult_QueryShortChannelIdsDecodeErrorZ {
8604 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8605 result: Box::into_raw(Box::new(o)),
8611 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
8612 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8613 CResult_QueryShortChannelIdsDecodeErrorZ {
8614 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8615 err: Box::into_raw(Box::new(e)),
8621 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
8622 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
8623 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
8624 fn drop(&mut self) {
8626 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8627 let _ = unsafe { Box::from_raw(self.contents.result) };
8630 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8631 let _ = unsafe { Box::from_raw(self.contents.err) };
8636 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
8637 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
8638 let contents = if o.result_ok {
8639 let result = unsafe { o.contents.result };
8640 unsafe { o.contents.result = std::ptr::null_mut() };
8641 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
8643 let err = unsafe { o.contents.err };
8644 unsafe { o.contents.err = std::ptr::null_mut(); }
8645 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
8649 result_ok: o.result_ok,
8653 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
8654 fn clone(&self) -> Self {
8656 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8657 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
8660 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8661 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8667 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
8668 /// but with all dynamically-allocated buffers duplicated in new buffers.
8669 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
8671 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8672 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8673 /// A pointer to the contents in the success state.
8674 /// Reading from this pointer when `result_ok` is not set is undefined.
8675 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
8676 /// A pointer to the contents in the error state.
8677 /// Reading from this pointer when `result_ok` is set is undefined.
8678 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8681 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8682 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
8683 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8684 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8685 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8686 /// `err` or `result` depending on the state of `result_ok`.
8687 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
8688 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8689 pub result_ok: bool,
8692 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
8693 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8694 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8695 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8696 result: Box::into_raw(Box::new(o)),
8702 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
8703 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8704 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8705 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8706 err: Box::into_raw(Box::new(e)),
8712 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
8713 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
8714 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8715 fn drop(&mut self) {
8717 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8718 let _ = unsafe { Box::from_raw(self.contents.result) };
8721 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8722 let _ = unsafe { Box::from_raw(self.contents.err) };
8727 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8728 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
8729 let contents = if o.result_ok {
8730 let result = unsafe { o.contents.result };
8731 unsafe { o.contents.result = std::ptr::null_mut() };
8732 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
8734 let err = unsafe { o.contents.err };
8735 unsafe { o.contents.err = std::ptr::null_mut(); }
8736 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
8740 result_ok: o.result_ok,
8744 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8745 fn clone(&self) -> Self {
8747 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8748 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
8751 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8752 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8758 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
8759 /// but with all dynamically-allocated buffers duplicated in new buffers.
8760 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
8762 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
8763 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
8764 /// A pointer to the contents in the success state.
8765 /// Reading from this pointer when `result_ok` is not set is undefined.
8766 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
8767 /// A pointer to the contents in the error state.
8768 /// Reading from this pointer when `result_ok` is set is undefined.
8769 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8772 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8773 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8775 pub struct CResult_QueryChannelRangeDecodeErrorZ {
8776 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8777 /// `err` or `result` depending on the state of `result_ok`.
8778 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
8779 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8780 pub result_ok: bool,
8783 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
8784 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
8785 CResult_QueryChannelRangeDecodeErrorZ {
8786 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8787 result: Box::into_raw(Box::new(o)),
8793 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
8794 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
8795 CResult_QueryChannelRangeDecodeErrorZ {
8796 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8797 err: Box::into_raw(Box::new(e)),
8803 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
8804 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
8805 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
8806 fn drop(&mut self) {
8808 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8809 let _ = unsafe { Box::from_raw(self.contents.result) };
8812 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8813 let _ = unsafe { Box::from_raw(self.contents.err) };
8818 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
8819 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8820 let contents = if o.result_ok {
8821 let result = unsafe { o.contents.result };
8822 unsafe { o.contents.result = std::ptr::null_mut() };
8823 CResult_QueryChannelRangeDecodeErrorZPtr { result }
8825 let err = unsafe { o.contents.err };
8826 unsafe { o.contents.err = std::ptr::null_mut(); }
8827 CResult_QueryChannelRangeDecodeErrorZPtr { err }
8831 result_ok: o.result_ok,
8835 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
8836 fn clone(&self) -> Self {
8838 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8839 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
8842 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8843 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8849 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
8850 /// but with all dynamically-allocated buffers duplicated in new buffers.
8851 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
8853 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
8854 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
8855 /// A pointer to the contents in the success state.
8856 /// Reading from this pointer when `result_ok` is not set is undefined.
8857 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
8858 /// A pointer to the contents in the error state.
8859 /// Reading from this pointer when `result_ok` is set is undefined.
8860 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8863 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8864 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8865 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8866 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
8867 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8868 /// `err` or `result` depending on the state of `result_ok`.
8869 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
8870 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8871 pub result_ok: bool,
8874 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
8875 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
8876 CResult_ReplyChannelRangeDecodeErrorZ {
8877 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8878 result: Box::into_raw(Box::new(o)),
8884 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
8885 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
8886 CResult_ReplyChannelRangeDecodeErrorZ {
8887 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8888 err: Box::into_raw(Box::new(e)),
8894 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
8895 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
8896 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
8897 fn drop(&mut self) {
8899 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8900 let _ = unsafe { Box::from_raw(self.contents.result) };
8903 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8904 let _ = unsafe { Box::from_raw(self.contents.err) };
8909 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
8910 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8911 let contents = if o.result_ok {
8912 let result = unsafe { o.contents.result };
8913 unsafe { o.contents.result = std::ptr::null_mut() };
8914 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
8916 let err = unsafe { o.contents.err };
8917 unsafe { o.contents.err = std::ptr::null_mut(); }
8918 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
8922 result_ok: o.result_ok,
8926 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
8927 fn clone(&self) -> Self {
8929 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8930 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
8933 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8934 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8940 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
8941 /// but with all dynamically-allocated buffers duplicated in new buffers.
8942 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
8944 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
8945 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
8946 /// A pointer to the contents in the success state.
8947 /// Reading from this pointer when `result_ok` is not set is undefined.
8948 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
8949 /// A pointer to the contents in the error state.
8950 /// Reading from this pointer when `result_ok` is set is undefined.
8951 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8954 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8955 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
8956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8957 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
8958 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8959 /// `err` or `result` depending on the state of `result_ok`.
8960 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
8961 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8962 pub result_ok: bool,
8965 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
8966 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
8967 CResult_GossipTimestampFilterDecodeErrorZ {
8968 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8969 result: Box::into_raw(Box::new(o)),
8975 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
8976 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
8977 CResult_GossipTimestampFilterDecodeErrorZ {
8978 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8979 err: Box::into_raw(Box::new(e)),
8985 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
8986 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
8987 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
8988 fn drop(&mut self) {
8990 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8991 let _ = unsafe { Box::from_raw(self.contents.result) };
8994 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8995 let _ = unsafe { Box::from_raw(self.contents.err) };
9000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
9001 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
9002 let contents = if o.result_ok {
9003 let result = unsafe { o.contents.result };
9004 unsafe { o.contents.result = std::ptr::null_mut() };
9005 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
9007 let err = unsafe { o.contents.err };
9008 unsafe { o.contents.err = std::ptr::null_mut(); }
9009 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
9013 result_ok: o.result_ok,
9017 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
9018 fn clone(&self) -> Self {
9020 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
9021 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
9024 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
9025 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9031 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
9032 /// but with all dynamically-allocated buffers duplicated in new buffers.
9033 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
9035 /// The contents of CResult_InvoiceSignOrCreationErrorZ
9036 pub union CResult_InvoiceSignOrCreationErrorZPtr {
9037 /// A pointer to the contents in the success state.
9038 /// Reading from this pointer when `result_ok` is not set is undefined.
9039 pub result: *mut crate::lightning_invoice::Invoice,
9040 /// A pointer to the contents in the error state.
9041 /// Reading from this pointer when `result_ok` is set is undefined.
9042 pub err: *mut crate::lightning_invoice::SignOrCreationError,
9045 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
9046 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
9047 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9048 pub struct CResult_InvoiceSignOrCreationErrorZ {
9049 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
9050 /// `err` or `result` depending on the state of `result_ok`.
9051 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
9052 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
9053 pub result_ok: bool,
9056 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
9057 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
9058 CResult_InvoiceSignOrCreationErrorZ {
9059 contents: CResult_InvoiceSignOrCreationErrorZPtr {
9060 result: Box::into_raw(Box::new(o)),
9066 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
9067 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
9068 CResult_InvoiceSignOrCreationErrorZ {
9069 contents: CResult_InvoiceSignOrCreationErrorZPtr {
9070 err: Box::into_raw(Box::new(e)),
9076 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
9077 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
9078 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
9079 fn drop(&mut self) {
9081 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9082 let _ = unsafe { Box::from_raw(self.contents.result) };
9085 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9086 let _ = unsafe { Box::from_raw(self.contents.err) };
9091 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
9092 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
9093 let contents = if o.result_ok {
9094 let result = unsafe { o.contents.result };
9095 unsafe { o.contents.result = std::ptr::null_mut() };
9096 CResult_InvoiceSignOrCreationErrorZPtr { result }
9098 let err = unsafe { o.contents.err };
9099 unsafe { o.contents.err = std::ptr::null_mut(); }
9100 CResult_InvoiceSignOrCreationErrorZPtr { err }
9104 result_ok: o.result_ok,
9108 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
9109 fn clone(&self) -> Self {
9111 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
9112 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
9115 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
9116 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
9122 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
9123 /// but with all dynamically-allocated buffers duplicated in new buffers.
9124 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }
9126 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
9127 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9128 /// A pointer to the contents in the success state.
9129 /// Reading from this pointer when `result_ok` is not set is undefined.
9130 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
9131 /// A pointer to the contents in the error state.
9132 /// Reading from this pointer when `result_ok` is set is undefined.
9133 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9136 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
9137 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
9138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9139 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9140 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
9141 /// `err` or `result` depending on the state of `result_ok`.
9142 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
9143 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
9144 pub result_ok: bool,
9147 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
9148 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9149 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9150 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9151 result: Box::into_raw(Box::new(o)),
9157 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
9158 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9159 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9160 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9161 err: Box::into_raw(Box::new(e)),
9167 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
9168 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
9169 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9170 fn drop(&mut self) {
9172 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9173 let _ = unsafe { Box::from_raw(self.contents.result) };
9176 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9177 let _ = unsafe { Box::from_raw(self.contents.err) };
9182 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9183 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
9184 let contents = if o.result_ok {
9185 let result = unsafe { o.contents.result };
9186 unsafe { o.contents.result = std::ptr::null_mut() };
9187 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
9189 let err = unsafe { o.contents.err };
9190 unsafe { o.contents.err = std::ptr::null_mut(); }
9191 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
9195 result_ok: o.result_ok,
9199 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9200 fn clone(&self) -> Self {
9202 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9203 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
9206 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9207 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9213 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9214 /// but with all dynamically-allocated buffers duplicated in new buffers.
9215 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
9217 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
9218 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9219 /// A pointer to the contents in the success state.
9220 /// Reading from this pointer when `result_ok` is not set is undefined.
9221 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
9222 /// A pointer to the contents in the error state.
9223 /// Reading from this pointer when `result_ok` is set is undefined.
9224 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9227 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
9228 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
9229 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9230 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9231 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
9232 /// `err` or `result` depending on the state of `result_ok`.
9233 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
9234 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
9235 pub result_ok: bool,
9238 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
9239 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9240 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9241 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9242 result: Box::into_raw(Box::new(o)),
9248 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
9249 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9250 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9251 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9252 err: Box::into_raw(Box::new(e)),
9258 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
9259 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
9260 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9261 fn drop(&mut self) {
9263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9264 let _ = unsafe { Box::from_raw(self.contents.result) };
9267 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9268 let _ = unsafe { Box::from_raw(self.contents.err) };
9273 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9274 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
9275 let contents = if o.result_ok {
9276 let result = unsafe { o.contents.result };
9277 unsafe { o.contents.result = std::ptr::null_mut() };
9278 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
9280 let err = unsafe { o.contents.err };
9281 unsafe { o.contents.err = std::ptr::null_mut(); }
9282 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
9286 result_ok: o.result_ok,
9290 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9291 fn clone(&self) -> Self {
9293 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9294 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
9297 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9298 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9304 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9305 /// but with all dynamically-allocated buffers duplicated in new buffers.
9306 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
9308 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
9309 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9310 /// A pointer to the contents in the success state.
9311 /// Reading from this pointer when `result_ok` is not set is undefined.
9312 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
9313 /// A pointer to the contents in the error state.
9314 /// Reading from this pointer when `result_ok` is set is undefined.
9315 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9318 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
9319 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
9320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9321 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
9322 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
9323 /// `err` or `result` depending on the state of `result_ok`.
9324 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
9325 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
9326 pub result_ok: bool,
9329 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9330 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
9331 CResult_SpendableOutputDescriptorDecodeErrorZ {
9332 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9333 result: Box::into_raw(Box::new(o)),
9339 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9340 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
9341 CResult_SpendableOutputDescriptorDecodeErrorZ {
9342 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9343 err: Box::into_raw(Box::new(e)),
9349 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9350 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
9351 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
9352 fn drop(&mut self) {
9354 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9355 let _ = unsafe { Box::from_raw(self.contents.result) };
9358 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9359 let _ = unsafe { Box::from_raw(self.contents.err) };
9364 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
9365 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
9366 let contents = if o.result_ok {
9367 let result = unsafe { o.contents.result };
9368 unsafe { o.contents.result = std::ptr::null_mut() };
9369 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
9371 let err = unsafe { o.contents.err };
9372 unsafe { o.contents.err = std::ptr::null_mut(); }
9373 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
9377 result_ok: o.result_ok,
9381 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
9382 fn clone(&self) -> Self {
9384 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9385 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
9388 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9389 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9395 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9396 /// but with all dynamically-allocated buffers duplicated in new buffers.
9397 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
9399 /// A tuple of 2 elements. See the individual fields for the types contained.
9400 pub struct C2Tuple_SignatureCVec_SignatureZZ {
9401 /// The element at position 0
9402 pub a: crate::c_types::Signature,
9403 /// The element at position 1
9404 pub b: crate::c_types::derived::CVec_SignatureZ,
9406 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
9407 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
9414 impl C2Tuple_SignatureCVec_SignatureZZ {
9415 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
9419 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
9420 fn clone(&self) -> Self {
9428 /// Creates a new tuple which has the same data as `orig`
9429 /// but with all dynamically-allocated buffers duplicated in new buffers.
9430 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
9431 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9433 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
9434 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
9438 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9439 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
9441 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
9442 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9443 /// A pointer to the contents in the success state.
9444 /// Reading from this pointer when `result_ok` is not set is undefined.
9445 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
9446 /// Note that this value is always NULL, as there are no contents in the Err variant
9447 pub err: *mut std::ffi::c_void,
9450 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
9451 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
9452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9453 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9454 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
9455 /// `err` or `result` depending on the state of `result_ok`.
9456 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
9457 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
9458 pub result_ok: bool,
9461 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9462 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9463 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9464 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9465 result: Box::into_raw(Box::new(o)),
9471 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9472 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9473 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9474 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9475 err: std::ptr::null_mut(),
9481 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9482 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
9483 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9484 fn drop(&mut self) {
9486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9487 let _ = unsafe { Box::from_raw(self.contents.result) };
9493 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9494 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
9495 let contents = if o.result_ok {
9496 let result = unsafe { o.contents.result };
9497 unsafe { o.contents.result = std::ptr::null_mut() };
9498 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
9500 let _ = unsafe { Box::from_raw(o.contents.err) };
9501 o.contents.err = std::ptr::null_mut();
9502 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
9506 result_ok: o.result_ok,
9510 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9511 fn clone(&self) -> Self {
9513 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9514 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
9517 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9518 err: std::ptr::null_mut()
9524 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9525 /// but with all dynamically-allocated buffers duplicated in new buffers.
9526 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
9528 /// The contents of CResult_SignatureNoneZ
9529 pub union CResult_SignatureNoneZPtr {
9530 /// A pointer to the contents in the success state.
9531 /// Reading from this pointer when `result_ok` is not set is undefined.
9532 pub result: *mut crate::c_types::Signature,
9533 /// Note that this value is always NULL, as there are no contents in the Err variant
9534 pub err: *mut std::ffi::c_void,
9537 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
9538 /// containing a crate::c_types::Signature on success and a () on failure.
9539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9540 pub struct CResult_SignatureNoneZ {
9541 /// The contents of this CResult_SignatureNoneZ, accessible via either
9542 /// `err` or `result` depending on the state of `result_ok`.
9543 pub contents: CResult_SignatureNoneZPtr,
9544 /// Whether this CResult_SignatureNoneZ represents a success state.
9545 pub result_ok: bool,
9548 /// Creates a new CResult_SignatureNoneZ in the success state.
9549 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
9550 CResult_SignatureNoneZ {
9551 contents: CResult_SignatureNoneZPtr {
9552 result: Box::into_raw(Box::new(o)),
9558 /// Creates a new CResult_SignatureNoneZ in the error state.
9559 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
9560 CResult_SignatureNoneZ {
9561 contents: CResult_SignatureNoneZPtr {
9562 err: std::ptr::null_mut(),
9568 /// Frees any resources used by the CResult_SignatureNoneZ.
9569 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
9570 impl Drop for CResult_SignatureNoneZ {
9571 fn drop(&mut self) {
9573 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9574 let _ = unsafe { Box::from_raw(self.contents.result) };
9580 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
9581 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
9582 let contents = if o.result_ok {
9583 let result = unsafe { o.contents.result };
9584 unsafe { o.contents.result = std::ptr::null_mut() };
9585 CResult_SignatureNoneZPtr { result }
9587 let _ = unsafe { Box::from_raw(o.contents.err) };
9588 o.contents.err = std::ptr::null_mut();
9589 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
9593 result_ok: o.result_ok,
9597 impl Clone for CResult_SignatureNoneZ {
9598 fn clone(&self) -> Self {
9600 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
9601 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
9604 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
9605 err: std::ptr::null_mut()
9611 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9612 /// but with all dynamically-allocated buffers duplicated in new buffers.
9613 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
9615 /// The contents of CResult_SignDecodeErrorZ
9616 pub union CResult_SignDecodeErrorZPtr {
9617 /// A pointer to the contents in the success state.
9618 /// Reading from this pointer when `result_ok` is not set is undefined.
9619 pub result: *mut crate::lightning::chain::keysinterface::Sign,
9620 /// A pointer to the contents in the error state.
9621 /// Reading from this pointer when `result_ok` is set is undefined.
9622 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9625 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
9626 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
9627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9628 pub struct CResult_SignDecodeErrorZ {
9629 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
9630 /// `err` or `result` depending on the state of `result_ok`.
9631 pub contents: CResult_SignDecodeErrorZPtr,
9632 /// Whether this CResult_SignDecodeErrorZ represents a success state.
9633 pub result_ok: bool,
9636 /// Creates a new CResult_SignDecodeErrorZ in the success state.
9637 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
9638 CResult_SignDecodeErrorZ {
9639 contents: CResult_SignDecodeErrorZPtr {
9640 result: Box::into_raw(Box::new(o)),
9646 /// Creates a new CResult_SignDecodeErrorZ in the error state.
9647 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
9648 CResult_SignDecodeErrorZ {
9649 contents: CResult_SignDecodeErrorZPtr {
9650 err: Box::into_raw(Box::new(e)),
9656 /// Frees any resources used by the CResult_SignDecodeErrorZ.
9657 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
9658 impl Drop for CResult_SignDecodeErrorZ {
9659 fn drop(&mut self) {
9661 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9662 let _ = unsafe { Box::from_raw(self.contents.result) };
9665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9666 let _ = unsafe { Box::from_raw(self.contents.err) };
9671 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
9672 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
9673 let contents = if o.result_ok {
9674 let result = unsafe { o.contents.result };
9675 unsafe { o.contents.result = std::ptr::null_mut() };
9676 CResult_SignDecodeErrorZPtr { result }
9678 let err = unsafe { o.contents.err };
9679 unsafe { o.contents.err = std::ptr::null_mut(); }
9680 CResult_SignDecodeErrorZPtr { err }
9684 result_ok: o.result_ok,
9688 impl Clone for CResult_SignDecodeErrorZ {
9689 fn clone(&self) -> Self {
9691 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
9692 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
9695 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
9696 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9702 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9703 /// but with all dynamically-allocated buffers duplicated in new buffers.
9704 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
9706 /// The contents of CResult_RecoverableSignatureNoneZ
9707 pub union CResult_RecoverableSignatureNoneZPtr {
9708 /// A pointer to the contents in the success state.
9709 /// Reading from this pointer when `result_ok` is not set is undefined.
9710 pub result: *mut crate::c_types::RecoverableSignature,
9711 /// Note that this value is always NULL, as there are no contents in the Err variant
9712 pub err: *mut std::ffi::c_void,
9715 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
9716 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
9717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9718 pub struct CResult_RecoverableSignatureNoneZ {
9719 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
9720 /// `err` or `result` depending on the state of `result_ok`.
9721 pub contents: CResult_RecoverableSignatureNoneZPtr,
9722 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
9723 pub result_ok: bool,
9726 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
9727 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
9728 CResult_RecoverableSignatureNoneZ {
9729 contents: CResult_RecoverableSignatureNoneZPtr {
9730 result: Box::into_raw(Box::new(o)),
9736 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
9737 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
9738 CResult_RecoverableSignatureNoneZ {
9739 contents: CResult_RecoverableSignatureNoneZPtr {
9740 err: std::ptr::null_mut(),
9746 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
9747 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
9748 impl Drop for CResult_RecoverableSignatureNoneZ {
9749 fn drop(&mut self) {
9751 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9752 let _ = unsafe { Box::from_raw(self.contents.result) };
9758 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
9759 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
9760 let contents = if o.result_ok {
9761 let result = unsafe { o.contents.result };
9762 unsafe { o.contents.result = std::ptr::null_mut() };
9763 CResult_RecoverableSignatureNoneZPtr { result }
9765 let _ = unsafe { Box::from_raw(o.contents.err) };
9766 o.contents.err = std::ptr::null_mut();
9767 CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
9771 result_ok: o.result_ok,
9775 impl Clone for CResult_RecoverableSignatureNoneZ {
9776 fn clone(&self) -> Self {
9778 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
9779 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
9782 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
9783 err: std::ptr::null_mut()
9789 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
9790 /// but with all dynamically-allocated buffers duplicated in new buffers.
9791 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { orig.clone() }
9793 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
9794 /// This corresponds to std::vector in C++
9795 pub struct CVec_CVec_u8ZZ {
9796 /// The elements in the array.
9797 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9798 pub data: *mut crate::c_types::derived::CVec_u8Z,
9799 /// The number of elements pointed to by `data`.
9802 impl CVec_CVec_u8ZZ {
9803 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
9804 if self.datalen == 0 { return Vec::new(); }
9805 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9806 self.data = std::ptr::null_mut();
9810 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
9811 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9814 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
9815 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
9816 let datalen = v.len();
9817 let data = Box::into_raw(v.into_boxed_slice());
9818 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9822 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9823 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
9824 impl Drop for CVec_CVec_u8ZZ {
9825 fn drop(&mut self) {
9826 if self.datalen == 0 { return; }
9827 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9830 impl Clone for CVec_CVec_u8ZZ {
9831 fn clone(&self) -> Self {
9832 let mut res = Vec::new();
9833 if self.datalen == 0 { return Self::from(res); }
9834 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9839 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
9840 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
9841 /// A pointer to the contents in the success state.
9842 /// Reading from this pointer when `result_ok` is not set is undefined.
9843 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
9844 /// Note that this value is always NULL, as there are no contents in the Err variant
9845 pub err: *mut std::ffi::c_void,
9848 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
9849 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
9850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9851 pub struct CResult_CVec_CVec_u8ZZNoneZ {
9852 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
9853 /// `err` or `result` depending on the state of `result_ok`.
9854 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
9855 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
9856 pub result_ok: bool,
9859 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9860 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
9861 CResult_CVec_CVec_u8ZZNoneZ {
9862 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9863 result: Box::into_raw(Box::new(o)),
9869 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9870 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
9871 CResult_CVec_CVec_u8ZZNoneZ {
9872 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9873 err: std::ptr::null_mut(),
9879 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9880 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
9881 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
9882 fn drop(&mut self) {
9884 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9885 let _ = unsafe { Box::from_raw(self.contents.result) };
9891 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
9892 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
9893 let contents = if o.result_ok {
9894 let result = unsafe { o.contents.result };
9895 unsafe { o.contents.result = std::ptr::null_mut() };
9896 CResult_CVec_CVec_u8ZZNoneZPtr { result }
9898 let _ = unsafe { Box::from_raw(o.contents.err) };
9899 o.contents.err = std::ptr::null_mut();
9900 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
9904 result_ok: o.result_ok,
9908 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
9909 fn clone(&self) -> Self {
9911 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9912 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
9915 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9916 err: std::ptr::null_mut()
9922 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9923 /// but with all dynamically-allocated buffers duplicated in new buffers.
9924 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
9926 /// The contents of CResult_InMemorySignerDecodeErrorZ
9927 pub union CResult_InMemorySignerDecodeErrorZPtr {
9928 /// A pointer to the contents in the success state.
9929 /// Reading from this pointer when `result_ok` is not set is undefined.
9930 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
9931 /// A pointer to the contents in the error state.
9932 /// Reading from this pointer when `result_ok` is set is undefined.
9933 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9936 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
9937 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
9938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9939 pub struct CResult_InMemorySignerDecodeErrorZ {
9940 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
9941 /// `err` or `result` depending on the state of `result_ok`.
9942 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
9943 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
9944 pub result_ok: bool,
9947 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9948 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
9949 CResult_InMemorySignerDecodeErrorZ {
9950 contents: CResult_InMemorySignerDecodeErrorZPtr {
9951 result: Box::into_raw(Box::new(o)),
9957 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9958 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
9959 CResult_InMemorySignerDecodeErrorZ {
9960 contents: CResult_InMemorySignerDecodeErrorZPtr {
9961 err: Box::into_raw(Box::new(e)),
9967 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9968 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
9969 impl Drop for CResult_InMemorySignerDecodeErrorZ {
9970 fn drop(&mut self) {
9972 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9973 let _ = unsafe { Box::from_raw(self.contents.result) };
9976 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9977 let _ = unsafe { Box::from_raw(self.contents.err) };
9982 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
9983 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
9984 let contents = if o.result_ok {
9985 let result = unsafe { o.contents.result };
9986 unsafe { o.contents.result = std::ptr::null_mut() };
9987 CResult_InMemorySignerDecodeErrorZPtr { result }
9989 let err = unsafe { o.contents.err };
9990 unsafe { o.contents.err = std::ptr::null_mut(); }
9991 CResult_InMemorySignerDecodeErrorZPtr { err }
9995 result_ok: o.result_ok,
9999 impl Clone for CResult_InMemorySignerDecodeErrorZ {
10000 fn clone(&self) -> Self {
10001 if self.result_ok {
10002 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
10003 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
10006 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
10007 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10013 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
10014 /// but with all dynamically-allocated buffers duplicated in new buffers.
10015 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
10017 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
10018 /// This corresponds to std::vector in C++
10019 pub struct CVec_TxOutZ {
10020 /// The elements in the array.
10021 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10022 pub data: *mut crate::c_types::TxOut,
10023 /// The number of elements pointed to by `data`.
10027 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
10028 if self.datalen == 0 { return Vec::new(); }
10029 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10030 self.data = std::ptr::null_mut();
10034 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
10035 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10038 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
10039 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
10040 let datalen = v.len();
10041 let data = Box::into_raw(v.into_boxed_slice());
10042 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10046 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10047 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
10048 impl Drop for CVec_TxOutZ {
10049 fn drop(&mut self) {
10050 if self.datalen == 0 { return; }
10051 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10054 impl Clone for CVec_TxOutZ {
10055 fn clone(&self) -> Self {
10056 let mut res = Vec::new();
10057 if self.datalen == 0 { return Self::from(res); }
10058 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10063 /// The contents of CResult_TransactionNoneZ
10064 pub union CResult_TransactionNoneZPtr {
10065 /// A pointer to the contents in the success state.
10066 /// Reading from this pointer when `result_ok` is not set is undefined.
10067 pub result: *mut crate::c_types::Transaction,
10068 /// Note that this value is always NULL, as there are no contents in the Err variant
10069 pub err: *mut std::ffi::c_void,
10072 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
10073 /// containing a crate::c_types::Transaction on success and a () on failure.
10074 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10075 pub struct CResult_TransactionNoneZ {
10076 /// The contents of this CResult_TransactionNoneZ, accessible via either
10077 /// `err` or `result` depending on the state of `result_ok`.
10078 pub contents: CResult_TransactionNoneZPtr,
10079 /// Whether this CResult_TransactionNoneZ represents a success state.
10080 pub result_ok: bool,
10083 /// Creates a new CResult_TransactionNoneZ in the success state.
10084 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
10085 CResult_TransactionNoneZ {
10086 contents: CResult_TransactionNoneZPtr {
10087 result: Box::into_raw(Box::new(o)),
10093 /// Creates a new CResult_TransactionNoneZ in the error state.
10094 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
10095 CResult_TransactionNoneZ {
10096 contents: CResult_TransactionNoneZPtr {
10097 err: std::ptr::null_mut(),
10103 /// Frees any resources used by the CResult_TransactionNoneZ.
10104 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
10105 impl Drop for CResult_TransactionNoneZ {
10106 fn drop(&mut self) {
10107 if self.result_ok {
10108 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10109 let _ = unsafe { Box::from_raw(self.contents.result) };
10115 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
10116 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
10117 let contents = if o.result_ok {
10118 let result = unsafe { o.contents.result };
10119 unsafe { o.contents.result = std::ptr::null_mut() };
10120 CResult_TransactionNoneZPtr { result }
10122 let _ = unsafe { Box::from_raw(o.contents.err) };
10123 o.contents.err = std::ptr::null_mut();
10124 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
10128 result_ok: o.result_ok,
10133 /// The contents of CResult_NoneErrorZ
10134 pub union CResult_NoneErrorZPtr {
10135 /// Note that this value is always NULL, as there are no contents in the OK variant
10136 pub result: *mut std::ffi::c_void,
10137 /// A pointer to the contents in the error state.
10138 /// Reading from this pointer when `result_ok` is set is undefined.
10139 pub err: *mut crate::c_types::IOError,
10142 /// A CResult_NoneErrorZ represents the result of a fallible operation,
10143 /// containing a () on success and a crate::c_types::IOError on failure.
10144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10145 pub struct CResult_NoneErrorZ {
10146 /// The contents of this CResult_NoneErrorZ, accessible via either
10147 /// `err` or `result` depending on the state of `result_ok`.
10148 pub contents: CResult_NoneErrorZPtr,
10149 /// Whether this CResult_NoneErrorZ represents a success state.
10150 pub result_ok: bool,
10153 /// Creates a new CResult_NoneErrorZ in the success state.
10154 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
10155 CResult_NoneErrorZ {
10156 contents: CResult_NoneErrorZPtr {
10157 result: std::ptr::null_mut(),
10163 /// Creates a new CResult_NoneErrorZ in the error state.
10164 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
10165 CResult_NoneErrorZ {
10166 contents: CResult_NoneErrorZPtr {
10167 err: Box::into_raw(Box::new(e)),
10173 /// Frees any resources used by the CResult_NoneErrorZ.
10174 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
10175 impl Drop for CResult_NoneErrorZ {
10176 fn drop(&mut self) {
10177 if self.result_ok {
10179 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10180 let _ = unsafe { Box::from_raw(self.contents.err) };
10185 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
10186 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
10187 let contents = if o.result_ok {
10188 let _ = unsafe { Box::from_raw(o.contents.result) };
10189 o.contents.result = std::ptr::null_mut();
10190 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
10192 let err = unsafe { o.contents.err };
10193 unsafe { o.contents.err = std::ptr::null_mut(); }
10194 CResult_NoneErrorZPtr { err }
10198 result_ok: o.result_ok,
10203 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
10204 /// This corresponds to std::vector in C++
10205 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
10206 /// The elements in the array.
10207 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10208 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10209 /// The number of elements pointed to by `data`.
10212 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
10213 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
10214 if self.datalen == 0 { return Vec::new(); }
10215 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10216 self.data = std::ptr::null_mut();
10220 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
10221 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10224 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
10225 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
10226 let datalen = v.len();
10227 let data = Box::into_raw(v.into_boxed_slice());
10228 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10232 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10233 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
10234 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
10235 fn drop(&mut self) {
10236 if self.datalen == 0 { return; }
10237 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10241 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
10242 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
10243 /// A pointer to the contents in the success state.
10244 /// Reading from this pointer when `result_ok` is not set is undefined.
10245 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
10246 /// A pointer to the contents in the error state.
10247 /// Reading from this pointer when `result_ok` is set is undefined.
10248 pub err: *mut crate::c_types::IOError,
10251 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
10252 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
10253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10254 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10255 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
10256 /// `err` or `result` depending on the state of `result_ok`.
10257 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
10258 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
10259 pub result_ok: bool,
10262 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
10263 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10264 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10265 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
10266 result: Box::into_raw(Box::new(o)),
10272 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
10273 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10274 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10275 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
10276 err: Box::into_raw(Box::new(e)),
10282 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
10283 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
10284 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10285 fn drop(&mut self) {
10286 if self.result_ok {
10287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10288 let _ = unsafe { Box::from_raw(self.contents.result) };
10291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10292 let _ = unsafe { Box::from_raw(self.contents.err) };
10297 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10298 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
10299 let contents = if o.result_ok {
10300 let result = unsafe { o.contents.result };
10301 unsafe { o.contents.result = std::ptr::null_mut() };
10302 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
10304 let err = unsafe { o.contents.err };
10305 unsafe { o.contents.err = std::ptr::null_mut(); }
10306 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
10310 result_ok: o.result_ok,
10315 /// The contents of CResult_NoneAPIErrorZ
10316 pub union CResult_NoneAPIErrorZPtr {
10317 /// Note that this value is always NULL, as there are no contents in the OK variant
10318 pub result: *mut std::ffi::c_void,
10319 /// A pointer to the contents in the error state.
10320 /// Reading from this pointer when `result_ok` is set is undefined.
10321 pub err: *mut crate::lightning::util::errors::APIError,
10324 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
10325 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
10326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10327 pub struct CResult_NoneAPIErrorZ {
10328 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
10329 /// `err` or `result` depending on the state of `result_ok`.
10330 pub contents: CResult_NoneAPIErrorZPtr,
10331 /// Whether this CResult_NoneAPIErrorZ represents a success state.
10332 pub result_ok: bool,
10335 /// Creates a new CResult_NoneAPIErrorZ in the success state.
10336 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
10337 CResult_NoneAPIErrorZ {
10338 contents: CResult_NoneAPIErrorZPtr {
10339 result: std::ptr::null_mut(),
10345 /// Creates a new CResult_NoneAPIErrorZ in the error state.
10346 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
10347 CResult_NoneAPIErrorZ {
10348 contents: CResult_NoneAPIErrorZPtr {
10349 err: Box::into_raw(Box::new(e)),
10355 /// Frees any resources used by the CResult_NoneAPIErrorZ.
10356 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
10357 impl Drop for CResult_NoneAPIErrorZ {
10358 fn drop(&mut self) {
10359 if self.result_ok {
10361 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10362 let _ = unsafe { Box::from_raw(self.contents.err) };
10367 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
10368 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
10369 let contents = if o.result_ok {
10370 let _ = unsafe { Box::from_raw(o.contents.result) };
10371 o.contents.result = std::ptr::null_mut();
10372 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
10374 let err = unsafe { o.contents.err };
10375 unsafe { o.contents.err = std::ptr::null_mut(); }
10376 CResult_NoneAPIErrorZPtr { err }
10380 result_ok: o.result_ok,
10384 impl Clone for CResult_NoneAPIErrorZ {
10385 fn clone(&self) -> Self {
10386 if self.result_ok {
10387 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
10388 result: std::ptr::null_mut()
10391 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
10392 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10398 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
10399 /// but with all dynamically-allocated buffers duplicated in new buffers.
10400 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
10402 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
10403 /// This corresponds to std::vector in C++
10404 pub struct CVec_CResult_NoneAPIErrorZZ {
10405 /// The elements in the array.
10406 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10407 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
10408 /// The number of elements pointed to by `data`.
10411 impl CVec_CResult_NoneAPIErrorZZ {
10412 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
10413 if self.datalen == 0 { return Vec::new(); }
10414 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10415 self.data = std::ptr::null_mut();
10419 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
10420 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10423 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
10424 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
10425 let datalen = v.len();
10426 let data = Box::into_raw(v.into_boxed_slice());
10427 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10431 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10432 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
10433 impl Drop for CVec_CResult_NoneAPIErrorZZ {
10434 fn drop(&mut self) {
10435 if self.datalen == 0 { return; }
10436 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10439 impl Clone for CVec_CResult_NoneAPIErrorZZ {
10440 fn clone(&self) -> Self {
10441 let mut res = Vec::new();
10442 if self.datalen == 0 { return Self::from(res); }
10443 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10448 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
10449 /// This corresponds to std::vector in C++
10450 pub struct CVec_APIErrorZ {
10451 /// The elements in the array.
10452 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10453 pub data: *mut crate::lightning::util::errors::APIError,
10454 /// The number of elements pointed to by `data`.
10457 impl CVec_APIErrorZ {
10458 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
10459 if self.datalen == 0 { return Vec::new(); }
10460 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10461 self.data = std::ptr::null_mut();
10465 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
10466 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10469 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
10470 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
10471 let datalen = v.len();
10472 let data = Box::into_raw(v.into_boxed_slice());
10473 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10478 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
10479 impl Drop for CVec_APIErrorZ {
10480 fn drop(&mut self) {
10481 if self.datalen == 0 { return; }
10482 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10485 impl Clone for CVec_APIErrorZ {
10486 fn clone(&self) -> Self {
10487 let mut res = Vec::new();
10488 if self.datalen == 0 { return Self::from(res); }
10489 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10494 /// The contents of CResult_NonePaymentSendFailureZ
10495 pub union CResult_NonePaymentSendFailureZPtr {
10496 /// Note that this value is always NULL, as there are no contents in the OK variant
10497 pub result: *mut std::ffi::c_void,
10498 /// A pointer to the contents in the error state.
10499 /// Reading from this pointer when `result_ok` is set is undefined.
10500 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
10503 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
10504 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
10505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10506 pub struct CResult_NonePaymentSendFailureZ {
10507 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
10508 /// `err` or `result` depending on the state of `result_ok`.
10509 pub contents: CResult_NonePaymentSendFailureZPtr,
10510 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
10511 pub result_ok: bool,
10514 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
10515 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
10516 CResult_NonePaymentSendFailureZ {
10517 contents: CResult_NonePaymentSendFailureZPtr {
10518 result: std::ptr::null_mut(),
10524 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
10525 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
10526 CResult_NonePaymentSendFailureZ {
10527 contents: CResult_NonePaymentSendFailureZPtr {
10528 err: Box::into_raw(Box::new(e)),
10534 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
10535 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
10536 impl Drop for CResult_NonePaymentSendFailureZ {
10537 fn drop(&mut self) {
10538 if self.result_ok {
10540 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10541 let _ = unsafe { Box::from_raw(self.contents.err) };
10546 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
10547 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
10548 let contents = if o.result_ok {
10549 let _ = unsafe { Box::from_raw(o.contents.result) };
10550 o.contents.result = std::ptr::null_mut();
10551 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
10553 let err = unsafe { o.contents.err };
10554 unsafe { o.contents.err = std::ptr::null_mut(); }
10555 CResult_NonePaymentSendFailureZPtr { err }
10559 result_ok: o.result_ok,
10563 impl Clone for CResult_NonePaymentSendFailureZ {
10564 fn clone(&self) -> Self {
10565 if self.result_ok {
10566 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
10567 result: std::ptr::null_mut()
10570 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
10571 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10577 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
10578 /// but with all dynamically-allocated buffers duplicated in new buffers.
10579 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
10581 /// A tuple of 2 elements. See the individual fields for the types contained.
10582 pub struct C2Tuple_PaymentHashPaymentSecretZ {
10583 /// The element at position 0
10584 pub a: crate::c_types::ThirtyTwoBytes,
10585 /// The element at position 1
10586 pub b: crate::c_types::ThirtyTwoBytes,
10588 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
10589 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
10596 impl C2Tuple_PaymentHashPaymentSecretZ {
10597 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
10601 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
10603 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
10604 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
10608 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
10609 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
10611 /// The contents of CResult_PaymentSecretAPIErrorZ
10612 pub union CResult_PaymentSecretAPIErrorZPtr {
10613 /// A pointer to the contents in the success state.
10614 /// Reading from this pointer when `result_ok` is not set is undefined.
10615 pub result: *mut crate::c_types::ThirtyTwoBytes,
10616 /// A pointer to the contents in the error state.
10617 /// Reading from this pointer when `result_ok` is set is undefined.
10618 pub err: *mut crate::lightning::util::errors::APIError,
10621 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
10622 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10623 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10624 pub struct CResult_PaymentSecretAPIErrorZ {
10625 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
10626 /// `err` or `result` depending on the state of `result_ok`.
10627 pub contents: CResult_PaymentSecretAPIErrorZPtr,
10628 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
10629 pub result_ok: bool,
10632 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
10633 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
10634 CResult_PaymentSecretAPIErrorZ {
10635 contents: CResult_PaymentSecretAPIErrorZPtr {
10636 result: Box::into_raw(Box::new(o)),
10642 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
10643 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
10644 CResult_PaymentSecretAPIErrorZ {
10645 contents: CResult_PaymentSecretAPIErrorZPtr {
10646 err: Box::into_raw(Box::new(e)),
10652 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
10653 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
10654 impl Drop for CResult_PaymentSecretAPIErrorZ {
10655 fn drop(&mut self) {
10656 if self.result_ok {
10657 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10658 let _ = unsafe { Box::from_raw(self.contents.result) };
10661 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10662 let _ = unsafe { Box::from_raw(self.contents.err) };
10667 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
10668 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10669 let contents = if o.result_ok {
10670 let result = unsafe { o.contents.result };
10671 unsafe { o.contents.result = std::ptr::null_mut() };
10672 CResult_PaymentSecretAPIErrorZPtr { result }
10674 let err = unsafe { o.contents.err };
10675 unsafe { o.contents.err = std::ptr::null_mut(); }
10676 CResult_PaymentSecretAPIErrorZPtr { err }
10680 result_ok: o.result_ok,
10685 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10686 /// This corresponds to std::vector in C++
10687 pub struct CVec_ChannelMonitorZ {
10688 /// The elements in the array.
10689 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10690 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10691 /// The number of elements pointed to by `data`.
10694 impl CVec_ChannelMonitorZ {
10695 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10696 if self.datalen == 0 { return Vec::new(); }
10697 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10698 self.data = std::ptr::null_mut();
10702 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10703 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10706 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10707 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10708 let datalen = v.len();
10709 let data = Box::into_raw(v.into_boxed_slice());
10710 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10714 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10715 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10716 impl Drop for CVec_ChannelMonitorZ {
10717 fn drop(&mut self) {
10718 if self.datalen == 0 { return; }
10719 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10723 /// A tuple of 2 elements. See the individual fields for the types contained.
10724 pub struct C2Tuple_BlockHashChannelManagerZ {
10725 /// The element at position 0
10726 pub a: crate::c_types::ThirtyTwoBytes,
10727 /// The element at position 1
10728 pub b: crate::lightning::ln::channelmanager::ChannelManager,
10730 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10731 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10738 impl C2Tuple_BlockHashChannelManagerZ {
10739 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10743 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10745 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10746 C2Tuple_BlockHashChannelManagerZ { a, b, }
10750 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10751 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10753 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10754 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10755 /// A pointer to the contents in the success state.
10756 /// Reading from this pointer when `result_ok` is not set is undefined.
10757 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10758 /// A pointer to the contents in the error state.
10759 /// Reading from this pointer when `result_ok` is set is undefined.
10760 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10763 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10764 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10765 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10766 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10767 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10768 /// `err` or `result` depending on the state of `result_ok`.
10769 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10770 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10771 pub result_ok: bool,
10774 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10775 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10776 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10777 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10778 result: Box::into_raw(Box::new(o)),
10784 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10785 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10786 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10787 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10788 err: Box::into_raw(Box::new(e)),
10794 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10795 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10796 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10797 fn drop(&mut self) {
10798 if self.result_ok {
10799 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10800 let _ = unsafe { Box::from_raw(self.contents.result) };
10803 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10804 let _ = unsafe { Box::from_raw(self.contents.err) };
10809 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10810 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10811 let contents = if o.result_ok {
10812 let result = unsafe { o.contents.result };
10813 unsafe { o.contents.result = std::ptr::null_mut() };
10814 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10816 let err = unsafe { o.contents.err };
10817 unsafe { o.contents.err = std::ptr::null_mut(); }
10818 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10822 result_ok: o.result_ok,