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, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
1267 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> 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, u8>> for CResult_CVec_SignatureZNoneZ {
1337 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>) -> 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 /// A dynamically-allocated array of crate::lightning_invoice::RawTaggedFields of arbitrary size.
1372 /// This corresponds to std::vector in C++
1373 pub struct CVec_RawTaggedFieldZ {
1374 /// The elements in the array.
1375 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1376 pub data: *mut crate::lightning_invoice::RawTaggedField,
1377 /// The number of elements pointed to by `data`.
1380 impl CVec_RawTaggedFieldZ {
1381 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::RawTaggedField> {
1382 if self.datalen == 0 { return Vec::new(); }
1383 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1384 self.data = std::ptr::null_mut();
1388 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::RawTaggedField] {
1389 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1392 impl From<Vec<crate::lightning_invoice::RawTaggedField>> for CVec_RawTaggedFieldZ {
1393 fn from(v: Vec<crate::lightning_invoice::RawTaggedField>) -> Self {
1394 let datalen = v.len();
1395 let data = Box::into_raw(v.into_boxed_slice());
1396 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1400 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1401 pub extern "C" fn CVec_RawTaggedFieldZ_free(_res: CVec_RawTaggedFieldZ) { }
1402 impl Drop for CVec_RawTaggedFieldZ {
1403 fn drop(&mut self) {
1404 if self.datalen == 0 { return; }
1405 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1408 impl Clone for CVec_RawTaggedFieldZ {
1409 fn clone(&self) -> Self {
1410 let mut res = Vec::new();
1411 if self.datalen == 0 { return Self::from(res); }
1412 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1417 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
1418 /// This corresponds to std::vector in C++
1419 pub struct CVec_u5Z {
1420 /// The elements in the array.
1421 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1422 pub data: *mut crate::c_types::u5,
1423 /// The number of elements pointed to by `data`.
1427 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
1428 if self.datalen == 0 { return Vec::new(); }
1429 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1430 self.data = std::ptr::null_mut();
1434 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
1435 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1438 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
1439 fn from(v: Vec<crate::c_types::u5>) -> Self {
1440 let datalen = v.len();
1441 let data = Box::into_raw(v.into_boxed_slice());
1442 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1446 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1447 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
1448 impl Drop for CVec_u5Z {
1449 fn drop(&mut self) {
1450 if self.datalen == 0 { return; }
1451 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1454 impl Clone for CVec_u5Z {
1455 fn clone(&self) -> Self {
1456 let mut res = Vec::new();
1457 if self.datalen == 0 { return Self::from(res); }
1458 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1463 /// A dynamically-allocated array of u8s of arbitrary size.
1464 /// This corresponds to std::vector in C++
1465 pub struct CVec_u8Z {
1466 /// The elements in the array.
1467 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1469 /// The number of elements pointed to by `data`.
1473 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
1474 if self.datalen == 0 { return Vec::new(); }
1475 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1476 self.data = std::ptr::null_mut();
1480 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
1481 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1484 impl From<Vec<u8>> for CVec_u8Z {
1485 fn from(v: Vec<u8>) -> Self {
1486 let datalen = v.len();
1487 let data = Box::into_raw(v.into_boxed_slice());
1488 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1492 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1493 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
1494 impl Drop for CVec_u8Z {
1495 fn drop(&mut self) {
1496 if self.datalen == 0 { return; }
1497 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1500 impl Clone for CVec_u8Z {
1501 fn clone(&self) -> Self {
1502 let mut res = Vec::new();
1503 if self.datalen == 0 { return Self::from(res); }
1504 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1509 /// A tuple of 3 elements. See the individual fields for the types contained.
1510 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1511 /// The element at position 0
1512 pub a: crate::lightning_invoice::RawInvoice,
1513 /// The element at position 1
1514 pub b: crate::c_types::ThirtyTwoBytes,
1515 /// The element at position 2
1516 pub c: crate::lightning_invoice::InvoiceSignature,
1518 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1519 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
1527 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1528 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
1529 (self.a, self.b, self.c)
1532 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
1534 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 {
1535 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
1539 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
1540 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
1542 /// The contents of CResult_PayeePubKeyErrorZ
1543 pub union CResult_PayeePubKeyErrorZPtr {
1544 /// A pointer to the contents in the success state.
1545 /// Reading from this pointer when `result_ok` is not set is undefined.
1546 pub result: *mut crate::lightning_invoice::PayeePubKey,
1547 /// A pointer to the contents in the error state.
1548 /// Reading from this pointer when `result_ok` is set is undefined.
1549 pub err: *mut crate::c_types::Secp256k1Error,
1552 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
1553 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
1554 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1555 pub struct CResult_PayeePubKeyErrorZ {
1556 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
1557 /// `err` or `result` depending on the state of `result_ok`.
1558 pub contents: CResult_PayeePubKeyErrorZPtr,
1559 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
1560 pub result_ok: bool,
1563 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
1564 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
1565 CResult_PayeePubKeyErrorZ {
1566 contents: CResult_PayeePubKeyErrorZPtr {
1567 result: Box::into_raw(Box::new(o)),
1573 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
1574 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
1575 CResult_PayeePubKeyErrorZ {
1576 contents: CResult_PayeePubKeyErrorZPtr {
1577 err: Box::into_raw(Box::new(e)),
1583 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
1584 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
1585 impl Drop for CResult_PayeePubKeyErrorZ {
1586 fn drop(&mut self) {
1588 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1589 let _ = unsafe { Box::from_raw(self.contents.result) };
1592 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1593 let _ = unsafe { Box::from_raw(self.contents.err) };
1598 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
1599 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
1600 let contents = if o.result_ok {
1601 let result = unsafe { o.contents.result };
1602 unsafe { o.contents.result = std::ptr::null_mut() };
1603 CResult_PayeePubKeyErrorZPtr { result }
1605 let err = unsafe { o.contents.err };
1606 unsafe { o.contents.err = std::ptr::null_mut(); }
1607 CResult_PayeePubKeyErrorZPtr { err }
1611 result_ok: o.result_ok,
1616 /// A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
1617 /// This corresponds to std::vector in C++
1618 pub struct CVec_RouteHintZ {
1619 /// The elements in the array.
1620 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1621 pub data: *mut crate::lightning_invoice::RouteHint,
1622 /// The number of elements pointed to by `data`.
1625 impl CVec_RouteHintZ {
1626 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::RouteHint> {
1627 if self.datalen == 0 { return Vec::new(); }
1628 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1629 self.data = std::ptr::null_mut();
1633 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::RouteHint] {
1634 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1637 impl From<Vec<crate::lightning_invoice::RouteHint>> for CVec_RouteHintZ {
1638 fn from(v: Vec<crate::lightning_invoice::RouteHint>) -> Self {
1639 let datalen = v.len();
1640 let data = Box::into_raw(v.into_boxed_slice());
1641 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1645 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1646 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1647 impl Drop for CVec_RouteHintZ {
1648 fn drop(&mut self) {
1649 if self.datalen == 0 { return; }
1650 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1653 impl Clone for CVec_RouteHintZ {
1654 fn clone(&self) -> Self {
1655 let mut res = Vec::new();
1656 if self.datalen == 0 { return Self::from(res); }
1657 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1663 /// An enum which can either contain a u64 or not
1664 pub enum COption_u64Z {
1665 /// When we're in this state, this COption_u64Z contains a u64
1667 /// When we're in this state, this COption_u64Z contains nothing
1671 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1672 if let Self::Some(_) = self { true } else { false }
1674 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1675 if let Self::Some(v) = self { v } else { unreachable!() }
1679 /// Constructs a new COption_u64Z containing a u64
1680 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1681 COption_u64Z::Some(o)
1684 /// Constructs a new COption_u64Z containing nothing
1685 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1689 /// Frees any resources associated with the u64, if we are in the Some state
1690 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1692 /// Creates a new COption_u64Z which has the same data as `orig`
1693 /// but with all dynamically-allocated buffers duplicated in new buffers.
1694 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1696 /// The contents of CResult_PositiveTimestampCreationErrorZ
1697 pub union CResult_PositiveTimestampCreationErrorZPtr {
1698 /// A pointer to the contents in the success state.
1699 /// Reading from this pointer when `result_ok` is not set is undefined.
1700 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
1701 /// A pointer to the contents in the error state.
1702 /// Reading from this pointer when `result_ok` is set is undefined.
1703 pub err: *mut crate::lightning_invoice::CreationError,
1706 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
1707 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
1708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1709 pub struct CResult_PositiveTimestampCreationErrorZ {
1710 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
1711 /// `err` or `result` depending on the state of `result_ok`.
1712 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
1713 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
1714 pub result_ok: bool,
1717 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
1718 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
1719 CResult_PositiveTimestampCreationErrorZ {
1720 contents: CResult_PositiveTimestampCreationErrorZPtr {
1721 result: Box::into_raw(Box::new(o)),
1727 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
1728 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
1729 CResult_PositiveTimestampCreationErrorZ {
1730 contents: CResult_PositiveTimestampCreationErrorZPtr {
1731 err: Box::into_raw(Box::new(e)),
1737 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
1738 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
1739 impl Drop for CResult_PositiveTimestampCreationErrorZ {
1740 fn drop(&mut self) {
1742 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1743 let _ = unsafe { Box::from_raw(self.contents.result) };
1746 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1747 let _ = unsafe { Box::from_raw(self.contents.err) };
1752 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
1753 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
1754 let contents = if o.result_ok {
1755 let result = unsafe { o.contents.result };
1756 unsafe { o.contents.result = std::ptr::null_mut() };
1757 CResult_PositiveTimestampCreationErrorZPtr { result }
1759 let err = unsafe { o.contents.err };
1760 unsafe { o.contents.err = std::ptr::null_mut(); }
1761 CResult_PositiveTimestampCreationErrorZPtr { err }
1765 result_ok: o.result_ok,
1769 impl Clone for CResult_PositiveTimestampCreationErrorZ {
1770 fn clone(&self) -> Self {
1772 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
1773 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
1776 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
1777 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
1783 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
1784 /// but with all dynamically-allocated buffers duplicated in new buffers.
1785 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
1787 /// The contents of CResult_NoneSemanticErrorZ
1788 pub union CResult_NoneSemanticErrorZPtr {
1789 /// Note that this value is always NULL, as there are no contents in the OK variant
1790 pub result: *mut std::ffi::c_void,
1791 /// A pointer to the contents in the error state.
1792 /// Reading from this pointer when `result_ok` is set is undefined.
1793 pub err: *mut crate::lightning_invoice::SemanticError,
1796 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
1797 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
1798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1799 pub struct CResult_NoneSemanticErrorZ {
1800 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
1801 /// `err` or `result` depending on the state of `result_ok`.
1802 pub contents: CResult_NoneSemanticErrorZPtr,
1803 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
1804 pub result_ok: bool,
1807 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
1808 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
1809 CResult_NoneSemanticErrorZ {
1810 contents: CResult_NoneSemanticErrorZPtr {
1811 result: std::ptr::null_mut(),
1817 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
1818 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
1819 CResult_NoneSemanticErrorZ {
1820 contents: CResult_NoneSemanticErrorZPtr {
1821 err: Box::into_raw(Box::new(e)),
1827 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
1828 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
1829 impl Drop for CResult_NoneSemanticErrorZ {
1830 fn drop(&mut self) {
1833 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1834 let _ = unsafe { Box::from_raw(self.contents.err) };
1839 impl From<crate::c_types::CResultTempl<u8, crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
1840 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning_invoice::SemanticError>) -> Self {
1841 let contents = if o.result_ok {
1842 let _ = unsafe { Box::from_raw(o.contents.result) };
1843 o.contents.result = std::ptr::null_mut();
1844 CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
1846 let err = unsafe { o.contents.err };
1847 unsafe { o.contents.err = std::ptr::null_mut(); }
1848 CResult_NoneSemanticErrorZPtr { err }
1852 result_ok: o.result_ok,
1856 impl Clone for CResult_NoneSemanticErrorZ {
1857 fn clone(&self) -> Self {
1859 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
1860 result: std::ptr::null_mut()
1863 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
1864 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
1870 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
1871 /// but with all dynamically-allocated buffers duplicated in new buffers.
1872 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
1874 /// The contents of CResult_InvoiceSemanticErrorZ
1875 pub union CResult_InvoiceSemanticErrorZPtr {
1876 /// A pointer to the contents in the success state.
1877 /// Reading from this pointer when `result_ok` is not set is undefined.
1878 pub result: *mut crate::lightning_invoice::Invoice,
1879 /// A pointer to the contents in the error state.
1880 /// Reading from this pointer when `result_ok` is set is undefined.
1881 pub err: *mut crate::lightning_invoice::SemanticError,
1884 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
1885 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
1886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1887 pub struct CResult_InvoiceSemanticErrorZ {
1888 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
1889 /// `err` or `result` depending on the state of `result_ok`.
1890 pub contents: CResult_InvoiceSemanticErrorZPtr,
1891 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
1892 pub result_ok: bool,
1895 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
1896 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
1897 CResult_InvoiceSemanticErrorZ {
1898 contents: CResult_InvoiceSemanticErrorZPtr {
1899 result: Box::into_raw(Box::new(o)),
1905 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
1906 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
1907 CResult_InvoiceSemanticErrorZ {
1908 contents: CResult_InvoiceSemanticErrorZPtr {
1909 err: Box::into_raw(Box::new(e)),
1915 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
1916 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
1917 impl Drop for CResult_InvoiceSemanticErrorZ {
1918 fn drop(&mut self) {
1920 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1921 let _ = unsafe { Box::from_raw(self.contents.result) };
1924 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1925 let _ = unsafe { Box::from_raw(self.contents.err) };
1930 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
1931 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
1932 let contents = if o.result_ok {
1933 let result = unsafe { o.contents.result };
1934 unsafe { o.contents.result = std::ptr::null_mut() };
1935 CResult_InvoiceSemanticErrorZPtr { result }
1937 let err = unsafe { o.contents.err };
1938 unsafe { o.contents.err = std::ptr::null_mut(); }
1939 CResult_InvoiceSemanticErrorZPtr { err }
1943 result_ok: o.result_ok,
1947 impl Clone for CResult_InvoiceSemanticErrorZ {
1948 fn clone(&self) -> Self {
1950 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
1951 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
1954 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
1955 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
1961 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
1962 /// but with all dynamically-allocated buffers duplicated in new buffers.
1963 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
1965 /// The contents of CResult_DescriptionCreationErrorZ
1966 pub union CResult_DescriptionCreationErrorZPtr {
1967 /// A pointer to the contents in the success state.
1968 /// Reading from this pointer when `result_ok` is not set is undefined.
1969 pub result: *mut crate::lightning_invoice::Description,
1970 /// A pointer to the contents in the error state.
1971 /// Reading from this pointer when `result_ok` is set is undefined.
1972 pub err: *mut crate::lightning_invoice::CreationError,
1975 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
1976 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
1977 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1978 pub struct CResult_DescriptionCreationErrorZ {
1979 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
1980 /// `err` or `result` depending on the state of `result_ok`.
1981 pub contents: CResult_DescriptionCreationErrorZPtr,
1982 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
1983 pub result_ok: bool,
1986 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
1987 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
1988 CResult_DescriptionCreationErrorZ {
1989 contents: CResult_DescriptionCreationErrorZPtr {
1990 result: Box::into_raw(Box::new(o)),
1996 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
1997 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
1998 CResult_DescriptionCreationErrorZ {
1999 contents: CResult_DescriptionCreationErrorZPtr {
2000 err: Box::into_raw(Box::new(e)),
2006 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
2007 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
2008 impl Drop for CResult_DescriptionCreationErrorZ {
2009 fn drop(&mut self) {
2011 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2012 let _ = unsafe { Box::from_raw(self.contents.result) };
2015 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2016 let _ = unsafe { Box::from_raw(self.contents.err) };
2021 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
2022 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
2023 let contents = if o.result_ok {
2024 let result = unsafe { o.contents.result };
2025 unsafe { o.contents.result = std::ptr::null_mut() };
2026 CResult_DescriptionCreationErrorZPtr { result }
2028 let err = unsafe { o.contents.err };
2029 unsafe { o.contents.err = std::ptr::null_mut(); }
2030 CResult_DescriptionCreationErrorZPtr { err }
2034 result_ok: o.result_ok,
2038 impl Clone for CResult_DescriptionCreationErrorZ {
2039 fn clone(&self) -> Self {
2041 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
2042 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
2045 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
2046 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2052 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
2053 /// but with all dynamically-allocated buffers duplicated in new buffers.
2054 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
2056 /// The contents of CResult_ExpiryTimeCreationErrorZ
2057 pub union CResult_ExpiryTimeCreationErrorZPtr {
2058 /// A pointer to the contents in the success state.
2059 /// Reading from this pointer when `result_ok` is not set is undefined.
2060 pub result: *mut crate::lightning_invoice::ExpiryTime,
2061 /// A pointer to the contents in the error state.
2062 /// Reading from this pointer when `result_ok` is set is undefined.
2063 pub err: *mut crate::lightning_invoice::CreationError,
2066 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
2067 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
2068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2069 pub struct CResult_ExpiryTimeCreationErrorZ {
2070 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
2071 /// `err` or `result` depending on the state of `result_ok`.
2072 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
2073 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
2074 pub result_ok: bool,
2077 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
2078 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
2079 CResult_ExpiryTimeCreationErrorZ {
2080 contents: CResult_ExpiryTimeCreationErrorZPtr {
2081 result: Box::into_raw(Box::new(o)),
2087 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
2088 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
2089 CResult_ExpiryTimeCreationErrorZ {
2090 contents: CResult_ExpiryTimeCreationErrorZPtr {
2091 err: Box::into_raw(Box::new(e)),
2097 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
2098 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
2099 impl Drop for CResult_ExpiryTimeCreationErrorZ {
2100 fn drop(&mut self) {
2102 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2103 let _ = unsafe { Box::from_raw(self.contents.result) };
2106 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2107 let _ = unsafe { Box::from_raw(self.contents.err) };
2112 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
2113 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
2114 let contents = if o.result_ok {
2115 let result = unsafe { o.contents.result };
2116 unsafe { o.contents.result = std::ptr::null_mut() };
2117 CResult_ExpiryTimeCreationErrorZPtr { result }
2119 let err = unsafe { o.contents.err };
2120 unsafe { o.contents.err = std::ptr::null_mut(); }
2121 CResult_ExpiryTimeCreationErrorZPtr { err }
2125 result_ok: o.result_ok,
2129 impl Clone for CResult_ExpiryTimeCreationErrorZ {
2130 fn clone(&self) -> Self {
2132 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
2133 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
2136 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
2137 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2143 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
2144 /// but with all dynamically-allocated buffers duplicated in new buffers.
2145 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
2147 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2148 /// This corresponds to std::vector in C++
2149 pub struct CVec_RouteHintHopZ {
2150 /// The elements in the array.
2151 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2152 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2153 /// The number of elements pointed to by `data`.
2156 impl CVec_RouteHintHopZ {
2157 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2158 if self.datalen == 0 { return Vec::new(); }
2159 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2160 self.data = std::ptr::null_mut();
2164 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2165 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2168 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2169 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2170 let datalen = v.len();
2171 let data = Box::into_raw(v.into_boxed_slice());
2172 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2176 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2177 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2178 impl Drop for CVec_RouteHintHopZ {
2179 fn drop(&mut self) {
2180 if self.datalen == 0 { return; }
2181 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2184 impl Clone for CVec_RouteHintHopZ {
2185 fn clone(&self) -> Self {
2186 let mut res = Vec::new();
2187 if self.datalen == 0 { return Self::from(res); }
2188 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2193 /// The contents of CResult_RouteHintCreationErrorZ
2194 pub union CResult_RouteHintCreationErrorZPtr {
2195 /// A pointer to the contents in the success state.
2196 /// Reading from this pointer when `result_ok` is not set is undefined.
2197 pub result: *mut crate::lightning_invoice::RouteHint,
2198 /// A pointer to the contents in the error state.
2199 /// Reading from this pointer when `result_ok` is set is undefined.
2200 pub err: *mut crate::lightning_invoice::CreationError,
2203 /// A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
2204 /// containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
2205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2206 pub struct CResult_RouteHintCreationErrorZ {
2207 /// The contents of this CResult_RouteHintCreationErrorZ, accessible via either
2208 /// `err` or `result` depending on the state of `result_ok`.
2209 pub contents: CResult_RouteHintCreationErrorZPtr,
2210 /// Whether this CResult_RouteHintCreationErrorZ represents a success state.
2211 pub result_ok: bool,
2214 /// Creates a new CResult_RouteHintCreationErrorZ in the success state.
2215 pub extern "C" fn CResult_RouteHintCreationErrorZ_ok(o: crate::lightning_invoice::RouteHint) -> CResult_RouteHintCreationErrorZ {
2216 CResult_RouteHintCreationErrorZ {
2217 contents: CResult_RouteHintCreationErrorZPtr {
2218 result: Box::into_raw(Box::new(o)),
2224 /// Creates a new CResult_RouteHintCreationErrorZ in the error state.
2225 pub extern "C" fn CResult_RouteHintCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_RouteHintCreationErrorZ {
2226 CResult_RouteHintCreationErrorZ {
2227 contents: CResult_RouteHintCreationErrorZPtr {
2228 err: Box::into_raw(Box::new(e)),
2234 /// Frees any resources used by the CResult_RouteHintCreationErrorZ.
2235 pub extern "C" fn CResult_RouteHintCreationErrorZ_free(_res: CResult_RouteHintCreationErrorZ) { }
2236 impl Drop for CResult_RouteHintCreationErrorZ {
2237 fn drop(&mut self) {
2239 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2240 let _ = unsafe { Box::from_raw(self.contents.result) };
2243 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2244 let _ = unsafe { Box::from_raw(self.contents.err) };
2249 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>> for CResult_RouteHintCreationErrorZ {
2250 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>) -> Self {
2251 let contents = if o.result_ok {
2252 let result = unsafe { o.contents.result };
2253 unsafe { o.contents.result = std::ptr::null_mut() };
2254 CResult_RouteHintCreationErrorZPtr { result }
2256 let err = unsafe { o.contents.err };
2257 unsafe { o.contents.err = std::ptr::null_mut(); }
2258 CResult_RouteHintCreationErrorZPtr { err }
2262 result_ok: o.result_ok,
2266 impl Clone for CResult_RouteHintCreationErrorZ {
2267 fn clone(&self) -> Self {
2269 Self { result_ok: true, contents: CResult_RouteHintCreationErrorZPtr {
2270 result: Box::into_raw(Box::new(<crate::lightning_invoice::RouteHint>::clone(unsafe { &*self.contents.result })))
2273 Self { result_ok: false, contents: CResult_RouteHintCreationErrorZPtr {
2274 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2280 /// Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
2281 /// but with all dynamically-allocated buffers duplicated in new buffers.
2282 pub extern "C" fn CResult_RouteHintCreationErrorZ_clone(orig: &CResult_RouteHintCreationErrorZ) -> CResult_RouteHintCreationErrorZ { orig.clone() }
2284 /// The contents of CResult_StringErrorZ
2285 pub union CResult_StringErrorZPtr {
2286 /// A pointer to the contents in the success state.
2287 /// Reading from this pointer when `result_ok` is not set is undefined.
2288 pub result: *mut crate::c_types::derived::CVec_u8Z,
2289 /// A pointer to the contents in the error state.
2290 /// Reading from this pointer when `result_ok` is set is undefined.
2291 pub err: *mut crate::c_types::Secp256k1Error,
2294 /// A CResult_StringErrorZ represents the result of a fallible operation,
2295 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::Secp256k1Error on failure.
2296 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2297 pub struct CResult_StringErrorZ {
2298 /// The contents of this CResult_StringErrorZ, accessible via either
2299 /// `err` or `result` depending on the state of `result_ok`.
2300 pub contents: CResult_StringErrorZPtr,
2301 /// Whether this CResult_StringErrorZ represents a success state.
2302 pub result_ok: bool,
2305 /// Creates a new CResult_StringErrorZ in the success state.
2306 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_StringErrorZ {
2307 CResult_StringErrorZ {
2308 contents: CResult_StringErrorZPtr {
2309 result: Box::into_raw(Box::new(o)),
2315 /// Creates a new CResult_StringErrorZ in the error state.
2316 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
2317 CResult_StringErrorZ {
2318 contents: CResult_StringErrorZPtr {
2319 err: Box::into_raw(Box::new(e)),
2325 /// Frees any resources used by the CResult_StringErrorZ.
2326 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
2327 impl Drop for CResult_StringErrorZ {
2328 fn drop(&mut self) {
2330 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2331 let _ = unsafe { Box::from_raw(self.contents.result) };
2334 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2335 let _ = unsafe { Box::from_raw(self.contents.err) };
2340 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
2341 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::Secp256k1Error>) -> Self {
2342 let contents = if o.result_ok {
2343 let result = unsafe { o.contents.result };
2344 unsafe { o.contents.result = std::ptr::null_mut() };
2345 CResult_StringErrorZPtr { result }
2347 let err = unsafe { o.contents.err };
2348 unsafe { o.contents.err = std::ptr::null_mut(); }
2349 CResult_StringErrorZPtr { err }
2353 result_ok: o.result_ok,
2358 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
2359 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2360 /// A pointer to the contents in the success state.
2361 /// Reading from this pointer when `result_ok` is not set is undefined.
2362 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
2363 /// A pointer to the contents in the error state.
2364 /// Reading from this pointer when `result_ok` is set is undefined.
2365 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2368 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
2369 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2370 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2371 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
2372 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
2373 /// `err` or `result` depending on the state of `result_ok`.
2374 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
2375 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
2376 pub result_ok: bool,
2379 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
2380 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2381 CResult_ChannelMonitorUpdateDecodeErrorZ {
2382 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2383 result: Box::into_raw(Box::new(o)),
2389 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
2390 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2391 CResult_ChannelMonitorUpdateDecodeErrorZ {
2392 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2393 err: Box::into_raw(Box::new(e)),
2399 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
2400 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
2401 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
2402 fn drop(&mut self) {
2404 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2405 let _ = unsafe { Box::from_raw(self.contents.result) };
2408 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2409 let _ = unsafe { Box::from_raw(self.contents.err) };
2414 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
2415 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
2416 let contents = if o.result_ok {
2417 let result = unsafe { o.contents.result };
2418 unsafe { o.contents.result = std::ptr::null_mut() };
2419 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
2421 let err = unsafe { o.contents.err };
2422 unsafe { o.contents.err = std::ptr::null_mut(); }
2423 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
2427 result_ok: o.result_ok,
2431 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
2432 fn clone(&self) -> Self {
2434 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2435 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
2438 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2439 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2445 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
2446 /// but with all dynamically-allocated buffers duplicated in new buffers.
2447 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
2449 /// The contents of CResult_HTLCUpdateDecodeErrorZ
2450 pub union CResult_HTLCUpdateDecodeErrorZPtr {
2451 /// A pointer to the contents in the success state.
2452 /// Reading from this pointer when `result_ok` is not set is undefined.
2453 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
2454 /// A pointer to the contents in the error state.
2455 /// Reading from this pointer when `result_ok` is set is undefined.
2456 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2459 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
2460 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2462 pub struct CResult_HTLCUpdateDecodeErrorZ {
2463 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
2464 /// `err` or `result` depending on the state of `result_ok`.
2465 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
2466 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
2467 pub result_ok: bool,
2470 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
2471 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
2472 CResult_HTLCUpdateDecodeErrorZ {
2473 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2474 result: Box::into_raw(Box::new(o)),
2480 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
2481 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
2482 CResult_HTLCUpdateDecodeErrorZ {
2483 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2484 err: Box::into_raw(Box::new(e)),
2490 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
2491 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
2492 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
2493 fn drop(&mut self) {
2495 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2496 let _ = unsafe { Box::from_raw(self.contents.result) };
2499 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2500 let _ = unsafe { Box::from_raw(self.contents.err) };
2505 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
2506 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
2507 let contents = if o.result_ok {
2508 let result = unsafe { o.contents.result };
2509 unsafe { o.contents.result = std::ptr::null_mut() };
2510 CResult_HTLCUpdateDecodeErrorZPtr { result }
2512 let err = unsafe { o.contents.err };
2513 unsafe { o.contents.err = std::ptr::null_mut(); }
2514 CResult_HTLCUpdateDecodeErrorZPtr { err }
2518 result_ok: o.result_ok,
2522 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
2523 fn clone(&self) -> Self {
2525 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2526 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
2529 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2530 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2536 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
2537 /// but with all dynamically-allocated buffers duplicated in new buffers.
2538 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
2540 /// The contents of CResult_NoneMonitorUpdateErrorZ
2541 pub union CResult_NoneMonitorUpdateErrorZPtr {
2542 /// Note that this value is always NULL, as there are no contents in the OK variant
2543 pub result: *mut std::ffi::c_void,
2544 /// A pointer to the contents in the error state.
2545 /// Reading from this pointer when `result_ok` is set is undefined.
2546 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
2549 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
2550 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
2551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2552 pub struct CResult_NoneMonitorUpdateErrorZ {
2553 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
2554 /// `err` or `result` depending on the state of `result_ok`.
2555 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
2556 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
2557 pub result_ok: bool,
2560 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
2561 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
2562 CResult_NoneMonitorUpdateErrorZ {
2563 contents: CResult_NoneMonitorUpdateErrorZPtr {
2564 result: std::ptr::null_mut(),
2570 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
2571 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
2572 CResult_NoneMonitorUpdateErrorZ {
2573 contents: CResult_NoneMonitorUpdateErrorZPtr {
2574 err: Box::into_raw(Box::new(e)),
2580 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
2581 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
2582 impl Drop for CResult_NoneMonitorUpdateErrorZ {
2583 fn drop(&mut self) {
2586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2587 let _ = unsafe { Box::from_raw(self.contents.err) };
2592 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
2593 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
2594 let contents = if o.result_ok {
2595 let _ = unsafe { Box::from_raw(o.contents.result) };
2596 o.contents.result = std::ptr::null_mut();
2597 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
2599 let err = unsafe { o.contents.err };
2600 unsafe { o.contents.err = std::ptr::null_mut(); }
2601 CResult_NoneMonitorUpdateErrorZPtr { err }
2605 result_ok: o.result_ok,
2609 impl Clone for CResult_NoneMonitorUpdateErrorZ {
2610 fn clone(&self) -> Self {
2612 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
2613 result: std::ptr::null_mut()
2616 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
2617 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
2623 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
2624 /// but with all dynamically-allocated buffers duplicated in new buffers.
2625 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
2627 /// A tuple of 2 elements. See the individual fields for the types contained.
2628 pub struct C2Tuple_OutPointScriptZ {
2629 /// The element at position 0
2630 pub a: crate::lightning::chain::transaction::OutPoint,
2631 /// The element at position 1
2632 pub b: crate::c_types::derived::CVec_u8Z,
2634 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
2635 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
2642 impl C2Tuple_OutPointScriptZ {
2643 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
2647 impl Clone for C2Tuple_OutPointScriptZ {
2648 fn clone(&self) -> Self {
2656 /// Creates a new tuple which has the same data as `orig`
2657 /// but with all dynamically-allocated buffers duplicated in new buffers.
2658 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
2659 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
2661 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
2662 C2Tuple_OutPointScriptZ { a, b, }
2666 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
2667 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
2669 /// A tuple of 2 elements. See the individual fields for the types contained.
2670 pub struct C2Tuple_u32ScriptZ {
2671 /// The element at position 0
2673 /// The element at position 1
2674 pub b: crate::c_types::derived::CVec_u8Z,
2676 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
2677 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
2684 impl C2Tuple_u32ScriptZ {
2685 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
2689 impl Clone for C2Tuple_u32ScriptZ {
2690 fn clone(&self) -> Self {
2698 /// Creates a new tuple which has the same data as `orig`
2699 /// but with all dynamically-allocated buffers duplicated in new buffers.
2700 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
2701 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
2703 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
2704 C2Tuple_u32ScriptZ { a, b, }
2708 /// Frees any resources used by the C2Tuple_u32ScriptZ.
2709 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
2711 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
2712 /// This corresponds to std::vector in C++
2713 pub struct CVec_C2Tuple_u32ScriptZZ {
2714 /// The elements in the array.
2715 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2716 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
2717 /// The number of elements pointed to by `data`.
2720 impl CVec_C2Tuple_u32ScriptZZ {
2721 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
2722 if self.datalen == 0 { return Vec::new(); }
2723 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2724 self.data = std::ptr::null_mut();
2728 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
2729 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2732 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
2733 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
2734 let datalen = v.len();
2735 let data = Box::into_raw(v.into_boxed_slice());
2736 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2740 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2741 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
2742 impl Drop for CVec_C2Tuple_u32ScriptZZ {
2743 fn drop(&mut self) {
2744 if self.datalen == 0 { return; }
2745 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2748 impl Clone for CVec_C2Tuple_u32ScriptZZ {
2749 fn clone(&self) -> Self {
2750 let mut res = Vec::new();
2751 if self.datalen == 0 { return Self::from(res); }
2752 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2757 /// A tuple of 2 elements. See the individual fields for the types contained.
2758 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2759 /// The element at position 0
2760 pub a: crate::c_types::ThirtyTwoBytes,
2761 /// The element at position 1
2762 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
2764 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2765 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
2772 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2773 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
2777 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
2779 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 {
2780 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
2784 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
2785 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
2787 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
2788 /// This corresponds to std::vector in C++
2789 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2790 /// The elements in the array.
2791 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2792 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
2793 /// The number of elements pointed to by `data`.
2796 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2797 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
2798 if self.datalen == 0 { return Vec::new(); }
2799 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2800 self.data = std::ptr::null_mut();
2804 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
2805 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2808 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2809 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
2810 let datalen = v.len();
2811 let data = Box::into_raw(v.into_boxed_slice());
2812 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2816 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2817 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
2818 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2819 fn drop(&mut self) {
2820 if self.datalen == 0 { return; }
2821 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2825 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2826 /// This corresponds to std::vector in C++
2827 pub struct CVec_MonitorEventZ {
2828 /// The elements in the array.
2829 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2830 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2831 /// The number of elements pointed to by `data`.
2834 impl CVec_MonitorEventZ {
2835 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2836 if self.datalen == 0 { return Vec::new(); }
2837 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2838 self.data = std::ptr::null_mut();
2842 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2843 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2846 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2847 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2848 let datalen = v.len();
2849 let data = Box::into_raw(v.into_boxed_slice());
2850 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2854 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2855 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2856 impl Drop for CVec_MonitorEventZ {
2857 fn drop(&mut self) {
2858 if self.datalen == 0 { return; }
2859 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2862 impl Clone for CVec_MonitorEventZ {
2863 fn clone(&self) -> Self {
2864 let mut res = Vec::new();
2865 if self.datalen == 0 { return Self::from(res); }
2866 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2871 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
2872 /// This corresponds to std::vector in C++
2873 pub struct CVec_EventZ {
2874 /// The elements in the array.
2875 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2876 pub data: *mut crate::lightning::util::events::Event,
2877 /// The number of elements pointed to by `data`.
2881 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
2882 if self.datalen == 0 { return Vec::new(); }
2883 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2884 self.data = std::ptr::null_mut();
2888 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
2889 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2892 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
2893 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
2894 let datalen = v.len();
2895 let data = Box::into_raw(v.into_boxed_slice());
2896 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2900 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2901 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
2902 impl Drop for CVec_EventZ {
2903 fn drop(&mut self) {
2904 if self.datalen == 0 { return; }
2905 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2908 impl Clone for CVec_EventZ {
2909 fn clone(&self) -> Self {
2910 let mut res = Vec::new();
2911 if self.datalen == 0 { return Self::from(res); }
2912 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2917 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
2918 /// This corresponds to std::vector in C++
2919 pub struct CVec_TransactionZ {
2920 /// The elements in the array.
2921 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2922 pub data: *mut crate::c_types::Transaction,
2923 /// The number of elements pointed to by `data`.
2926 impl CVec_TransactionZ {
2927 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
2928 if self.datalen == 0 { return Vec::new(); }
2929 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2930 self.data = std::ptr::null_mut();
2934 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
2935 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2938 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
2939 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
2940 let datalen = v.len();
2941 let data = Box::into_raw(v.into_boxed_slice());
2942 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2946 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2947 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
2948 impl Drop for CVec_TransactionZ {
2949 fn drop(&mut self) {
2950 if self.datalen == 0 { return; }
2951 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2955 /// A tuple of 2 elements. See the individual fields for the types contained.
2956 pub struct C2Tuple_usizeTransactionZ {
2957 /// The element at position 0
2959 /// The element at position 1
2960 pub b: crate::c_types::Transaction,
2962 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2963 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2970 impl C2Tuple_usizeTransactionZ {
2971 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2975 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2977 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2978 C2Tuple_usizeTransactionZ { a, b, }
2982 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2983 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2985 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2986 /// This corresponds to std::vector in C++
2987 pub struct CVec_C2Tuple_usizeTransactionZZ {
2988 /// The elements in the array.
2989 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2990 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2991 /// The number of elements pointed to by `data`.
2994 impl CVec_C2Tuple_usizeTransactionZZ {
2995 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2996 if self.datalen == 0 { return Vec::new(); }
2997 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2998 self.data = std::ptr::null_mut();
3002 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3003 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3006 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3007 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3008 let datalen = v.len();
3009 let data = Box::into_raw(v.into_boxed_slice());
3010 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3015 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3016 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3017 fn drop(&mut self) {
3018 if self.datalen == 0 { return; }
3019 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3023 /// A tuple of 2 elements. See the individual fields for the types contained.
3024 pub struct C2Tuple_u32TxOutZ {
3025 /// The element at position 0
3027 /// The element at position 1
3028 pub b: crate::c_types::TxOut,
3030 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
3031 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
3038 impl C2Tuple_u32TxOutZ {
3039 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
3043 impl Clone for C2Tuple_u32TxOutZ {
3044 fn clone(&self) -> Self {
3052 /// Creates a new tuple which has the same data as `orig`
3053 /// but with all dynamically-allocated buffers duplicated in new buffers.
3054 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
3055 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
3057 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
3058 C2Tuple_u32TxOutZ { a, b, }
3062 /// Frees any resources used by the C2Tuple_u32TxOutZ.
3063 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
3065 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
3066 /// This corresponds to std::vector in C++
3067 pub struct CVec_C2Tuple_u32TxOutZZ {
3068 /// The elements in the array.
3069 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3070 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
3071 /// The number of elements pointed to by `data`.
3074 impl CVec_C2Tuple_u32TxOutZZ {
3075 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
3076 if self.datalen == 0 { return Vec::new(); }
3077 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3078 self.data = std::ptr::null_mut();
3082 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
3083 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3086 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
3087 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
3088 let datalen = v.len();
3089 let data = Box::into_raw(v.into_boxed_slice());
3090 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3094 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3095 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
3096 impl Drop for CVec_C2Tuple_u32TxOutZZ {
3097 fn drop(&mut self) {
3098 if self.datalen == 0 { return; }
3099 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3102 impl Clone for CVec_C2Tuple_u32TxOutZZ {
3103 fn clone(&self) -> Self {
3104 let mut res = Vec::new();
3105 if self.datalen == 0 { return Self::from(res); }
3106 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3111 /// A tuple of 2 elements. See the individual fields for the types contained.
3112 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3113 /// The element at position 0
3114 pub a: crate::c_types::ThirtyTwoBytes,
3115 /// The element at position 1
3116 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
3118 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3119 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
3126 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3127 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3131 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
3133 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 {
3134 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3138 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
3139 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3141 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
3142 /// This corresponds to std::vector in C++
3143 pub struct CVec_TransactionOutputsZ {
3144 /// The elements in the array.
3145 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3146 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3147 /// The number of elements pointed to by `data`.
3150 impl CVec_TransactionOutputsZ {
3151 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3152 if self.datalen == 0 { return Vec::new(); }
3153 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3154 self.data = std::ptr::null_mut();
3158 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3159 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3162 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
3163 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3164 let datalen = v.len();
3165 let data = Box::into_raw(v.into_boxed_slice());
3166 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3170 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3171 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
3172 impl Drop for CVec_TransactionOutputsZ {
3173 fn drop(&mut self) {
3174 if self.datalen == 0 { return; }
3175 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3179 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3180 /// This corresponds to std::vector in C++
3181 pub struct CVec_TxidZ {
3182 /// The elements in the array.
3183 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3184 pub data: *mut crate::c_types::ThirtyTwoBytes,
3185 /// The number of elements pointed to by `data`.
3189 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3190 if self.datalen == 0 { return Vec::new(); }
3191 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3192 self.data = std::ptr::null_mut();
3196 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3197 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3200 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3201 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3202 let datalen = v.len();
3203 let data = Box::into_raw(v.into_boxed_slice());
3204 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3208 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3209 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3210 impl Drop for CVec_TxidZ {
3211 fn drop(&mut self) {
3212 if self.datalen == 0 { return; }
3213 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3217 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3218 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3219 /// Note that this value is always NULL, as there are no contents in the OK variant
3220 pub result: *mut std::ffi::c_void,
3221 /// A pointer to the contents in the error state.
3222 /// Reading from this pointer when `result_ok` is set is undefined.
3223 pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
3226 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3227 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
3228 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3229 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3230 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3231 /// `err` or `result` depending on the state of `result_ok`.
3232 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3233 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3234 pub result_ok: bool,
3237 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3238 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3239 CResult_NoneChannelMonitorUpdateErrZ {
3240 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3241 result: std::ptr::null_mut(),
3247 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3248 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3249 CResult_NoneChannelMonitorUpdateErrZ {
3250 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3251 err: Box::into_raw(Box::new(e)),
3257 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3258 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3259 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3260 fn drop(&mut self) {
3263 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3264 let _ = unsafe { Box::from_raw(self.contents.err) };
3269 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3270 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
3271 let contents = if o.result_ok {
3272 let _ = unsafe { Box::from_raw(o.contents.result) };
3273 o.contents.result = std::ptr::null_mut();
3274 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
3276 let err = unsafe { o.contents.err };
3277 unsafe { o.contents.err = std::ptr::null_mut(); }
3278 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3282 result_ok: o.result_ok,
3286 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3287 fn clone(&self) -> Self {
3289 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3290 result: std::ptr::null_mut()
3293 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3294 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3300 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3301 /// but with all dynamically-allocated buffers duplicated in new buffers.
3302 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
3304 /// A tuple of 2 elements. See the individual fields for the types contained.
3305 pub struct C2Tuple_BlockHashChannelMonitorZ {
3306 /// The element at position 0
3307 pub a: crate::c_types::ThirtyTwoBytes,
3308 /// The element at position 1
3309 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3311 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3312 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3319 impl C2Tuple_BlockHashChannelMonitorZ {
3320 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3324 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3326 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3327 C2Tuple_BlockHashChannelMonitorZ { a, b, }
3331 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3332 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3334 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3335 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3336 /// A pointer to the contents in the success state.
3337 /// Reading from this pointer when `result_ok` is not set is undefined.
3338 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3339 /// A pointer to the contents in the error state.
3340 /// Reading from this pointer when `result_ok` is set is undefined.
3341 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3344 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
3345 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3347 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3348 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
3349 /// `err` or `result` depending on the state of `result_ok`.
3350 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
3351 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
3352 pub result_ok: bool,
3355 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
3356 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3357 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3358 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3359 result: Box::into_raw(Box::new(o)),
3365 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
3366 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3367 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3368 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3369 err: Box::into_raw(Box::new(e)),
3375 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
3376 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
3377 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3378 fn drop(&mut self) {
3380 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3381 let _ = unsafe { Box::from_raw(self.contents.result) };
3384 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3385 let _ = unsafe { Box::from_raw(self.contents.err) };
3390 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3391 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3392 let contents = if o.result_ok {
3393 let result = unsafe { o.contents.result };
3394 unsafe { o.contents.result = std::ptr::null_mut() };
3395 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
3397 let err = unsafe { o.contents.err };
3398 unsafe { o.contents.err = std::ptr::null_mut(); }
3399 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
3403 result_ok: o.result_ok,
3408 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3409 /// This corresponds to std::vector in C++
3410 pub struct CVec_RouteHopZ {
3411 /// The elements in the array.
3412 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3413 pub data: *mut crate::lightning::routing::router::RouteHop,
3414 /// The number of elements pointed to by `data`.
3417 impl CVec_RouteHopZ {
3418 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3419 if self.datalen == 0 { return Vec::new(); }
3420 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3421 self.data = std::ptr::null_mut();
3425 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3426 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3429 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3430 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3431 let datalen = v.len();
3432 let data = Box::into_raw(v.into_boxed_slice());
3433 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3437 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3438 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3439 impl Drop for CVec_RouteHopZ {
3440 fn drop(&mut self) {
3441 if self.datalen == 0 { return; }
3442 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3445 impl Clone for CVec_RouteHopZ {
3446 fn clone(&self) -> Self {
3447 let mut res = Vec::new();
3448 if self.datalen == 0 { return Self::from(res); }
3449 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3454 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3455 /// This corresponds to std::vector in C++
3456 pub struct CVec_CVec_RouteHopZZ {
3457 /// The elements in the array.
3458 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3459 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3460 /// The number of elements pointed to by `data`.
3463 impl CVec_CVec_RouteHopZZ {
3464 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3465 if self.datalen == 0 { return Vec::new(); }
3466 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3467 self.data = std::ptr::null_mut();
3471 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3472 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3475 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3476 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3477 let datalen = v.len();
3478 let data = Box::into_raw(v.into_boxed_slice());
3479 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3483 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3484 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3485 impl Drop for CVec_CVec_RouteHopZZ {
3486 fn drop(&mut self) {
3487 if self.datalen == 0 { return; }
3488 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3491 impl Clone for CVec_CVec_RouteHopZZ {
3492 fn clone(&self) -> Self {
3493 let mut res = Vec::new();
3494 if self.datalen == 0 { return Self::from(res); }
3495 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3500 /// The contents of CResult_RouteDecodeErrorZ
3501 pub union CResult_RouteDecodeErrorZPtr {
3502 /// A pointer to the contents in the success state.
3503 /// Reading from this pointer when `result_ok` is not set is undefined.
3504 pub result: *mut crate::lightning::routing::router::Route,
3505 /// A pointer to the contents in the error state.
3506 /// Reading from this pointer when `result_ok` is set is undefined.
3507 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3510 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3511 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3513 pub struct CResult_RouteDecodeErrorZ {
3514 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3515 /// `err` or `result` depending on the state of `result_ok`.
3516 pub contents: CResult_RouteDecodeErrorZPtr,
3517 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3518 pub result_ok: bool,
3521 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3522 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3523 CResult_RouteDecodeErrorZ {
3524 contents: CResult_RouteDecodeErrorZPtr {
3525 result: Box::into_raw(Box::new(o)),
3531 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3532 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3533 CResult_RouteDecodeErrorZ {
3534 contents: CResult_RouteDecodeErrorZPtr {
3535 err: Box::into_raw(Box::new(e)),
3541 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3542 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3543 impl Drop for CResult_RouteDecodeErrorZ {
3544 fn drop(&mut self) {
3546 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3547 let _ = unsafe { Box::from_raw(self.contents.result) };
3550 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3551 let _ = unsafe { Box::from_raw(self.contents.err) };
3556 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3557 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3558 let contents = if o.result_ok {
3559 let result = unsafe { o.contents.result };
3560 unsafe { o.contents.result = std::ptr::null_mut() };
3561 CResult_RouteDecodeErrorZPtr { result }
3563 let err = unsafe { o.contents.err };
3564 unsafe { o.contents.err = std::ptr::null_mut(); }
3565 CResult_RouteDecodeErrorZPtr { err }
3569 result_ok: o.result_ok,
3573 impl Clone for CResult_RouteDecodeErrorZ {
3574 fn clone(&self) -> Self {
3576 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3577 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3580 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3581 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3587 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3588 /// but with all dynamically-allocated buffers duplicated in new buffers.
3589 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
3591 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3592 /// This corresponds to std::vector in C++
3593 pub struct CVec_ChannelDetailsZ {
3594 /// The elements in the array.
3595 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3596 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3597 /// The number of elements pointed to by `data`.
3600 impl CVec_ChannelDetailsZ {
3601 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3602 if self.datalen == 0 { return Vec::new(); }
3603 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3604 self.data = std::ptr::null_mut();
3608 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3609 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3612 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3613 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3614 let datalen = v.len();
3615 let data = Box::into_raw(v.into_boxed_slice());
3616 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3620 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3621 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3622 impl Drop for CVec_ChannelDetailsZ {
3623 fn drop(&mut self) {
3624 if self.datalen == 0 { return; }
3625 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3628 impl Clone for CVec_ChannelDetailsZ {
3629 fn clone(&self) -> Self {
3630 let mut res = Vec::new();
3631 if self.datalen == 0 { return Self::from(res); }
3632 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3637 /// The contents of CResult_RouteLightningErrorZ
3638 pub union CResult_RouteLightningErrorZPtr {
3639 /// A pointer to the contents in the success state.
3640 /// Reading from this pointer when `result_ok` is not set is undefined.
3641 pub result: *mut crate::lightning::routing::router::Route,
3642 /// A pointer to the contents in the error state.
3643 /// Reading from this pointer when `result_ok` is set is undefined.
3644 pub err: *mut crate::lightning::ln::msgs::LightningError,
3647 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3648 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3649 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3650 pub struct CResult_RouteLightningErrorZ {
3651 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3652 /// `err` or `result` depending on the state of `result_ok`.
3653 pub contents: CResult_RouteLightningErrorZPtr,
3654 /// Whether this CResult_RouteLightningErrorZ represents a success state.
3655 pub result_ok: bool,
3658 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3659 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3660 CResult_RouteLightningErrorZ {
3661 contents: CResult_RouteLightningErrorZPtr {
3662 result: Box::into_raw(Box::new(o)),
3668 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3669 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3670 CResult_RouteLightningErrorZ {
3671 contents: CResult_RouteLightningErrorZPtr {
3672 err: Box::into_raw(Box::new(e)),
3678 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3679 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3680 impl Drop for CResult_RouteLightningErrorZ {
3681 fn drop(&mut self) {
3683 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3684 let _ = unsafe { Box::from_raw(self.contents.result) };
3687 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3688 let _ = unsafe { Box::from_raw(self.contents.err) };
3693 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3694 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3695 let contents = if o.result_ok {
3696 let result = unsafe { o.contents.result };
3697 unsafe { o.contents.result = std::ptr::null_mut() };
3698 CResult_RouteLightningErrorZPtr { result }
3700 let err = unsafe { o.contents.err };
3701 unsafe { o.contents.err = std::ptr::null_mut(); }
3702 CResult_RouteLightningErrorZPtr { err }
3706 result_ok: o.result_ok,
3710 impl Clone for CResult_RouteLightningErrorZ {
3711 fn clone(&self) -> Self {
3713 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3714 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3717 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3718 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3724 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3725 /// but with all dynamically-allocated buffers duplicated in new buffers.
3726 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
3728 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3729 /// This corresponds to std::vector in C++
3730 pub struct CVec_MessageSendEventZ {
3731 /// The elements in the array.
3732 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3733 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3734 /// The number of elements pointed to by `data`.
3737 impl CVec_MessageSendEventZ {
3738 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3739 if self.datalen == 0 { return Vec::new(); }
3740 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3741 self.data = std::ptr::null_mut();
3745 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3746 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3749 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3750 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3751 let datalen = v.len();
3752 let data = Box::into_raw(v.into_boxed_slice());
3753 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3757 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3758 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3759 impl Drop for CVec_MessageSendEventZ {
3760 fn drop(&mut self) {
3761 if self.datalen == 0 { return; }
3762 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3765 impl Clone for CVec_MessageSendEventZ {
3766 fn clone(&self) -> Self {
3767 let mut res = Vec::new();
3768 if self.datalen == 0 { return Self::from(res); }
3769 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3774 /// The contents of CResult_boolLightningErrorZ
3775 pub union CResult_boolLightningErrorZPtr {
3776 /// A pointer to the contents in the success state.
3777 /// Reading from this pointer when `result_ok` is not set is undefined.
3778 pub result: *mut bool,
3779 /// A pointer to the contents in the error state.
3780 /// Reading from this pointer when `result_ok` is set is undefined.
3781 pub err: *mut crate::lightning::ln::msgs::LightningError,
3784 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
3785 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
3786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3787 pub struct CResult_boolLightningErrorZ {
3788 /// The contents of this CResult_boolLightningErrorZ, accessible via either
3789 /// `err` or `result` depending on the state of `result_ok`.
3790 pub contents: CResult_boolLightningErrorZPtr,
3791 /// Whether this CResult_boolLightningErrorZ represents a success state.
3792 pub result_ok: bool,
3795 /// Creates a new CResult_boolLightningErrorZ in the success state.
3796 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
3797 CResult_boolLightningErrorZ {
3798 contents: CResult_boolLightningErrorZPtr {
3799 result: Box::into_raw(Box::new(o)),
3805 /// Creates a new CResult_boolLightningErrorZ in the error state.
3806 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
3807 CResult_boolLightningErrorZ {
3808 contents: CResult_boolLightningErrorZPtr {
3809 err: Box::into_raw(Box::new(e)),
3815 /// Frees any resources used by the CResult_boolLightningErrorZ.
3816 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
3817 impl Drop for CResult_boolLightningErrorZ {
3818 fn drop(&mut self) {
3820 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3821 let _ = unsafe { Box::from_raw(self.contents.result) };
3824 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3825 let _ = unsafe { Box::from_raw(self.contents.err) };
3830 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
3831 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
3832 let contents = if o.result_ok {
3833 let result = unsafe { o.contents.result };
3834 unsafe { o.contents.result = std::ptr::null_mut() };
3835 CResult_boolLightningErrorZPtr { result }
3837 let err = unsafe { o.contents.err };
3838 unsafe { o.contents.err = std::ptr::null_mut(); }
3839 CResult_boolLightningErrorZPtr { err }
3843 result_ok: o.result_ok,
3847 impl Clone for CResult_boolLightningErrorZ {
3848 fn clone(&self) -> Self {
3850 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
3851 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
3854 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
3855 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3861 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
3862 /// but with all dynamically-allocated buffers duplicated in new buffers.
3863 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
3865 /// A tuple of 3 elements. See the individual fields for the types contained.
3866 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3867 /// The element at position 0
3868 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
3869 /// The element at position 1
3870 pub b: crate::lightning::ln::msgs::ChannelUpdate,
3871 /// The element at position 2
3872 pub c: crate::lightning::ln::msgs::ChannelUpdate,
3874 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3875 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
3883 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3884 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
3885 (self.a, self.b, self.c)
3888 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3889 fn clone(&self) -> Self {
3898 /// Creates a new tuple which has the same data as `orig`
3899 /// but with all dynamically-allocated buffers duplicated in new buffers.
3900 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
3901 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
3903 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 {
3904 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
3908 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
3909 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
3911 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
3912 /// This corresponds to std::vector in C++
3913 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3914 /// The elements in the array.
3915 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3916 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
3917 /// The number of elements pointed to by `data`.
3920 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3921 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
3922 if self.datalen == 0 { return Vec::new(); }
3923 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3924 self.data = std::ptr::null_mut();
3928 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
3929 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3932 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3933 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
3934 let datalen = v.len();
3935 let data = Box::into_raw(v.into_boxed_slice());
3936 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3940 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3941 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
3942 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3943 fn drop(&mut self) {
3944 if self.datalen == 0 { return; }
3945 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3948 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3949 fn clone(&self) -> Self {
3950 let mut res = Vec::new();
3951 if self.datalen == 0 { return Self::from(res); }
3952 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3957 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
3958 /// This corresponds to std::vector in C++
3959 pub struct CVec_NodeAnnouncementZ {
3960 /// The elements in the array.
3961 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3962 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
3963 /// The number of elements pointed to by `data`.
3966 impl CVec_NodeAnnouncementZ {
3967 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
3968 if self.datalen == 0 { return Vec::new(); }
3969 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3970 self.data = std::ptr::null_mut();
3974 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
3975 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3978 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
3979 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
3980 let datalen = v.len();
3981 let data = Box::into_raw(v.into_boxed_slice());
3982 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3986 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3987 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
3988 impl Drop for CVec_NodeAnnouncementZ {
3989 fn drop(&mut self) {
3990 if self.datalen == 0 { return; }
3991 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3994 impl Clone for CVec_NodeAnnouncementZ {
3995 fn clone(&self) -> Self {
3996 let mut res = Vec::new();
3997 if self.datalen == 0 { return Self::from(res); }
3998 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4003 /// The contents of CResult_NoneLightningErrorZ
4004 pub union CResult_NoneLightningErrorZPtr {
4005 /// Note that this value is always NULL, as there are no contents in the OK variant
4006 pub result: *mut std::ffi::c_void,
4007 /// A pointer to the contents in the error state.
4008 /// Reading from this pointer when `result_ok` is set is undefined.
4009 pub err: *mut crate::lightning::ln::msgs::LightningError,
4012 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4013 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4015 pub struct CResult_NoneLightningErrorZ {
4016 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
4017 /// `err` or `result` depending on the state of `result_ok`.
4018 pub contents: CResult_NoneLightningErrorZPtr,
4019 /// Whether this CResult_NoneLightningErrorZ represents a success state.
4020 pub result_ok: bool,
4023 /// Creates a new CResult_NoneLightningErrorZ in the success state.
4024 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
4025 CResult_NoneLightningErrorZ {
4026 contents: CResult_NoneLightningErrorZPtr {
4027 result: std::ptr::null_mut(),
4033 /// Creates a new CResult_NoneLightningErrorZ in the error state.
4034 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
4035 CResult_NoneLightningErrorZ {
4036 contents: CResult_NoneLightningErrorZPtr {
4037 err: Box::into_raw(Box::new(e)),
4043 /// Frees any resources used by the CResult_NoneLightningErrorZ.
4044 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
4045 impl Drop for CResult_NoneLightningErrorZ {
4046 fn drop(&mut self) {
4049 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4050 let _ = unsafe { Box::from_raw(self.contents.err) };
4055 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
4056 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>) -> Self {
4057 let contents = if o.result_ok {
4058 let _ = unsafe { Box::from_raw(o.contents.result) };
4059 o.contents.result = std::ptr::null_mut();
4060 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
4062 let err = unsafe { o.contents.err };
4063 unsafe { o.contents.err = std::ptr::null_mut(); }
4064 CResult_NoneLightningErrorZPtr { err }
4068 result_ok: o.result_ok,
4072 impl Clone for CResult_NoneLightningErrorZ {
4073 fn clone(&self) -> Self {
4075 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
4076 result: std::ptr::null_mut()
4079 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
4080 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4086 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
4087 /// but with all dynamically-allocated buffers duplicated in new buffers.
4088 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
4090 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4091 /// This corresponds to std::vector in C++
4092 pub struct CVec_PublicKeyZ {
4093 /// The elements in the array.
4094 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4095 pub data: *mut crate::c_types::PublicKey,
4096 /// The number of elements pointed to by `data`.
4099 impl CVec_PublicKeyZ {
4100 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4101 if self.datalen == 0 { return Vec::new(); }
4102 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4103 self.data = std::ptr::null_mut();
4107 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4108 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4111 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4112 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4113 let datalen = v.len();
4114 let data = Box::into_raw(v.into_boxed_slice());
4115 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4119 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4120 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4121 impl Drop for CVec_PublicKeyZ {
4122 fn drop(&mut self) {
4123 if self.datalen == 0 { return; }
4124 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4128 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
4129 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
4130 /// A pointer to the contents in the success state.
4131 /// Reading from this pointer when `result_ok` is not set is undefined.
4132 pub result: *mut crate::c_types::derived::CVec_u8Z,
4133 /// A pointer to the contents in the error state.
4134 /// Reading from this pointer when `result_ok` is set is undefined.
4135 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4138 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4139 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4141 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
4142 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4143 /// `err` or `result` depending on the state of `result_ok`.
4144 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
4145 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4146 pub result_ok: bool,
4149 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
4150 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
4151 CResult_CVec_u8ZPeerHandleErrorZ {
4152 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4153 result: Box::into_raw(Box::new(o)),
4159 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
4160 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
4161 CResult_CVec_u8ZPeerHandleErrorZ {
4162 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4163 err: Box::into_raw(Box::new(e)),
4169 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
4170 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
4171 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
4172 fn drop(&mut self) {
4174 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4175 let _ = unsafe { Box::from_raw(self.contents.result) };
4178 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4179 let _ = unsafe { Box::from_raw(self.contents.err) };
4184 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
4185 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4186 let contents = if o.result_ok {
4187 let result = unsafe { o.contents.result };
4188 unsafe { o.contents.result = std::ptr::null_mut() };
4189 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
4191 let err = unsafe { o.contents.err };
4192 unsafe { o.contents.err = std::ptr::null_mut(); }
4193 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
4197 result_ok: o.result_ok,
4201 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
4202 fn clone(&self) -> Self {
4204 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4205 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
4208 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4209 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4215 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
4216 /// but with all dynamically-allocated buffers duplicated in new buffers.
4217 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
4219 /// The contents of CResult_NonePeerHandleErrorZ
4220 pub union CResult_NonePeerHandleErrorZPtr {
4221 /// Note that this value is always NULL, as there are no contents in the OK variant
4222 pub result: *mut std::ffi::c_void,
4223 /// A pointer to the contents in the error state.
4224 /// Reading from this pointer when `result_ok` is set is undefined.
4225 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4228 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4229 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4231 pub struct CResult_NonePeerHandleErrorZ {
4232 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4233 /// `err` or `result` depending on the state of `result_ok`.
4234 pub contents: CResult_NonePeerHandleErrorZPtr,
4235 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
4236 pub result_ok: bool,
4239 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
4240 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
4241 CResult_NonePeerHandleErrorZ {
4242 contents: CResult_NonePeerHandleErrorZPtr {
4243 result: std::ptr::null_mut(),
4249 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
4250 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
4251 CResult_NonePeerHandleErrorZ {
4252 contents: CResult_NonePeerHandleErrorZPtr {
4253 err: Box::into_raw(Box::new(e)),
4259 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
4260 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
4261 impl Drop for CResult_NonePeerHandleErrorZ {
4262 fn drop(&mut self) {
4265 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4266 let _ = unsafe { Box::from_raw(self.contents.err) };
4271 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
4272 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4273 let contents = if o.result_ok {
4274 let _ = unsafe { Box::from_raw(o.contents.result) };
4275 o.contents.result = std::ptr::null_mut();
4276 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
4278 let err = unsafe { o.contents.err };
4279 unsafe { o.contents.err = std::ptr::null_mut(); }
4280 CResult_NonePeerHandleErrorZPtr { err }
4284 result_ok: o.result_ok,
4288 impl Clone for CResult_NonePeerHandleErrorZ {
4289 fn clone(&self) -> Self {
4291 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
4292 result: std::ptr::null_mut()
4295 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
4296 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4302 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
4303 /// but with all dynamically-allocated buffers duplicated in new buffers.
4304 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
4306 /// The contents of CResult_boolPeerHandleErrorZ
4307 pub union CResult_boolPeerHandleErrorZPtr {
4308 /// A pointer to the contents in the success state.
4309 /// Reading from this pointer when `result_ok` is not set is undefined.
4310 pub result: *mut bool,
4311 /// A pointer to the contents in the error state.
4312 /// Reading from this pointer when `result_ok` is set is undefined.
4313 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4316 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4317 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4319 pub struct CResult_boolPeerHandleErrorZ {
4320 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4321 /// `err` or `result` depending on the state of `result_ok`.
4322 pub contents: CResult_boolPeerHandleErrorZPtr,
4323 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
4324 pub result_ok: bool,
4327 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
4328 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
4329 CResult_boolPeerHandleErrorZ {
4330 contents: CResult_boolPeerHandleErrorZPtr {
4331 result: Box::into_raw(Box::new(o)),
4337 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
4338 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
4339 CResult_boolPeerHandleErrorZ {
4340 contents: CResult_boolPeerHandleErrorZPtr {
4341 err: Box::into_raw(Box::new(e)),
4347 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
4348 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
4349 impl Drop for CResult_boolPeerHandleErrorZ {
4350 fn drop(&mut self) {
4352 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4353 let _ = unsafe { Box::from_raw(self.contents.result) };
4356 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4357 let _ = unsafe { Box::from_raw(self.contents.err) };
4362 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
4363 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4364 let contents = if o.result_ok {
4365 let result = unsafe { o.contents.result };
4366 unsafe { o.contents.result = std::ptr::null_mut() };
4367 CResult_boolPeerHandleErrorZPtr { result }
4369 let err = unsafe { o.contents.err };
4370 unsafe { o.contents.err = std::ptr::null_mut(); }
4371 CResult_boolPeerHandleErrorZPtr { err }
4375 result_ok: o.result_ok,
4379 impl Clone for CResult_boolPeerHandleErrorZ {
4380 fn clone(&self) -> Self {
4382 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
4383 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4386 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
4387 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4393 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
4394 /// but with all dynamically-allocated buffers duplicated in new buffers.
4395 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
4397 /// The contents of CResult_TxOutAccessErrorZ
4398 pub union CResult_TxOutAccessErrorZPtr {
4399 /// A pointer to the contents in the success state.
4400 /// Reading from this pointer when `result_ok` is not set is undefined.
4401 pub result: *mut crate::c_types::TxOut,
4402 /// A pointer to the contents in the error state.
4403 /// Reading from this pointer when `result_ok` is set is undefined.
4404 pub err: *mut crate::lightning::chain::AccessError,
4407 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4408 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4410 pub struct CResult_TxOutAccessErrorZ {
4411 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
4412 /// `err` or `result` depending on the state of `result_ok`.
4413 pub contents: CResult_TxOutAccessErrorZPtr,
4414 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
4415 pub result_ok: bool,
4418 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
4419 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
4420 CResult_TxOutAccessErrorZ {
4421 contents: CResult_TxOutAccessErrorZPtr {
4422 result: Box::into_raw(Box::new(o)),
4428 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
4429 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
4430 CResult_TxOutAccessErrorZ {
4431 contents: CResult_TxOutAccessErrorZPtr {
4432 err: Box::into_raw(Box::new(e)),
4438 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
4439 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
4440 impl Drop for CResult_TxOutAccessErrorZ {
4441 fn drop(&mut self) {
4443 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4444 let _ = unsafe { Box::from_raw(self.contents.result) };
4447 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4448 let _ = unsafe { Box::from_raw(self.contents.err) };
4453 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
4454 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
4455 let contents = if o.result_ok {
4456 let result = unsafe { o.contents.result };
4457 unsafe { o.contents.result = std::ptr::null_mut() };
4458 CResult_TxOutAccessErrorZPtr { result }
4460 let err = unsafe { o.contents.err };
4461 unsafe { o.contents.err = std::ptr::null_mut(); }
4462 CResult_TxOutAccessErrorZPtr { err }
4466 result_ok: o.result_ok,
4470 impl Clone for CResult_TxOutAccessErrorZ {
4471 fn clone(&self) -> Self {
4473 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
4474 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
4477 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
4478 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
4484 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
4485 /// but with all dynamically-allocated buffers duplicated in new buffers.
4486 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
4488 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4489 pub enum COption_C2Tuple_usizeTransactionZZ {
4490 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4491 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4492 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4495 impl COption_C2Tuple_usizeTransactionZZ {
4496 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4497 if let Self::Some(_) = self { true } else { false }
4499 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4500 if let Self::Some(v) = self { v } else { unreachable!() }
4504 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4505 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4506 COption_C2Tuple_usizeTransactionZZ::Some(o)
4509 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4510 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4511 COption_C2Tuple_usizeTransactionZZ::None
4514 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4515 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4517 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4518 /// This corresponds to std::vector in C++
4519 pub struct CVec_SpendableOutputDescriptorZ {
4520 /// The elements in the array.
4521 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4522 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4523 /// The number of elements pointed to by `data`.
4526 impl CVec_SpendableOutputDescriptorZ {
4527 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
4528 if self.datalen == 0 { return Vec::new(); }
4529 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4530 self.data = std::ptr::null_mut();
4534 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
4535 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4538 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
4539 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
4540 let datalen = v.len();
4541 let data = Box::into_raw(v.into_boxed_slice());
4542 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4546 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4547 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
4548 impl Drop for CVec_SpendableOutputDescriptorZ {
4549 fn drop(&mut self) {
4550 if self.datalen == 0 { return; }
4551 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4554 impl Clone for CVec_SpendableOutputDescriptorZ {
4555 fn clone(&self) -> Self {
4556 let mut res = Vec::new();
4557 if self.datalen == 0 { return Self::from(res); }
4558 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4563 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4564 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
4565 /// A pointer to the contents in the success state.
4566 /// Reading from this pointer when `result_ok` is not set is undefined.
4567 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
4568 /// A pointer to the contents in the error state.
4569 /// Reading from this pointer when `result_ok` is set is undefined.
4570 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4573 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4574 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4576 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
4577 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4578 /// `err` or `result` depending on the state of `result_ok`.
4579 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
4580 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4581 pub result_ok: bool,
4584 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
4585 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4586 CResult_DirectionalChannelInfoDecodeErrorZ {
4587 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4588 result: Box::into_raw(Box::new(o)),
4594 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
4595 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4596 CResult_DirectionalChannelInfoDecodeErrorZ {
4597 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4598 err: Box::into_raw(Box::new(e)),
4604 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
4605 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
4606 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
4607 fn drop(&mut self) {
4609 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4610 let _ = unsafe { Box::from_raw(self.contents.result) };
4613 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4614 let _ = unsafe { Box::from_raw(self.contents.err) };
4619 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
4620 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4621 let contents = if o.result_ok {
4622 let result = unsafe { o.contents.result };
4623 unsafe { o.contents.result = std::ptr::null_mut() };
4624 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
4626 let err = unsafe { o.contents.err };
4627 unsafe { o.contents.err = std::ptr::null_mut(); }
4628 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
4632 result_ok: o.result_ok,
4636 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
4637 fn clone(&self) -> Self {
4639 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4640 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
4643 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4644 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4650 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
4651 /// but with all dynamically-allocated buffers duplicated in new buffers.
4652 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
4654 /// The contents of CResult_ChannelInfoDecodeErrorZ
4655 pub union CResult_ChannelInfoDecodeErrorZPtr {
4656 /// A pointer to the contents in the success state.
4657 /// Reading from this pointer when `result_ok` is not set is undefined.
4658 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
4659 /// A pointer to the contents in the error state.
4660 /// Reading from this pointer when `result_ok` is set is undefined.
4661 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4664 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4665 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4667 pub struct CResult_ChannelInfoDecodeErrorZ {
4668 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4669 /// `err` or `result` depending on the state of `result_ok`.
4670 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
4671 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4672 pub result_ok: bool,
4675 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
4676 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
4677 CResult_ChannelInfoDecodeErrorZ {
4678 contents: CResult_ChannelInfoDecodeErrorZPtr {
4679 result: Box::into_raw(Box::new(o)),
4685 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
4686 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
4687 CResult_ChannelInfoDecodeErrorZ {
4688 contents: CResult_ChannelInfoDecodeErrorZPtr {
4689 err: Box::into_raw(Box::new(e)),
4695 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
4696 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
4697 impl Drop for CResult_ChannelInfoDecodeErrorZ {
4698 fn drop(&mut self) {
4700 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4701 let _ = unsafe { Box::from_raw(self.contents.result) };
4704 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4705 let _ = unsafe { Box::from_raw(self.contents.err) };
4710 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
4711 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4712 let contents = if o.result_ok {
4713 let result = unsafe { o.contents.result };
4714 unsafe { o.contents.result = std::ptr::null_mut() };
4715 CResult_ChannelInfoDecodeErrorZPtr { result }
4717 let err = unsafe { o.contents.err };
4718 unsafe { o.contents.err = std::ptr::null_mut(); }
4719 CResult_ChannelInfoDecodeErrorZPtr { err }
4723 result_ok: o.result_ok,
4727 impl Clone for CResult_ChannelInfoDecodeErrorZ {
4728 fn clone(&self) -> Self {
4730 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
4731 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
4734 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
4735 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4741 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
4742 /// but with all dynamically-allocated buffers duplicated in new buffers.
4743 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
4745 /// The contents of CResult_RoutingFeesDecodeErrorZ
4746 pub union CResult_RoutingFeesDecodeErrorZPtr {
4747 /// A pointer to the contents in the success state.
4748 /// Reading from this pointer when `result_ok` is not set is undefined.
4749 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
4750 /// A pointer to the contents in the error state.
4751 /// Reading from this pointer when `result_ok` is set is undefined.
4752 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4755 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
4756 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
4757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4758 pub struct CResult_RoutingFeesDecodeErrorZ {
4759 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
4760 /// `err` or `result` depending on the state of `result_ok`.
4761 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
4762 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
4763 pub result_ok: bool,
4766 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
4767 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
4768 CResult_RoutingFeesDecodeErrorZ {
4769 contents: CResult_RoutingFeesDecodeErrorZPtr {
4770 result: Box::into_raw(Box::new(o)),
4776 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
4777 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
4778 CResult_RoutingFeesDecodeErrorZ {
4779 contents: CResult_RoutingFeesDecodeErrorZPtr {
4780 err: Box::into_raw(Box::new(e)),
4786 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
4787 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
4788 impl Drop for CResult_RoutingFeesDecodeErrorZ {
4789 fn drop(&mut self) {
4791 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4792 let _ = unsafe { Box::from_raw(self.contents.result) };
4795 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4796 let _ = unsafe { Box::from_raw(self.contents.err) };
4801 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
4802 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
4803 let contents = if o.result_ok {
4804 let result = unsafe { o.contents.result };
4805 unsafe { o.contents.result = std::ptr::null_mut() };
4806 CResult_RoutingFeesDecodeErrorZPtr { result }
4808 let err = unsafe { o.contents.err };
4809 unsafe { o.contents.err = std::ptr::null_mut(); }
4810 CResult_RoutingFeesDecodeErrorZPtr { err }
4814 result_ok: o.result_ok,
4818 impl Clone for CResult_RoutingFeesDecodeErrorZ {
4819 fn clone(&self) -> Self {
4821 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
4822 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
4825 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
4826 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4832 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
4833 /// but with all dynamically-allocated buffers duplicated in new buffers.
4834 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
4836 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4837 /// This corresponds to std::vector in C++
4838 pub struct CVec_NetAddressZ {
4839 /// The elements in the array.
4840 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4841 pub data: *mut crate::lightning::ln::msgs::NetAddress,
4842 /// The number of elements pointed to by `data`.
4845 impl CVec_NetAddressZ {
4846 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4847 if self.datalen == 0 { return Vec::new(); }
4848 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4849 self.data = std::ptr::null_mut();
4853 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4854 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4857 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4858 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4859 let datalen = v.len();
4860 let data = Box::into_raw(v.into_boxed_slice());
4861 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4865 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4866 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4867 impl Drop for CVec_NetAddressZ {
4868 fn drop(&mut self) {
4869 if self.datalen == 0 { return; }
4870 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4873 impl Clone for CVec_NetAddressZ {
4874 fn clone(&self) -> Self {
4875 let mut res = Vec::new();
4876 if self.datalen == 0 { return Self::from(res); }
4877 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4882 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4883 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4884 /// A pointer to the contents in the success state.
4885 /// Reading from this pointer when `result_ok` is not set is undefined.
4886 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
4887 /// A pointer to the contents in the error state.
4888 /// Reading from this pointer when `result_ok` is set is undefined.
4889 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4892 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4893 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4895 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
4896 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4897 /// `err` or `result` depending on the state of `result_ok`.
4898 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
4899 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4900 pub result_ok: bool,
4903 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
4904 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4905 CResult_NodeAnnouncementInfoDecodeErrorZ {
4906 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4907 result: Box::into_raw(Box::new(o)),
4913 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
4914 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4915 CResult_NodeAnnouncementInfoDecodeErrorZ {
4916 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4917 err: Box::into_raw(Box::new(e)),
4923 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
4924 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
4925 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
4926 fn drop(&mut self) {
4928 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4929 let _ = unsafe { Box::from_raw(self.contents.result) };
4932 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4933 let _ = unsafe { Box::from_raw(self.contents.err) };
4938 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
4939 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4940 let contents = if o.result_ok {
4941 let result = unsafe { o.contents.result };
4942 unsafe { o.contents.result = std::ptr::null_mut() };
4943 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
4945 let err = unsafe { o.contents.err };
4946 unsafe { o.contents.err = std::ptr::null_mut(); }
4947 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
4951 result_ok: o.result_ok,
4955 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
4956 fn clone(&self) -> Self {
4958 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4959 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
4962 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4963 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4969 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
4970 /// but with all dynamically-allocated buffers duplicated in new buffers.
4971 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
4973 /// A dynamically-allocated array of u64s of arbitrary size.
4974 /// This corresponds to std::vector in C++
4975 pub struct CVec_u64Z {
4976 /// The elements in the array.
4977 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4979 /// The number of elements pointed to by `data`.
4983 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4984 if self.datalen == 0 { return Vec::new(); }
4985 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4986 self.data = std::ptr::null_mut();
4990 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4991 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4994 impl From<Vec<u64>> for CVec_u64Z {
4995 fn from(v: Vec<u64>) -> Self {
4996 let datalen = v.len();
4997 let data = Box::into_raw(v.into_boxed_slice());
4998 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5002 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5003 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5004 impl Drop for CVec_u64Z {
5005 fn drop(&mut self) {
5006 if self.datalen == 0 { return; }
5007 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5010 impl Clone for CVec_u64Z {
5011 fn clone(&self) -> Self {
5012 let mut res = Vec::new();
5013 if self.datalen == 0 { return Self::from(res); }
5014 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5019 /// The contents of CResult_NodeInfoDecodeErrorZ
5020 pub union CResult_NodeInfoDecodeErrorZPtr {
5021 /// A pointer to the contents in the success state.
5022 /// Reading from this pointer when `result_ok` is not set is undefined.
5023 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
5024 /// A pointer to the contents in the error state.
5025 /// Reading from this pointer when `result_ok` is set is undefined.
5026 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5029 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5030 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5032 pub struct CResult_NodeInfoDecodeErrorZ {
5033 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5034 /// `err` or `result` depending on the state of `result_ok`.
5035 pub contents: CResult_NodeInfoDecodeErrorZPtr,
5036 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5037 pub result_ok: bool,
5040 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5041 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5042 CResult_NodeInfoDecodeErrorZ {
5043 contents: CResult_NodeInfoDecodeErrorZPtr {
5044 result: Box::into_raw(Box::new(o)),
5050 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5051 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5052 CResult_NodeInfoDecodeErrorZ {
5053 contents: CResult_NodeInfoDecodeErrorZPtr {
5054 err: Box::into_raw(Box::new(e)),
5060 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5061 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5062 impl Drop for CResult_NodeInfoDecodeErrorZ {
5063 fn drop(&mut self) {
5065 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5066 let _ = unsafe { Box::from_raw(self.contents.result) };
5069 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5070 let _ = unsafe { Box::from_raw(self.contents.err) };
5075 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5076 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5077 let contents = if o.result_ok {
5078 let result = unsafe { o.contents.result };
5079 unsafe { o.contents.result = std::ptr::null_mut() };
5080 CResult_NodeInfoDecodeErrorZPtr { result }
5082 let err = unsafe { o.contents.err };
5083 unsafe { o.contents.err = std::ptr::null_mut(); }
5084 CResult_NodeInfoDecodeErrorZPtr { err }
5088 result_ok: o.result_ok,
5092 impl Clone for CResult_NodeInfoDecodeErrorZ {
5093 fn clone(&self) -> Self {
5095 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5096 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
5099 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5100 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5106 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5107 /// but with all dynamically-allocated buffers duplicated in new buffers.
5108 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
5110 /// The contents of CResult_NetworkGraphDecodeErrorZ
5111 pub union CResult_NetworkGraphDecodeErrorZPtr {
5112 /// A pointer to the contents in the success state.
5113 /// Reading from this pointer when `result_ok` is not set is undefined.
5114 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
5115 /// A pointer to the contents in the error state.
5116 /// Reading from this pointer when `result_ok` is set is undefined.
5117 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5120 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5121 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5123 pub struct CResult_NetworkGraphDecodeErrorZ {
5124 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5125 /// `err` or `result` depending on the state of `result_ok`.
5126 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5127 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5128 pub result_ok: bool,
5131 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5132 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5133 CResult_NetworkGraphDecodeErrorZ {
5134 contents: CResult_NetworkGraphDecodeErrorZPtr {
5135 result: Box::into_raw(Box::new(o)),
5141 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5142 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5143 CResult_NetworkGraphDecodeErrorZ {
5144 contents: CResult_NetworkGraphDecodeErrorZPtr {
5145 err: Box::into_raw(Box::new(e)),
5151 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5152 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5153 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5154 fn drop(&mut self) {
5156 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5157 let _ = unsafe { Box::from_raw(self.contents.result) };
5160 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5161 let _ = unsafe { Box::from_raw(self.contents.err) };
5166 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5167 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5168 let contents = if o.result_ok {
5169 let result = unsafe { o.contents.result };
5170 unsafe { o.contents.result = std::ptr::null_mut() };
5171 CResult_NetworkGraphDecodeErrorZPtr { result }
5173 let err = unsafe { o.contents.err };
5174 unsafe { o.contents.err = std::ptr::null_mut(); }
5175 CResult_NetworkGraphDecodeErrorZPtr { err }
5179 result_ok: o.result_ok,
5183 impl Clone for CResult_NetworkGraphDecodeErrorZ {
5184 fn clone(&self) -> Self {
5186 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
5187 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
5190 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
5191 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5197 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
5198 /// but with all dynamically-allocated buffers duplicated in new buffers.
5199 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
5201 /// The contents of CResult_InitFeaturesDecodeErrorZ
5202 pub union CResult_InitFeaturesDecodeErrorZPtr {
5203 /// A pointer to the contents in the success state.
5204 /// Reading from this pointer when `result_ok` is not set is undefined.
5205 pub result: *mut crate::lightning::ln::features::InitFeatures,
5206 /// A pointer to the contents in the error state.
5207 /// Reading from this pointer when `result_ok` is set is undefined.
5208 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5211 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5212 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5214 pub struct CResult_InitFeaturesDecodeErrorZ {
5215 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5216 /// `err` or `result` depending on the state of `result_ok`.
5217 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5218 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5219 pub result_ok: bool,
5222 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5223 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5224 CResult_InitFeaturesDecodeErrorZ {
5225 contents: CResult_InitFeaturesDecodeErrorZPtr {
5226 result: Box::into_raw(Box::new(o)),
5232 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5233 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5234 CResult_InitFeaturesDecodeErrorZ {
5235 contents: CResult_InitFeaturesDecodeErrorZPtr {
5236 err: Box::into_raw(Box::new(e)),
5242 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5243 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5244 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5245 fn drop(&mut self) {
5247 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5248 let _ = unsafe { Box::from_raw(self.contents.result) };
5251 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5252 let _ = unsafe { Box::from_raw(self.contents.err) };
5257 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5258 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5259 let contents = if o.result_ok {
5260 let result = unsafe { o.contents.result };
5261 unsafe { o.contents.result = std::ptr::null_mut() };
5262 CResult_InitFeaturesDecodeErrorZPtr { result }
5264 let err = unsafe { o.contents.err };
5265 unsafe { o.contents.err = std::ptr::null_mut(); }
5266 CResult_InitFeaturesDecodeErrorZPtr { err }
5270 result_ok: o.result_ok,
5275 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5276 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5277 /// A pointer to the contents in the success state.
5278 /// Reading from this pointer when `result_ok` is not set is undefined.
5279 pub result: *mut crate::lightning::ln::features::NodeFeatures,
5280 /// A pointer to the contents in the error state.
5281 /// Reading from this pointer when `result_ok` is set is undefined.
5282 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5285 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5286 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5288 pub struct CResult_NodeFeaturesDecodeErrorZ {
5289 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5290 /// `err` or `result` depending on the state of `result_ok`.
5291 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5292 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5293 pub result_ok: bool,
5296 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5297 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5298 CResult_NodeFeaturesDecodeErrorZ {
5299 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5300 result: Box::into_raw(Box::new(o)),
5306 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5307 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5308 CResult_NodeFeaturesDecodeErrorZ {
5309 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5310 err: Box::into_raw(Box::new(e)),
5316 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5317 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5318 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5319 fn drop(&mut self) {
5321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5322 let _ = unsafe { Box::from_raw(self.contents.result) };
5325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5326 let _ = unsafe { Box::from_raw(self.contents.err) };
5331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5332 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5333 let contents = if o.result_ok {
5334 let result = unsafe { o.contents.result };
5335 unsafe { o.contents.result = std::ptr::null_mut() };
5336 CResult_NodeFeaturesDecodeErrorZPtr { result }
5338 let err = unsafe { o.contents.err };
5339 unsafe { o.contents.err = std::ptr::null_mut(); }
5340 CResult_NodeFeaturesDecodeErrorZPtr { err }
5344 result_ok: o.result_ok,
5349 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5350 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5351 /// A pointer to the contents in the success state.
5352 /// Reading from this pointer when `result_ok` is not set is undefined.
5353 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5354 /// A pointer to the contents in the error state.
5355 /// Reading from this pointer when `result_ok` is set is undefined.
5356 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5359 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5360 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5362 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5363 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5364 /// `err` or `result` depending on the state of `result_ok`.
5365 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5366 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5367 pub result_ok: bool,
5370 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5371 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5372 CResult_ChannelFeaturesDecodeErrorZ {
5373 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5374 result: Box::into_raw(Box::new(o)),
5380 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5381 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5382 CResult_ChannelFeaturesDecodeErrorZ {
5383 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5384 err: Box::into_raw(Box::new(e)),
5390 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5391 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5392 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5393 fn drop(&mut self) {
5395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5396 let _ = unsafe { Box::from_raw(self.contents.result) };
5399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5400 let _ = unsafe { Box::from_raw(self.contents.err) };
5405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5407 let contents = if o.result_ok {
5408 let result = unsafe { o.contents.result };
5409 unsafe { o.contents.result = std::ptr::null_mut() };
5410 CResult_ChannelFeaturesDecodeErrorZPtr { result }
5412 let err = unsafe { o.contents.err };
5413 unsafe { o.contents.err = std::ptr::null_mut(); }
5414 CResult_ChannelFeaturesDecodeErrorZPtr { err }
5418 result_ok: o.result_ok,
5423 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
5424 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
5425 /// A pointer to the contents in the success state.
5426 /// Reading from this pointer when `result_ok` is not set is undefined.
5427 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
5428 /// A pointer to the contents in the error state.
5429 /// Reading from this pointer when `result_ok` is set is undefined.
5430 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5433 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5434 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5436 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
5437 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5438 /// `err` or `result` depending on the state of `result_ok`.
5439 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
5440 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5441 pub result_ok: bool,
5444 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
5445 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
5446 CResult_InvoiceFeaturesDecodeErrorZ {
5447 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5448 result: Box::into_raw(Box::new(o)),
5454 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
5455 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
5456 CResult_InvoiceFeaturesDecodeErrorZ {
5457 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5458 err: Box::into_raw(Box::new(e)),
5464 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
5465 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
5466 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
5467 fn drop(&mut self) {
5469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5470 let _ = unsafe { Box::from_raw(self.contents.result) };
5473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5474 let _ = unsafe { Box::from_raw(self.contents.err) };
5479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
5480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5481 let contents = if o.result_ok {
5482 let result = unsafe { o.contents.result };
5483 unsafe { o.contents.result = std::ptr::null_mut() };
5484 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
5486 let err = unsafe { o.contents.err };
5487 unsafe { o.contents.err = std::ptr::null_mut(); }
5488 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
5492 result_ok: o.result_ok,
5497 /// The contents of CResult_NetAddressu8Z
5498 pub union CResult_NetAddressu8ZPtr {
5499 /// A pointer to the contents in the success state.
5500 /// Reading from this pointer when `result_ok` is not set is undefined.
5501 pub result: *mut crate::lightning::ln::msgs::NetAddress,
5502 /// A pointer to the contents in the error state.
5503 /// Reading from this pointer when `result_ok` is set is undefined.
5507 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
5508 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5510 pub struct CResult_NetAddressu8Z {
5511 /// The contents of this CResult_NetAddressu8Z, accessible via either
5512 /// `err` or `result` depending on the state of `result_ok`.
5513 pub contents: CResult_NetAddressu8ZPtr,
5514 /// Whether this CResult_NetAddressu8Z represents a success state.
5515 pub result_ok: bool,
5518 /// Creates a new CResult_NetAddressu8Z in the success state.
5519 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
5520 CResult_NetAddressu8Z {
5521 contents: CResult_NetAddressu8ZPtr {
5522 result: Box::into_raw(Box::new(o)),
5528 /// Creates a new CResult_NetAddressu8Z in the error state.
5529 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
5530 CResult_NetAddressu8Z {
5531 contents: CResult_NetAddressu8ZPtr {
5532 err: Box::into_raw(Box::new(e)),
5538 /// Frees any resources used by the CResult_NetAddressu8Z.
5539 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
5540 impl Drop for CResult_NetAddressu8Z {
5541 fn drop(&mut self) {
5543 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5544 let _ = unsafe { Box::from_raw(self.contents.result) };
5547 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5548 let _ = unsafe { Box::from_raw(self.contents.err) };
5553 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
5554 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
5555 let contents = if o.result_ok {
5556 let result = unsafe { o.contents.result };
5557 unsafe { o.contents.result = std::ptr::null_mut() };
5558 CResult_NetAddressu8ZPtr { result }
5560 let err = unsafe { o.contents.err };
5561 unsafe { o.contents.err = std::ptr::null_mut(); }
5562 CResult_NetAddressu8ZPtr { err }
5566 result_ok: o.result_ok,
5570 impl Clone for CResult_NetAddressu8Z {
5571 fn clone(&self) -> Self {
5573 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
5574 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
5577 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
5578 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
5584 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
5585 /// but with all dynamically-allocated buffers duplicated in new buffers.
5586 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
5588 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5589 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5590 /// A pointer to the contents in the success state.
5591 /// Reading from this pointer when `result_ok` is not set is undefined.
5592 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
5593 /// A pointer to the contents in the error state.
5594 /// Reading from this pointer when `result_ok` is set is undefined.
5595 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5598 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5599 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5601 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
5602 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5603 /// `err` or `result` depending on the state of `result_ok`.
5604 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
5605 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5606 pub result_ok: bool,
5609 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
5610 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5611 CResult_CResult_NetAddressu8ZDecodeErrorZ {
5612 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5613 result: Box::into_raw(Box::new(o)),
5619 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
5620 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5621 CResult_CResult_NetAddressu8ZDecodeErrorZ {
5622 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5623 err: Box::into_raw(Box::new(e)),
5629 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
5630 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
5631 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5632 fn drop(&mut self) {
5634 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5635 let _ = unsafe { Box::from_raw(self.contents.result) };
5638 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5639 let _ = unsafe { Box::from_raw(self.contents.err) };
5644 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5645 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
5646 let contents = if o.result_ok {
5647 let result = unsafe { o.contents.result };
5648 unsafe { o.contents.result = std::ptr::null_mut() };
5649 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
5651 let err = unsafe { o.contents.err };
5652 unsafe { o.contents.err = std::ptr::null_mut(); }
5653 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
5657 result_ok: o.result_ok,
5661 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5662 fn clone(&self) -> Self {
5664 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5665 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
5668 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5669 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5675 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
5676 /// but with all dynamically-allocated buffers duplicated in new buffers.
5677 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
5679 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
5680 /// This corresponds to std::vector in C++
5681 pub struct CVec_UpdateAddHTLCZ {
5682 /// The elements in the array.
5683 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5684 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
5685 /// The number of elements pointed to by `data`.
5688 impl CVec_UpdateAddHTLCZ {
5689 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
5690 if self.datalen == 0 { return Vec::new(); }
5691 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5692 self.data = std::ptr::null_mut();
5696 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
5697 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5700 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
5701 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
5702 let datalen = v.len();
5703 let data = Box::into_raw(v.into_boxed_slice());
5704 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5708 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5709 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
5710 impl Drop for CVec_UpdateAddHTLCZ {
5711 fn drop(&mut self) {
5712 if self.datalen == 0 { return; }
5713 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5716 impl Clone for CVec_UpdateAddHTLCZ {
5717 fn clone(&self) -> Self {
5718 let mut res = Vec::new();
5719 if self.datalen == 0 { return Self::from(res); }
5720 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5725 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5726 /// This corresponds to std::vector in C++
5727 pub struct CVec_UpdateFulfillHTLCZ {
5728 /// The elements in the array.
5729 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5730 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
5731 /// The number of elements pointed to by `data`.
5734 impl CVec_UpdateFulfillHTLCZ {
5735 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
5736 if self.datalen == 0 { return Vec::new(); }
5737 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5738 self.data = std::ptr::null_mut();
5742 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
5743 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5746 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
5747 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
5748 let datalen = v.len();
5749 let data = Box::into_raw(v.into_boxed_slice());
5750 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5754 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5755 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
5756 impl Drop for CVec_UpdateFulfillHTLCZ {
5757 fn drop(&mut self) {
5758 if self.datalen == 0 { return; }
5759 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5762 impl Clone for CVec_UpdateFulfillHTLCZ {
5763 fn clone(&self) -> Self {
5764 let mut res = Vec::new();
5765 if self.datalen == 0 { return Self::from(res); }
5766 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5771 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
5772 /// This corresponds to std::vector in C++
5773 pub struct CVec_UpdateFailHTLCZ {
5774 /// The elements in the array.
5775 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5776 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
5777 /// The number of elements pointed to by `data`.
5780 impl CVec_UpdateFailHTLCZ {
5781 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
5782 if self.datalen == 0 { return Vec::new(); }
5783 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5784 self.data = std::ptr::null_mut();
5788 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
5789 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5792 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
5793 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
5794 let datalen = v.len();
5795 let data = Box::into_raw(v.into_boxed_slice());
5796 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5800 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5801 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
5802 impl Drop for CVec_UpdateFailHTLCZ {
5803 fn drop(&mut self) {
5804 if self.datalen == 0 { return; }
5805 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5808 impl Clone for CVec_UpdateFailHTLCZ {
5809 fn clone(&self) -> Self {
5810 let mut res = Vec::new();
5811 if self.datalen == 0 { return Self::from(res); }
5812 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5817 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5818 /// This corresponds to std::vector in C++
5819 pub struct CVec_UpdateFailMalformedHTLCZ {
5820 /// The elements in the array.
5821 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5822 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
5823 /// The number of elements pointed to by `data`.
5826 impl CVec_UpdateFailMalformedHTLCZ {
5827 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
5828 if self.datalen == 0 { return Vec::new(); }
5829 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5830 self.data = std::ptr::null_mut();
5834 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
5835 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5838 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
5839 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
5840 let datalen = v.len();
5841 let data = Box::into_raw(v.into_boxed_slice());
5842 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5846 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5847 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
5848 impl Drop for CVec_UpdateFailMalformedHTLCZ {
5849 fn drop(&mut self) {
5850 if self.datalen == 0 { return; }
5851 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5854 impl Clone for CVec_UpdateFailMalformedHTLCZ {
5855 fn clone(&self) -> Self {
5856 let mut res = Vec::new();
5857 if self.datalen == 0 { return Self::from(res); }
5858 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5863 /// The contents of CResult_AcceptChannelDecodeErrorZ
5864 pub union CResult_AcceptChannelDecodeErrorZPtr {
5865 /// A pointer to the contents in the success state.
5866 /// Reading from this pointer when `result_ok` is not set is undefined.
5867 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
5868 /// A pointer to the contents in the error state.
5869 /// Reading from this pointer when `result_ok` is set is undefined.
5870 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5873 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5874 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5876 pub struct CResult_AcceptChannelDecodeErrorZ {
5877 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5878 /// `err` or `result` depending on the state of `result_ok`.
5879 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
5880 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5881 pub result_ok: bool,
5884 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
5885 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
5886 CResult_AcceptChannelDecodeErrorZ {
5887 contents: CResult_AcceptChannelDecodeErrorZPtr {
5888 result: Box::into_raw(Box::new(o)),
5894 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
5895 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
5896 CResult_AcceptChannelDecodeErrorZ {
5897 contents: CResult_AcceptChannelDecodeErrorZPtr {
5898 err: Box::into_raw(Box::new(e)),
5904 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
5905 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
5906 impl Drop for CResult_AcceptChannelDecodeErrorZ {
5907 fn drop(&mut self) {
5909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5910 let _ = unsafe { Box::from_raw(self.contents.result) };
5913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5914 let _ = unsafe { Box::from_raw(self.contents.err) };
5919 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
5920 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
5921 let contents = if o.result_ok {
5922 let result = unsafe { o.contents.result };
5923 unsafe { o.contents.result = std::ptr::null_mut() };
5924 CResult_AcceptChannelDecodeErrorZPtr { result }
5926 let err = unsafe { o.contents.err };
5927 unsafe { o.contents.err = std::ptr::null_mut(); }
5928 CResult_AcceptChannelDecodeErrorZPtr { err }
5932 result_ok: o.result_ok,
5936 impl Clone for CResult_AcceptChannelDecodeErrorZ {
5937 fn clone(&self) -> Self {
5939 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
5940 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
5943 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
5944 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5950 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
5951 /// but with all dynamically-allocated buffers duplicated in new buffers.
5952 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
5954 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5955 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
5956 /// A pointer to the contents in the success state.
5957 /// Reading from this pointer when `result_ok` is not set is undefined.
5958 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
5959 /// A pointer to the contents in the error state.
5960 /// Reading from this pointer when `result_ok` is set is undefined.
5961 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5964 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5965 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5967 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
5968 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5969 /// `err` or `result` depending on the state of `result_ok`.
5970 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
5971 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5972 pub result_ok: bool,
5975 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
5976 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5977 CResult_AnnouncementSignaturesDecodeErrorZ {
5978 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5979 result: Box::into_raw(Box::new(o)),
5985 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
5986 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5987 CResult_AnnouncementSignaturesDecodeErrorZ {
5988 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5989 err: Box::into_raw(Box::new(e)),
5995 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
5996 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
5997 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
5998 fn drop(&mut self) {
6000 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6001 let _ = unsafe { Box::from_raw(self.contents.result) };
6004 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6005 let _ = unsafe { Box::from_raw(self.contents.err) };
6010 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
6011 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6012 let contents = if o.result_ok {
6013 let result = unsafe { o.contents.result };
6014 unsafe { o.contents.result = std::ptr::null_mut() };
6015 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
6017 let err = unsafe { o.contents.err };
6018 unsafe { o.contents.err = std::ptr::null_mut(); }
6019 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
6023 result_ok: o.result_ok,
6027 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
6028 fn clone(&self) -> Self {
6030 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6031 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
6034 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6035 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6041 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
6042 /// but with all dynamically-allocated buffers duplicated in new buffers.
6043 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
6045 /// The contents of CResult_ChannelReestablishDecodeErrorZ
6046 pub union CResult_ChannelReestablishDecodeErrorZPtr {
6047 /// A pointer to the contents in the success state.
6048 /// Reading from this pointer when `result_ok` is not set is undefined.
6049 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
6050 /// A pointer to the contents in the error state.
6051 /// Reading from this pointer when `result_ok` is set is undefined.
6052 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6055 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6056 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
6057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6058 pub struct CResult_ChannelReestablishDecodeErrorZ {
6059 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6060 /// `err` or `result` depending on the state of `result_ok`.
6061 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
6062 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6063 pub result_ok: bool,
6066 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
6067 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
6068 CResult_ChannelReestablishDecodeErrorZ {
6069 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6070 result: Box::into_raw(Box::new(o)),
6076 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
6077 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
6078 CResult_ChannelReestablishDecodeErrorZ {
6079 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6080 err: Box::into_raw(Box::new(e)),
6086 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
6087 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
6088 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
6089 fn drop(&mut self) {
6091 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6092 let _ = unsafe { Box::from_raw(self.contents.result) };
6095 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6096 let _ = unsafe { Box::from_raw(self.contents.err) };
6101 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
6102 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
6103 let contents = if o.result_ok {
6104 let result = unsafe { o.contents.result };
6105 unsafe { o.contents.result = std::ptr::null_mut() };
6106 CResult_ChannelReestablishDecodeErrorZPtr { result }
6108 let err = unsafe { o.contents.err };
6109 unsafe { o.contents.err = std::ptr::null_mut(); }
6110 CResult_ChannelReestablishDecodeErrorZPtr { err }
6114 result_ok: o.result_ok,
6118 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
6119 fn clone(&self) -> Self {
6121 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6122 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
6125 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6126 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6132 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
6133 /// but with all dynamically-allocated buffers duplicated in new buffers.
6134 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
6136 /// The contents of CResult_ClosingSignedDecodeErrorZ
6137 pub union CResult_ClosingSignedDecodeErrorZPtr {
6138 /// A pointer to the contents in the success state.
6139 /// Reading from this pointer when `result_ok` is not set is undefined.
6140 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
6141 /// A pointer to the contents in the error state.
6142 /// Reading from this pointer when `result_ok` is set is undefined.
6143 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6146 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6147 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6149 pub struct CResult_ClosingSignedDecodeErrorZ {
6150 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6151 /// `err` or `result` depending on the state of `result_ok`.
6152 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
6153 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6154 pub result_ok: bool,
6157 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
6158 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
6159 CResult_ClosingSignedDecodeErrorZ {
6160 contents: CResult_ClosingSignedDecodeErrorZPtr {
6161 result: Box::into_raw(Box::new(o)),
6167 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
6168 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
6169 CResult_ClosingSignedDecodeErrorZ {
6170 contents: CResult_ClosingSignedDecodeErrorZPtr {
6171 err: Box::into_raw(Box::new(e)),
6177 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
6178 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
6179 impl Drop for CResult_ClosingSignedDecodeErrorZ {
6180 fn drop(&mut self) {
6182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6183 let _ = unsafe { Box::from_raw(self.contents.result) };
6186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6187 let _ = unsafe { Box::from_raw(self.contents.err) };
6192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
6193 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6194 let contents = if o.result_ok {
6195 let result = unsafe { o.contents.result };
6196 unsafe { o.contents.result = std::ptr::null_mut() };
6197 CResult_ClosingSignedDecodeErrorZPtr { result }
6199 let err = unsafe { o.contents.err };
6200 unsafe { o.contents.err = std::ptr::null_mut(); }
6201 CResult_ClosingSignedDecodeErrorZPtr { err }
6205 result_ok: o.result_ok,
6209 impl Clone for CResult_ClosingSignedDecodeErrorZ {
6210 fn clone(&self) -> Self {
6212 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
6213 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
6216 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
6217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6223 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
6224 /// but with all dynamically-allocated buffers duplicated in new buffers.
6225 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
6227 /// The contents of CResult_CommitmentSignedDecodeErrorZ
6228 pub union CResult_CommitmentSignedDecodeErrorZPtr {
6229 /// A pointer to the contents in the success state.
6230 /// Reading from this pointer when `result_ok` is not set is undefined.
6231 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
6232 /// A pointer to the contents in the error state.
6233 /// Reading from this pointer when `result_ok` is set is undefined.
6234 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6237 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6238 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6240 pub struct CResult_CommitmentSignedDecodeErrorZ {
6241 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6242 /// `err` or `result` depending on the state of `result_ok`.
6243 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
6244 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6245 pub result_ok: bool,
6248 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
6249 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
6250 CResult_CommitmentSignedDecodeErrorZ {
6251 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6252 result: Box::into_raw(Box::new(o)),
6258 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
6259 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
6260 CResult_CommitmentSignedDecodeErrorZ {
6261 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6262 err: Box::into_raw(Box::new(e)),
6268 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
6269 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
6270 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
6271 fn drop(&mut self) {
6273 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6274 let _ = unsafe { Box::from_raw(self.contents.result) };
6277 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6278 let _ = unsafe { Box::from_raw(self.contents.err) };
6283 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
6284 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6285 let contents = if o.result_ok {
6286 let result = unsafe { o.contents.result };
6287 unsafe { o.contents.result = std::ptr::null_mut() };
6288 CResult_CommitmentSignedDecodeErrorZPtr { result }
6290 let err = unsafe { o.contents.err };
6291 unsafe { o.contents.err = std::ptr::null_mut(); }
6292 CResult_CommitmentSignedDecodeErrorZPtr { err }
6296 result_ok: o.result_ok,
6300 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
6301 fn clone(&self) -> Self {
6303 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6304 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
6307 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6308 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6314 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
6315 /// but with all dynamically-allocated buffers duplicated in new buffers.
6316 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
6318 /// The contents of CResult_FundingCreatedDecodeErrorZ
6319 pub union CResult_FundingCreatedDecodeErrorZPtr {
6320 /// A pointer to the contents in the success state.
6321 /// Reading from this pointer when `result_ok` is not set is undefined.
6322 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
6323 /// A pointer to the contents in the error state.
6324 /// Reading from this pointer when `result_ok` is set is undefined.
6325 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6328 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6329 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
6330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6331 pub struct CResult_FundingCreatedDecodeErrorZ {
6332 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6333 /// `err` or `result` depending on the state of `result_ok`.
6334 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
6335 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6336 pub result_ok: bool,
6339 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
6340 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
6341 CResult_FundingCreatedDecodeErrorZ {
6342 contents: CResult_FundingCreatedDecodeErrorZPtr {
6343 result: Box::into_raw(Box::new(o)),
6349 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
6350 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
6351 CResult_FundingCreatedDecodeErrorZ {
6352 contents: CResult_FundingCreatedDecodeErrorZPtr {
6353 err: Box::into_raw(Box::new(e)),
6359 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
6360 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
6361 impl Drop for CResult_FundingCreatedDecodeErrorZ {
6362 fn drop(&mut self) {
6364 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6365 let _ = unsafe { Box::from_raw(self.contents.result) };
6368 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6369 let _ = unsafe { Box::from_raw(self.contents.err) };
6374 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
6375 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
6376 let contents = if o.result_ok {
6377 let result = unsafe { o.contents.result };
6378 unsafe { o.contents.result = std::ptr::null_mut() };
6379 CResult_FundingCreatedDecodeErrorZPtr { result }
6381 let err = unsafe { o.contents.err };
6382 unsafe { o.contents.err = std::ptr::null_mut(); }
6383 CResult_FundingCreatedDecodeErrorZPtr { err }
6387 result_ok: o.result_ok,
6391 impl Clone for CResult_FundingCreatedDecodeErrorZ {
6392 fn clone(&self) -> Self {
6394 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
6395 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
6398 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
6399 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6405 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
6406 /// but with all dynamically-allocated buffers duplicated in new buffers.
6407 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
6409 /// The contents of CResult_FundingSignedDecodeErrorZ
6410 pub union CResult_FundingSignedDecodeErrorZPtr {
6411 /// A pointer to the contents in the success state.
6412 /// Reading from this pointer when `result_ok` is not set is undefined.
6413 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
6414 /// A pointer to the contents in the error state.
6415 /// Reading from this pointer when `result_ok` is set is undefined.
6416 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6419 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6420 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6422 pub struct CResult_FundingSignedDecodeErrorZ {
6423 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6424 /// `err` or `result` depending on the state of `result_ok`.
6425 pub contents: CResult_FundingSignedDecodeErrorZPtr,
6426 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6427 pub result_ok: bool,
6430 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
6431 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
6432 CResult_FundingSignedDecodeErrorZ {
6433 contents: CResult_FundingSignedDecodeErrorZPtr {
6434 result: Box::into_raw(Box::new(o)),
6440 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
6441 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
6442 CResult_FundingSignedDecodeErrorZ {
6443 contents: CResult_FundingSignedDecodeErrorZPtr {
6444 err: Box::into_raw(Box::new(e)),
6450 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
6451 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
6452 impl Drop for CResult_FundingSignedDecodeErrorZ {
6453 fn drop(&mut self) {
6455 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6456 let _ = unsafe { Box::from_raw(self.contents.result) };
6459 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6460 let _ = unsafe { Box::from_raw(self.contents.err) };
6465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
6466 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6467 let contents = if o.result_ok {
6468 let result = unsafe { o.contents.result };
6469 unsafe { o.contents.result = std::ptr::null_mut() };
6470 CResult_FundingSignedDecodeErrorZPtr { result }
6472 let err = unsafe { o.contents.err };
6473 unsafe { o.contents.err = std::ptr::null_mut(); }
6474 CResult_FundingSignedDecodeErrorZPtr { err }
6478 result_ok: o.result_ok,
6482 impl Clone for CResult_FundingSignedDecodeErrorZ {
6483 fn clone(&self) -> Self {
6485 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
6486 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
6489 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
6490 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6496 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
6497 /// but with all dynamically-allocated buffers duplicated in new buffers.
6498 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
6500 /// The contents of CResult_FundingLockedDecodeErrorZ
6501 pub union CResult_FundingLockedDecodeErrorZPtr {
6502 /// A pointer to the contents in the success state.
6503 /// Reading from this pointer when `result_ok` is not set is undefined.
6504 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
6505 /// A pointer to the contents in the error state.
6506 /// Reading from this pointer when `result_ok` is set is undefined.
6507 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6510 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6511 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
6512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6513 pub struct CResult_FundingLockedDecodeErrorZ {
6514 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6515 /// `err` or `result` depending on the state of `result_ok`.
6516 pub contents: CResult_FundingLockedDecodeErrorZPtr,
6517 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6518 pub result_ok: bool,
6521 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
6522 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
6523 CResult_FundingLockedDecodeErrorZ {
6524 contents: CResult_FundingLockedDecodeErrorZPtr {
6525 result: Box::into_raw(Box::new(o)),
6531 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
6532 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
6533 CResult_FundingLockedDecodeErrorZ {
6534 contents: CResult_FundingLockedDecodeErrorZPtr {
6535 err: Box::into_raw(Box::new(e)),
6541 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
6542 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
6543 impl Drop for CResult_FundingLockedDecodeErrorZ {
6544 fn drop(&mut self) {
6546 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6547 let _ = unsafe { Box::from_raw(self.contents.result) };
6550 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6551 let _ = unsafe { Box::from_raw(self.contents.err) };
6556 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
6557 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
6558 let contents = if o.result_ok {
6559 let result = unsafe { o.contents.result };
6560 unsafe { o.contents.result = std::ptr::null_mut() };
6561 CResult_FundingLockedDecodeErrorZPtr { result }
6563 let err = unsafe { o.contents.err };
6564 unsafe { o.contents.err = std::ptr::null_mut(); }
6565 CResult_FundingLockedDecodeErrorZPtr { err }
6569 result_ok: o.result_ok,
6573 impl Clone for CResult_FundingLockedDecodeErrorZ {
6574 fn clone(&self) -> Self {
6576 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
6577 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
6580 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
6581 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6587 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
6588 /// but with all dynamically-allocated buffers duplicated in new buffers.
6589 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
6591 /// The contents of CResult_InitDecodeErrorZ
6592 pub union CResult_InitDecodeErrorZPtr {
6593 /// A pointer to the contents in the success state.
6594 /// Reading from this pointer when `result_ok` is not set is undefined.
6595 pub result: *mut crate::lightning::ln::msgs::Init,
6596 /// A pointer to the contents in the error state.
6597 /// Reading from this pointer when `result_ok` is set is undefined.
6598 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6601 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6602 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
6603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6604 pub struct CResult_InitDecodeErrorZ {
6605 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
6606 /// `err` or `result` depending on the state of `result_ok`.
6607 pub contents: CResult_InitDecodeErrorZPtr,
6608 /// Whether this CResult_InitDecodeErrorZ represents a success state.
6609 pub result_ok: bool,
6612 /// Creates a new CResult_InitDecodeErrorZ in the success state.
6613 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
6614 CResult_InitDecodeErrorZ {
6615 contents: CResult_InitDecodeErrorZPtr {
6616 result: Box::into_raw(Box::new(o)),
6622 /// Creates a new CResult_InitDecodeErrorZ in the error state.
6623 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
6624 CResult_InitDecodeErrorZ {
6625 contents: CResult_InitDecodeErrorZPtr {
6626 err: Box::into_raw(Box::new(e)),
6632 /// Frees any resources used by the CResult_InitDecodeErrorZ.
6633 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
6634 impl Drop for CResult_InitDecodeErrorZ {
6635 fn drop(&mut self) {
6637 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6638 let _ = unsafe { Box::from_raw(self.contents.result) };
6641 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6642 let _ = unsafe { Box::from_raw(self.contents.err) };
6647 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
6648 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
6649 let contents = if o.result_ok {
6650 let result = unsafe { o.contents.result };
6651 unsafe { o.contents.result = std::ptr::null_mut() };
6652 CResult_InitDecodeErrorZPtr { result }
6654 let err = unsafe { o.contents.err };
6655 unsafe { o.contents.err = std::ptr::null_mut(); }
6656 CResult_InitDecodeErrorZPtr { err }
6660 result_ok: o.result_ok,
6664 impl Clone for CResult_InitDecodeErrorZ {
6665 fn clone(&self) -> Self {
6667 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
6668 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
6671 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
6672 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6678 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
6679 /// but with all dynamically-allocated buffers duplicated in new buffers.
6680 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
6682 /// The contents of CResult_OpenChannelDecodeErrorZ
6683 pub union CResult_OpenChannelDecodeErrorZPtr {
6684 /// A pointer to the contents in the success state.
6685 /// Reading from this pointer when `result_ok` is not set is undefined.
6686 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
6687 /// A pointer to the contents in the error state.
6688 /// Reading from this pointer when `result_ok` is set is undefined.
6689 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6692 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6693 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6695 pub struct CResult_OpenChannelDecodeErrorZ {
6696 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6697 /// `err` or `result` depending on the state of `result_ok`.
6698 pub contents: CResult_OpenChannelDecodeErrorZPtr,
6699 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6700 pub result_ok: bool,
6703 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
6704 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
6705 CResult_OpenChannelDecodeErrorZ {
6706 contents: CResult_OpenChannelDecodeErrorZPtr {
6707 result: Box::into_raw(Box::new(o)),
6713 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
6714 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
6715 CResult_OpenChannelDecodeErrorZ {
6716 contents: CResult_OpenChannelDecodeErrorZPtr {
6717 err: Box::into_raw(Box::new(e)),
6723 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
6724 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
6725 impl Drop for CResult_OpenChannelDecodeErrorZ {
6726 fn drop(&mut self) {
6728 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6729 let _ = unsafe { Box::from_raw(self.contents.result) };
6732 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6733 let _ = unsafe { Box::from_raw(self.contents.err) };
6738 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
6739 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
6740 let contents = if o.result_ok {
6741 let result = unsafe { o.contents.result };
6742 unsafe { o.contents.result = std::ptr::null_mut() };
6743 CResult_OpenChannelDecodeErrorZPtr { result }
6745 let err = unsafe { o.contents.err };
6746 unsafe { o.contents.err = std::ptr::null_mut(); }
6747 CResult_OpenChannelDecodeErrorZPtr { err }
6751 result_ok: o.result_ok,
6755 impl Clone for CResult_OpenChannelDecodeErrorZ {
6756 fn clone(&self) -> Self {
6758 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
6759 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
6762 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
6763 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6769 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
6770 /// but with all dynamically-allocated buffers duplicated in new buffers.
6771 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
6773 /// The contents of CResult_RevokeAndACKDecodeErrorZ
6774 pub union CResult_RevokeAndACKDecodeErrorZPtr {
6775 /// A pointer to the contents in the success state.
6776 /// Reading from this pointer when `result_ok` is not set is undefined.
6777 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
6778 /// A pointer to the contents in the error state.
6779 /// Reading from this pointer when `result_ok` is set is undefined.
6780 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6783 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
6784 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
6785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6786 pub struct CResult_RevokeAndACKDecodeErrorZ {
6787 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
6788 /// `err` or `result` depending on the state of `result_ok`.
6789 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
6790 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
6791 pub result_ok: bool,
6794 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
6795 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
6796 CResult_RevokeAndACKDecodeErrorZ {
6797 contents: CResult_RevokeAndACKDecodeErrorZPtr {
6798 result: Box::into_raw(Box::new(o)),
6804 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
6805 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
6806 CResult_RevokeAndACKDecodeErrorZ {
6807 contents: CResult_RevokeAndACKDecodeErrorZPtr {
6808 err: Box::into_raw(Box::new(e)),
6814 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
6815 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
6816 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
6817 fn drop(&mut self) {
6819 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6820 let _ = unsafe { Box::from_raw(self.contents.result) };
6823 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6824 let _ = unsafe { Box::from_raw(self.contents.err) };
6829 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
6830 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
6831 let contents = if o.result_ok {
6832 let result = unsafe { o.contents.result };
6833 unsafe { o.contents.result = std::ptr::null_mut() };
6834 CResult_RevokeAndACKDecodeErrorZPtr { result }
6836 let err = unsafe { o.contents.err };
6837 unsafe { o.contents.err = std::ptr::null_mut(); }
6838 CResult_RevokeAndACKDecodeErrorZPtr { err }
6842 result_ok: o.result_ok,
6846 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
6847 fn clone(&self) -> Self {
6849 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
6850 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
6853 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
6854 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6860 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
6861 /// but with all dynamically-allocated buffers duplicated in new buffers.
6862 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
6864 /// The contents of CResult_ShutdownDecodeErrorZ
6865 pub union CResult_ShutdownDecodeErrorZPtr {
6866 /// A pointer to the contents in the success state.
6867 /// Reading from this pointer when `result_ok` is not set is undefined.
6868 pub result: *mut crate::lightning::ln::msgs::Shutdown,
6869 /// A pointer to the contents in the error state.
6870 /// Reading from this pointer when `result_ok` is set is undefined.
6871 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6874 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
6875 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
6876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6877 pub struct CResult_ShutdownDecodeErrorZ {
6878 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
6879 /// `err` or `result` depending on the state of `result_ok`.
6880 pub contents: CResult_ShutdownDecodeErrorZPtr,
6881 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
6882 pub result_ok: bool,
6885 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
6886 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
6887 CResult_ShutdownDecodeErrorZ {
6888 contents: CResult_ShutdownDecodeErrorZPtr {
6889 result: Box::into_raw(Box::new(o)),
6895 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
6896 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
6897 CResult_ShutdownDecodeErrorZ {
6898 contents: CResult_ShutdownDecodeErrorZPtr {
6899 err: Box::into_raw(Box::new(e)),
6905 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
6906 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
6907 impl Drop for CResult_ShutdownDecodeErrorZ {
6908 fn drop(&mut self) {
6910 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6911 let _ = unsafe { Box::from_raw(self.contents.result) };
6914 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6915 let _ = unsafe { Box::from_raw(self.contents.err) };
6920 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
6921 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
6922 let contents = if o.result_ok {
6923 let result = unsafe { o.contents.result };
6924 unsafe { o.contents.result = std::ptr::null_mut() };
6925 CResult_ShutdownDecodeErrorZPtr { result }
6927 let err = unsafe { o.contents.err };
6928 unsafe { o.contents.err = std::ptr::null_mut(); }
6929 CResult_ShutdownDecodeErrorZPtr { err }
6933 result_ok: o.result_ok,
6937 impl Clone for CResult_ShutdownDecodeErrorZ {
6938 fn clone(&self) -> Self {
6940 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
6941 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
6944 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
6945 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6951 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
6952 /// but with all dynamically-allocated buffers duplicated in new buffers.
6953 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
6955 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
6956 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
6957 /// A pointer to the contents in the success state.
6958 /// Reading from this pointer when `result_ok` is not set is undefined.
6959 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
6960 /// A pointer to the contents in the error state.
6961 /// Reading from this pointer when `result_ok` is set is undefined.
6962 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6965 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
6966 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6968 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
6969 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
6970 /// `err` or `result` depending on the state of `result_ok`.
6971 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
6972 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
6973 pub result_ok: bool,
6976 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
6977 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
6978 CResult_UpdateFailHTLCDecodeErrorZ {
6979 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6980 result: Box::into_raw(Box::new(o)),
6986 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
6987 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
6988 CResult_UpdateFailHTLCDecodeErrorZ {
6989 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6990 err: Box::into_raw(Box::new(e)),
6996 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
6997 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
6998 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
6999 fn drop(&mut self) {
7001 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7002 let _ = unsafe { Box::from_raw(self.contents.result) };
7005 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7006 let _ = unsafe { Box::from_raw(self.contents.err) };
7011 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
7012 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7013 let contents = if o.result_ok {
7014 let result = unsafe { o.contents.result };
7015 unsafe { o.contents.result = std::ptr::null_mut() };
7016 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
7018 let err = unsafe { o.contents.err };
7019 unsafe { o.contents.err = std::ptr::null_mut(); }
7020 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
7024 result_ok: o.result_ok,
7028 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
7029 fn clone(&self) -> Self {
7031 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7032 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
7035 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7036 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7042 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
7043 /// but with all dynamically-allocated buffers duplicated in new buffers.
7044 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
7046 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7047 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7048 /// A pointer to the contents in the success state.
7049 /// Reading from this pointer when `result_ok` is not set is undefined.
7050 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
7051 /// A pointer to the contents in the error state.
7052 /// Reading from this pointer when `result_ok` is set is undefined.
7053 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7056 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7057 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7058 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7059 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7060 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7061 /// `err` or `result` depending on the state of `result_ok`.
7062 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
7063 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7064 pub result_ok: bool,
7067 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
7068 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7069 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7070 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7071 result: Box::into_raw(Box::new(o)),
7077 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
7078 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7079 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7080 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7081 err: Box::into_raw(Box::new(e)),
7087 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
7088 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
7089 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7090 fn drop(&mut self) {
7092 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7093 let _ = unsafe { Box::from_raw(self.contents.result) };
7096 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7097 let _ = unsafe { Box::from_raw(self.contents.err) };
7102 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7103 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7104 let contents = if o.result_ok {
7105 let result = unsafe { o.contents.result };
7106 unsafe { o.contents.result = std::ptr::null_mut() };
7107 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
7109 let err = unsafe { o.contents.err };
7110 unsafe { o.contents.err = std::ptr::null_mut(); }
7111 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
7115 result_ok: o.result_ok,
7119 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7120 fn clone(&self) -> Self {
7122 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7123 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
7126 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7127 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7133 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
7134 /// but with all dynamically-allocated buffers duplicated in new buffers.
7135 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
7137 /// The contents of CResult_UpdateFeeDecodeErrorZ
7138 pub union CResult_UpdateFeeDecodeErrorZPtr {
7139 /// A pointer to the contents in the success state.
7140 /// Reading from this pointer when `result_ok` is not set is undefined.
7141 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
7142 /// A pointer to the contents in the error state.
7143 /// Reading from this pointer when `result_ok` is set is undefined.
7144 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7147 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7148 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7150 pub struct CResult_UpdateFeeDecodeErrorZ {
7151 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7152 /// `err` or `result` depending on the state of `result_ok`.
7153 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
7154 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7155 pub result_ok: bool,
7158 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
7159 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
7160 CResult_UpdateFeeDecodeErrorZ {
7161 contents: CResult_UpdateFeeDecodeErrorZPtr {
7162 result: Box::into_raw(Box::new(o)),
7168 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
7169 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
7170 CResult_UpdateFeeDecodeErrorZ {
7171 contents: CResult_UpdateFeeDecodeErrorZPtr {
7172 err: Box::into_raw(Box::new(e)),
7178 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
7179 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
7180 impl Drop for CResult_UpdateFeeDecodeErrorZ {
7181 fn drop(&mut self) {
7183 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7184 let _ = unsafe { Box::from_raw(self.contents.result) };
7187 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7188 let _ = unsafe { Box::from_raw(self.contents.err) };
7193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
7194 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
7195 let contents = if o.result_ok {
7196 let result = unsafe { o.contents.result };
7197 unsafe { o.contents.result = std::ptr::null_mut() };
7198 CResult_UpdateFeeDecodeErrorZPtr { result }
7200 let err = unsafe { o.contents.err };
7201 unsafe { o.contents.err = std::ptr::null_mut(); }
7202 CResult_UpdateFeeDecodeErrorZPtr { err }
7206 result_ok: o.result_ok,
7210 impl Clone for CResult_UpdateFeeDecodeErrorZ {
7211 fn clone(&self) -> Self {
7213 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
7214 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
7217 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
7218 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7224 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
7225 /// but with all dynamically-allocated buffers duplicated in new buffers.
7226 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
7228 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7229 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7230 /// A pointer to the contents in the success state.
7231 /// Reading from this pointer when `result_ok` is not set is undefined.
7232 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
7233 /// A pointer to the contents in the error state.
7234 /// Reading from this pointer when `result_ok` is set is undefined.
7235 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7238 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7239 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7241 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
7242 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7243 /// `err` or `result` depending on the state of `result_ok`.
7244 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
7245 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7246 pub result_ok: bool,
7249 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
7250 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7251 CResult_UpdateFulfillHTLCDecodeErrorZ {
7252 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7253 result: Box::into_raw(Box::new(o)),
7259 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
7260 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7261 CResult_UpdateFulfillHTLCDecodeErrorZ {
7262 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7263 err: Box::into_raw(Box::new(e)),
7269 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
7270 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
7271 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
7272 fn drop(&mut self) {
7274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7275 let _ = unsafe { Box::from_raw(self.contents.result) };
7278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7279 let _ = unsafe { Box::from_raw(self.contents.err) };
7284 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
7285 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7286 let contents = if o.result_ok {
7287 let result = unsafe { o.contents.result };
7288 unsafe { o.contents.result = std::ptr::null_mut() };
7289 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
7291 let err = unsafe { o.contents.err };
7292 unsafe { o.contents.err = std::ptr::null_mut(); }
7293 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
7297 result_ok: o.result_ok,
7301 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
7302 fn clone(&self) -> Self {
7304 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7305 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
7308 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7309 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7315 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
7316 /// but with all dynamically-allocated buffers duplicated in new buffers.
7317 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
7319 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
7320 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
7321 /// A pointer to the contents in the success state.
7322 /// Reading from this pointer when `result_ok` is not set is undefined.
7323 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
7324 /// A pointer to the contents in the error state.
7325 /// Reading from this pointer when `result_ok` is set is undefined.
7326 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7329 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7330 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7332 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
7333 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7334 /// `err` or `result` depending on the state of `result_ok`.
7335 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
7336 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7337 pub result_ok: bool,
7340 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
7341 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
7342 CResult_UpdateAddHTLCDecodeErrorZ {
7343 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7344 result: Box::into_raw(Box::new(o)),
7350 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
7351 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
7352 CResult_UpdateAddHTLCDecodeErrorZ {
7353 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7354 err: Box::into_raw(Box::new(e)),
7360 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
7361 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
7362 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
7363 fn drop(&mut self) {
7365 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7366 let _ = unsafe { Box::from_raw(self.contents.result) };
7369 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7370 let _ = unsafe { Box::from_raw(self.contents.err) };
7375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
7376 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7377 let contents = if o.result_ok {
7378 let result = unsafe { o.contents.result };
7379 unsafe { o.contents.result = std::ptr::null_mut() };
7380 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
7382 let err = unsafe { o.contents.err };
7383 unsafe { o.contents.err = std::ptr::null_mut(); }
7384 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
7388 result_ok: o.result_ok,
7392 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
7393 fn clone(&self) -> Self {
7395 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7396 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
7399 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7400 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7406 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
7407 /// but with all dynamically-allocated buffers duplicated in new buffers.
7408 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
7410 /// The contents of CResult_PingDecodeErrorZ
7411 pub union CResult_PingDecodeErrorZPtr {
7412 /// A pointer to the contents in the success state.
7413 /// Reading from this pointer when `result_ok` is not set is undefined.
7414 pub result: *mut crate::lightning::ln::msgs::Ping,
7415 /// A pointer to the contents in the error state.
7416 /// Reading from this pointer when `result_ok` is set is undefined.
7417 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7420 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7421 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
7422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7423 pub struct CResult_PingDecodeErrorZ {
7424 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
7425 /// `err` or `result` depending on the state of `result_ok`.
7426 pub contents: CResult_PingDecodeErrorZPtr,
7427 /// Whether this CResult_PingDecodeErrorZ represents a success state.
7428 pub result_ok: bool,
7431 /// Creates a new CResult_PingDecodeErrorZ in the success state.
7432 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
7433 CResult_PingDecodeErrorZ {
7434 contents: CResult_PingDecodeErrorZPtr {
7435 result: Box::into_raw(Box::new(o)),
7441 /// Creates a new CResult_PingDecodeErrorZ in the error state.
7442 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
7443 CResult_PingDecodeErrorZ {
7444 contents: CResult_PingDecodeErrorZPtr {
7445 err: Box::into_raw(Box::new(e)),
7451 /// Frees any resources used by the CResult_PingDecodeErrorZ.
7452 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
7453 impl Drop for CResult_PingDecodeErrorZ {
7454 fn drop(&mut self) {
7456 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7457 let _ = unsafe { Box::from_raw(self.contents.result) };
7460 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7461 let _ = unsafe { Box::from_raw(self.contents.err) };
7466 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
7467 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
7468 let contents = if o.result_ok {
7469 let result = unsafe { o.contents.result };
7470 unsafe { o.contents.result = std::ptr::null_mut() };
7471 CResult_PingDecodeErrorZPtr { result }
7473 let err = unsafe { o.contents.err };
7474 unsafe { o.contents.err = std::ptr::null_mut(); }
7475 CResult_PingDecodeErrorZPtr { err }
7479 result_ok: o.result_ok,
7483 impl Clone for CResult_PingDecodeErrorZ {
7484 fn clone(&self) -> Self {
7486 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
7487 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
7490 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
7491 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7497 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
7498 /// but with all dynamically-allocated buffers duplicated in new buffers.
7499 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
7501 /// The contents of CResult_PongDecodeErrorZ
7502 pub union CResult_PongDecodeErrorZPtr {
7503 /// A pointer to the contents in the success state.
7504 /// Reading from this pointer when `result_ok` is not set is undefined.
7505 pub result: *mut crate::lightning::ln::msgs::Pong,
7506 /// A pointer to the contents in the error state.
7507 /// Reading from this pointer when `result_ok` is set is undefined.
7508 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7511 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7512 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
7513 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7514 pub struct CResult_PongDecodeErrorZ {
7515 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
7516 /// `err` or `result` depending on the state of `result_ok`.
7517 pub contents: CResult_PongDecodeErrorZPtr,
7518 /// Whether this CResult_PongDecodeErrorZ represents a success state.
7519 pub result_ok: bool,
7522 /// Creates a new CResult_PongDecodeErrorZ in the success state.
7523 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
7524 CResult_PongDecodeErrorZ {
7525 contents: CResult_PongDecodeErrorZPtr {
7526 result: Box::into_raw(Box::new(o)),
7532 /// Creates a new CResult_PongDecodeErrorZ in the error state.
7533 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
7534 CResult_PongDecodeErrorZ {
7535 contents: CResult_PongDecodeErrorZPtr {
7536 err: Box::into_raw(Box::new(e)),
7542 /// Frees any resources used by the CResult_PongDecodeErrorZ.
7543 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
7544 impl Drop for CResult_PongDecodeErrorZ {
7545 fn drop(&mut self) {
7547 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7548 let _ = unsafe { Box::from_raw(self.contents.result) };
7551 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7552 let _ = unsafe { Box::from_raw(self.contents.err) };
7557 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
7558 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
7559 let contents = if o.result_ok {
7560 let result = unsafe { o.contents.result };
7561 unsafe { o.contents.result = std::ptr::null_mut() };
7562 CResult_PongDecodeErrorZPtr { result }
7564 let err = unsafe { o.contents.err };
7565 unsafe { o.contents.err = std::ptr::null_mut(); }
7566 CResult_PongDecodeErrorZPtr { err }
7570 result_ok: o.result_ok,
7574 impl Clone for CResult_PongDecodeErrorZ {
7575 fn clone(&self) -> Self {
7577 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
7578 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
7581 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
7582 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7588 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
7589 /// but with all dynamically-allocated buffers duplicated in new buffers.
7590 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
7592 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7593 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7594 /// A pointer to the contents in the success state.
7595 /// Reading from this pointer when `result_ok` is not set is undefined.
7596 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
7597 /// A pointer to the contents in the error state.
7598 /// Reading from this pointer when `result_ok` is set is undefined.
7599 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7602 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7603 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7605 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7606 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7607 /// `err` or `result` depending on the state of `result_ok`.
7608 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
7609 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7610 pub result_ok: bool,
7613 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
7614 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7615 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7616 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7617 result: Box::into_raw(Box::new(o)),
7623 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
7624 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7625 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7626 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7627 err: Box::into_raw(Box::new(e)),
7633 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
7634 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
7635 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7636 fn drop(&mut self) {
7638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7639 let _ = unsafe { Box::from_raw(self.contents.result) };
7642 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7643 let _ = unsafe { Box::from_raw(self.contents.err) };
7648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7649 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
7650 let contents = if o.result_ok {
7651 let result = unsafe { o.contents.result };
7652 unsafe { o.contents.result = std::ptr::null_mut() };
7653 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
7655 let err = unsafe { o.contents.err };
7656 unsafe { o.contents.err = std::ptr::null_mut(); }
7657 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
7661 result_ok: o.result_ok,
7665 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7666 fn clone(&self) -> Self {
7668 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7669 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7672 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7673 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7679 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7680 /// but with all dynamically-allocated buffers duplicated in new buffers.
7681 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
7683 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
7684 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
7685 /// A pointer to the contents in the success state.
7686 /// Reading from this pointer when `result_ok` is not set is undefined.
7687 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
7688 /// A pointer to the contents in the error state.
7689 /// Reading from this pointer when `result_ok` is set is undefined.
7690 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7693 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7694 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7696 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
7697 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7698 /// `err` or `result` depending on the state of `result_ok`.
7699 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
7700 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7701 pub result_ok: bool,
7704 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
7705 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
7706 CResult_ChannelAnnouncementDecodeErrorZ {
7707 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7708 result: Box::into_raw(Box::new(o)),
7714 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
7715 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
7716 CResult_ChannelAnnouncementDecodeErrorZ {
7717 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7718 err: Box::into_raw(Box::new(e)),
7724 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
7725 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
7726 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
7727 fn drop(&mut self) {
7729 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7730 let _ = unsafe { Box::from_raw(self.contents.result) };
7733 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7734 let _ = unsafe { Box::from_raw(self.contents.err) };
7739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
7740 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
7741 let contents = if o.result_ok {
7742 let result = unsafe { o.contents.result };
7743 unsafe { o.contents.result = std::ptr::null_mut() };
7744 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
7746 let err = unsafe { o.contents.err };
7747 unsafe { o.contents.err = std::ptr::null_mut(); }
7748 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
7752 result_ok: o.result_ok,
7756 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
7757 fn clone(&self) -> Self {
7759 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7760 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7763 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7764 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7770 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7771 /// but with all dynamically-allocated buffers duplicated in new buffers.
7772 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
7774 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
7775 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7776 /// A pointer to the contents in the success state.
7777 /// Reading from this pointer when `result_ok` is not set is undefined.
7778 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
7779 /// A pointer to the contents in the error state.
7780 /// Reading from this pointer when `result_ok` is set is undefined.
7781 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7784 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7785 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7787 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
7788 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
7789 /// `err` or `result` depending on the state of `result_ok`.
7790 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
7791 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
7792 pub result_ok: bool,
7795 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
7796 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
7797 CResult_UnsignedChannelUpdateDecodeErrorZ {
7798 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7799 result: Box::into_raw(Box::new(o)),
7805 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
7806 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
7807 CResult_UnsignedChannelUpdateDecodeErrorZ {
7808 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7809 err: Box::into_raw(Box::new(e)),
7815 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
7816 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
7817 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
7818 fn drop(&mut self) {
7820 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7821 let _ = unsafe { Box::from_raw(self.contents.result) };
7824 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7825 let _ = unsafe { Box::from_raw(self.contents.err) };
7830 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
7831 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7832 let contents = if o.result_ok {
7833 let result = unsafe { o.contents.result };
7834 unsafe { o.contents.result = std::ptr::null_mut() };
7835 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
7837 let err = unsafe { o.contents.err };
7838 unsafe { o.contents.err = std::ptr::null_mut(); }
7839 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
7843 result_ok: o.result_ok,
7847 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
7848 fn clone(&self) -> Self {
7850 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7851 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
7854 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7855 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7861 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
7862 /// but with all dynamically-allocated buffers duplicated in new buffers.
7863 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
7865 /// The contents of CResult_ChannelUpdateDecodeErrorZ
7866 pub union CResult_ChannelUpdateDecodeErrorZPtr {
7867 /// A pointer to the contents in the success state.
7868 /// Reading from this pointer when `result_ok` is not set is undefined.
7869 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
7870 /// A pointer to the contents in the error state.
7871 /// Reading from this pointer when `result_ok` is set is undefined.
7872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7875 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7876 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7878 pub struct CResult_ChannelUpdateDecodeErrorZ {
7879 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
7880 /// `err` or `result` depending on the state of `result_ok`.
7881 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
7882 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
7883 pub result_ok: bool,
7886 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
7887 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
7888 CResult_ChannelUpdateDecodeErrorZ {
7889 contents: CResult_ChannelUpdateDecodeErrorZPtr {
7890 result: Box::into_raw(Box::new(o)),
7896 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
7897 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
7898 CResult_ChannelUpdateDecodeErrorZ {
7899 contents: CResult_ChannelUpdateDecodeErrorZPtr {
7900 err: Box::into_raw(Box::new(e)),
7906 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
7907 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
7908 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
7909 fn drop(&mut self) {
7911 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7912 let _ = unsafe { Box::from_raw(self.contents.result) };
7915 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7916 let _ = unsafe { Box::from_raw(self.contents.err) };
7921 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
7922 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7923 let contents = if o.result_ok {
7924 let result = unsafe { o.contents.result };
7925 unsafe { o.contents.result = std::ptr::null_mut() };
7926 CResult_ChannelUpdateDecodeErrorZPtr { result }
7928 let err = unsafe { o.contents.err };
7929 unsafe { o.contents.err = std::ptr::null_mut(); }
7930 CResult_ChannelUpdateDecodeErrorZPtr { err }
7934 result_ok: o.result_ok,
7938 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
7939 fn clone(&self) -> Self {
7941 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7942 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
7945 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7946 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7952 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
7953 /// but with all dynamically-allocated buffers duplicated in new buffers.
7954 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
7956 /// The contents of CResult_ErrorMessageDecodeErrorZ
7957 pub union CResult_ErrorMessageDecodeErrorZPtr {
7958 /// A pointer to the contents in the success state.
7959 /// Reading from this pointer when `result_ok` is not set is undefined.
7960 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
7961 /// A pointer to the contents in the error state.
7962 /// Reading from this pointer when `result_ok` is set is undefined.
7963 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7966 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7967 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
7968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7969 pub struct CResult_ErrorMessageDecodeErrorZ {
7970 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7971 /// `err` or `result` depending on the state of `result_ok`.
7972 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
7973 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7974 pub result_ok: bool,
7977 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
7978 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
7979 CResult_ErrorMessageDecodeErrorZ {
7980 contents: CResult_ErrorMessageDecodeErrorZPtr {
7981 result: Box::into_raw(Box::new(o)),
7987 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
7988 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
7989 CResult_ErrorMessageDecodeErrorZ {
7990 contents: CResult_ErrorMessageDecodeErrorZPtr {
7991 err: Box::into_raw(Box::new(e)),
7997 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
7998 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
7999 impl Drop for CResult_ErrorMessageDecodeErrorZ {
8000 fn drop(&mut self) {
8002 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8003 let _ = unsafe { Box::from_raw(self.contents.result) };
8006 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8007 let _ = unsafe { Box::from_raw(self.contents.err) };
8012 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
8013 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
8014 let contents = if o.result_ok {
8015 let result = unsafe { o.contents.result };
8016 unsafe { o.contents.result = std::ptr::null_mut() };
8017 CResult_ErrorMessageDecodeErrorZPtr { result }
8019 let err = unsafe { o.contents.err };
8020 unsafe { o.contents.err = std::ptr::null_mut(); }
8021 CResult_ErrorMessageDecodeErrorZPtr { err }
8025 result_ok: o.result_ok,
8029 impl Clone for CResult_ErrorMessageDecodeErrorZ {
8030 fn clone(&self) -> Self {
8032 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
8033 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
8036 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
8037 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8043 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
8044 /// but with all dynamically-allocated buffers duplicated in new buffers.
8045 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
8047 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8048 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8049 /// A pointer to the contents in the success state.
8050 /// Reading from this pointer when `result_ok` is not set is undefined.
8051 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
8052 /// A pointer to the contents in the error state.
8053 /// Reading from this pointer when `result_ok` is set is undefined.
8054 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8057 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8058 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8059 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8060 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8061 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8062 /// `err` or `result` depending on the state of `result_ok`.
8063 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
8064 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8065 pub result_ok: bool,
8068 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
8069 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8070 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8071 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8072 result: Box::into_raw(Box::new(o)),
8078 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
8079 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8080 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8081 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8082 err: Box::into_raw(Box::new(e)),
8088 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
8089 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
8090 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8091 fn drop(&mut self) {
8093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8094 let _ = unsafe { Box::from_raw(self.contents.result) };
8097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8098 let _ = unsafe { Box::from_raw(self.contents.err) };
8103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8104 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8105 let contents = if o.result_ok {
8106 let result = unsafe { o.contents.result };
8107 unsafe { o.contents.result = std::ptr::null_mut() };
8108 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
8110 let err = unsafe { o.contents.err };
8111 unsafe { o.contents.err = std::ptr::null_mut(); }
8112 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
8116 result_ok: o.result_ok,
8120 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8121 fn clone(&self) -> Self {
8123 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8124 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8127 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8128 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8134 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
8135 /// but with all dynamically-allocated buffers duplicated in new buffers.
8136 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
8138 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
8139 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
8140 /// A pointer to the contents in the success state.
8141 /// Reading from this pointer when `result_ok` is not set is undefined.
8142 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
8143 /// A pointer to the contents in the error state.
8144 /// Reading from this pointer when `result_ok` is set is undefined.
8145 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8148 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8149 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8151 pub struct CResult_NodeAnnouncementDecodeErrorZ {
8152 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8153 /// `err` or `result` depending on the state of `result_ok`.
8154 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
8155 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8156 pub result_ok: bool,
8159 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
8160 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
8161 CResult_NodeAnnouncementDecodeErrorZ {
8162 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8163 result: Box::into_raw(Box::new(o)),
8169 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
8170 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
8171 CResult_NodeAnnouncementDecodeErrorZ {
8172 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8173 err: Box::into_raw(Box::new(e)),
8179 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
8180 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
8181 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
8182 fn drop(&mut self) {
8184 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8185 let _ = unsafe { Box::from_raw(self.contents.result) };
8188 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8189 let _ = unsafe { Box::from_raw(self.contents.err) };
8194 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
8195 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8196 let contents = if o.result_ok {
8197 let result = unsafe { o.contents.result };
8198 unsafe { o.contents.result = std::ptr::null_mut() };
8199 CResult_NodeAnnouncementDecodeErrorZPtr { result }
8201 let err = unsafe { o.contents.err };
8202 unsafe { o.contents.err = std::ptr::null_mut(); }
8203 CResult_NodeAnnouncementDecodeErrorZPtr { err }
8207 result_ok: o.result_ok,
8211 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
8212 fn clone(&self) -> Self {
8214 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8215 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8218 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8219 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8225 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
8226 /// but with all dynamically-allocated buffers duplicated in new buffers.
8227 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
8229 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8230 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
8231 /// A pointer to the contents in the success state.
8232 /// Reading from this pointer when `result_ok` is not set is undefined.
8233 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
8234 /// A pointer to the contents in the error state.
8235 /// Reading from this pointer when `result_ok` is set is undefined.
8236 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8239 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8240 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
8241 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8242 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
8243 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8244 /// `err` or `result` depending on the state of `result_ok`.
8245 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
8246 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8247 pub result_ok: bool,
8250 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
8251 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8252 CResult_QueryShortChannelIdsDecodeErrorZ {
8253 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8254 result: Box::into_raw(Box::new(o)),
8260 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
8261 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8262 CResult_QueryShortChannelIdsDecodeErrorZ {
8263 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8264 err: Box::into_raw(Box::new(e)),
8270 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
8271 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
8272 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
8273 fn drop(&mut self) {
8275 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8276 let _ = unsafe { Box::from_raw(self.contents.result) };
8279 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8280 let _ = unsafe { Box::from_raw(self.contents.err) };
8285 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
8286 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
8287 let contents = if o.result_ok {
8288 let result = unsafe { o.contents.result };
8289 unsafe { o.contents.result = std::ptr::null_mut() };
8290 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
8292 let err = unsafe { o.contents.err };
8293 unsafe { o.contents.err = std::ptr::null_mut(); }
8294 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
8298 result_ok: o.result_ok,
8302 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
8303 fn clone(&self) -> Self {
8305 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8306 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
8309 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8310 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8316 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
8317 /// but with all dynamically-allocated buffers duplicated in new buffers.
8318 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
8320 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8321 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8322 /// A pointer to the contents in the success state.
8323 /// Reading from this pointer when `result_ok` is not set is undefined.
8324 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
8325 /// A pointer to the contents in the error state.
8326 /// Reading from this pointer when `result_ok` is set is undefined.
8327 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8330 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8331 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
8332 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8333 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8334 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8335 /// `err` or `result` depending on the state of `result_ok`.
8336 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
8337 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8338 pub result_ok: bool,
8341 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
8342 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8343 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8344 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8345 result: Box::into_raw(Box::new(o)),
8351 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
8352 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8353 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8354 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8355 err: Box::into_raw(Box::new(e)),
8361 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
8362 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
8363 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8364 fn drop(&mut self) {
8366 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8367 let _ = unsafe { Box::from_raw(self.contents.result) };
8370 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8371 let _ = unsafe { Box::from_raw(self.contents.err) };
8376 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8377 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
8378 let contents = if o.result_ok {
8379 let result = unsafe { o.contents.result };
8380 unsafe { o.contents.result = std::ptr::null_mut() };
8381 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
8383 let err = unsafe { o.contents.err };
8384 unsafe { o.contents.err = std::ptr::null_mut(); }
8385 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
8389 result_ok: o.result_ok,
8393 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8394 fn clone(&self) -> Self {
8396 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8397 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
8400 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8401 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8407 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
8408 /// but with all dynamically-allocated buffers duplicated in new buffers.
8409 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
8411 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
8412 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
8413 /// A pointer to the contents in the success state.
8414 /// Reading from this pointer when `result_ok` is not set is undefined.
8415 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
8416 /// A pointer to the contents in the error state.
8417 /// Reading from this pointer when `result_ok` is set is undefined.
8418 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8421 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8422 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8424 pub struct CResult_QueryChannelRangeDecodeErrorZ {
8425 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8426 /// `err` or `result` depending on the state of `result_ok`.
8427 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
8428 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8429 pub result_ok: bool,
8432 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
8433 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
8434 CResult_QueryChannelRangeDecodeErrorZ {
8435 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8436 result: Box::into_raw(Box::new(o)),
8442 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
8443 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
8444 CResult_QueryChannelRangeDecodeErrorZ {
8445 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8446 err: Box::into_raw(Box::new(e)),
8452 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
8453 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
8454 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
8455 fn drop(&mut self) {
8457 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8458 let _ = unsafe { Box::from_raw(self.contents.result) };
8461 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8462 let _ = unsafe { Box::from_raw(self.contents.err) };
8467 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
8468 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8469 let contents = if o.result_ok {
8470 let result = unsafe { o.contents.result };
8471 unsafe { o.contents.result = std::ptr::null_mut() };
8472 CResult_QueryChannelRangeDecodeErrorZPtr { result }
8474 let err = unsafe { o.contents.err };
8475 unsafe { o.contents.err = std::ptr::null_mut(); }
8476 CResult_QueryChannelRangeDecodeErrorZPtr { err }
8480 result_ok: o.result_ok,
8484 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
8485 fn clone(&self) -> Self {
8487 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8488 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
8491 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8492 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8498 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
8499 /// but with all dynamically-allocated buffers duplicated in new buffers.
8500 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
8502 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
8503 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
8504 /// A pointer to the contents in the success state.
8505 /// Reading from this pointer when `result_ok` is not set is undefined.
8506 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
8507 /// A pointer to the contents in the error state.
8508 /// Reading from this pointer when `result_ok` is set is undefined.
8509 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8512 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8513 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8515 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
8516 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8517 /// `err` or `result` depending on the state of `result_ok`.
8518 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
8519 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8520 pub result_ok: bool,
8523 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
8524 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
8525 CResult_ReplyChannelRangeDecodeErrorZ {
8526 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8527 result: Box::into_raw(Box::new(o)),
8533 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
8534 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
8535 CResult_ReplyChannelRangeDecodeErrorZ {
8536 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8537 err: Box::into_raw(Box::new(e)),
8543 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
8544 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
8545 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
8546 fn drop(&mut self) {
8548 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8549 let _ = unsafe { Box::from_raw(self.contents.result) };
8552 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8553 let _ = unsafe { Box::from_raw(self.contents.err) };
8558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
8559 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8560 let contents = if o.result_ok {
8561 let result = unsafe { o.contents.result };
8562 unsafe { o.contents.result = std::ptr::null_mut() };
8563 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
8565 let err = unsafe { o.contents.err };
8566 unsafe { o.contents.err = std::ptr::null_mut(); }
8567 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
8571 result_ok: o.result_ok,
8575 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
8576 fn clone(&self) -> Self {
8578 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8579 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
8582 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8583 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8589 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
8590 /// but with all dynamically-allocated buffers duplicated in new buffers.
8591 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
8593 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
8594 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
8595 /// A pointer to the contents in the success state.
8596 /// Reading from this pointer when `result_ok` is not set is undefined.
8597 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
8598 /// A pointer to the contents in the error state.
8599 /// Reading from this pointer when `result_ok` is set is undefined.
8600 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8603 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8604 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
8605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8606 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
8607 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8608 /// `err` or `result` depending on the state of `result_ok`.
8609 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
8610 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8611 pub result_ok: bool,
8614 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
8615 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
8616 CResult_GossipTimestampFilterDecodeErrorZ {
8617 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8618 result: Box::into_raw(Box::new(o)),
8624 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
8625 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
8626 CResult_GossipTimestampFilterDecodeErrorZ {
8627 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8628 err: Box::into_raw(Box::new(e)),
8634 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
8635 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
8636 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
8637 fn drop(&mut self) {
8639 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8640 let _ = unsafe { Box::from_raw(self.contents.result) };
8643 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8644 let _ = unsafe { Box::from_raw(self.contents.err) };
8649 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
8650 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
8651 let contents = if o.result_ok {
8652 let result = unsafe { o.contents.result };
8653 unsafe { o.contents.result = std::ptr::null_mut() };
8654 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
8656 let err = unsafe { o.contents.err };
8657 unsafe { o.contents.err = std::ptr::null_mut(); }
8658 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
8662 result_ok: o.result_ok,
8666 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
8667 fn clone(&self) -> Self {
8669 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8670 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
8673 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8674 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8680 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
8681 /// but with all dynamically-allocated buffers duplicated in new buffers.
8682 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
8684 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
8685 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8686 /// A pointer to the contents in the success state.
8687 /// Reading from this pointer when `result_ok` is not set is undefined.
8688 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
8689 /// A pointer to the contents in the error state.
8690 /// Reading from this pointer when `result_ok` is set is undefined.
8691 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8694 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
8695 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
8696 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8697 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
8698 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
8699 /// `err` or `result` depending on the state of `result_ok`.
8700 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
8701 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
8702 pub result_ok: bool,
8705 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
8706 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
8707 CResult_SpendableOutputDescriptorDecodeErrorZ {
8708 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8709 result: Box::into_raw(Box::new(o)),
8715 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
8716 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
8717 CResult_SpendableOutputDescriptorDecodeErrorZ {
8718 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8719 err: Box::into_raw(Box::new(e)),
8725 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
8726 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
8727 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
8728 fn drop(&mut self) {
8730 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8731 let _ = unsafe { Box::from_raw(self.contents.result) };
8734 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8735 let _ = unsafe { Box::from_raw(self.contents.err) };
8740 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
8741 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
8742 let contents = if o.result_ok {
8743 let result = unsafe { o.contents.result };
8744 unsafe { o.contents.result = std::ptr::null_mut() };
8745 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
8747 let err = unsafe { o.contents.err };
8748 unsafe { o.contents.err = std::ptr::null_mut(); }
8749 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
8753 result_ok: o.result_ok,
8757 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
8758 fn clone(&self) -> Self {
8760 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8761 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
8764 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8765 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8771 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
8772 /// but with all dynamically-allocated buffers duplicated in new buffers.
8773 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
8775 /// A tuple of 2 elements. See the individual fields for the types contained.
8776 pub struct C2Tuple_SignatureCVec_SignatureZZ {
8777 /// The element at position 0
8778 pub a: crate::c_types::Signature,
8779 /// The element at position 1
8780 pub b: crate::c_types::derived::CVec_SignatureZ,
8782 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
8783 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
8790 impl C2Tuple_SignatureCVec_SignatureZZ {
8791 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
8795 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
8796 fn clone(&self) -> Self {
8804 /// Creates a new tuple which has the same data as `orig`
8805 /// but with all dynamically-allocated buffers duplicated in new buffers.
8806 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
8807 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
8809 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
8810 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
8814 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
8815 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
8817 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
8818 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8819 /// A pointer to the contents in the success state.
8820 /// Reading from this pointer when `result_ok` is not set is undefined.
8821 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
8822 /// Note that this value is always NULL, as there are no contents in the Err variant
8823 pub err: *mut std::ffi::c_void,
8826 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
8827 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
8828 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8829 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8830 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
8831 /// `err` or `result` depending on the state of `result_ok`.
8832 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
8833 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
8834 pub result_ok: bool,
8837 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
8838 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8839 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8840 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8841 result: Box::into_raw(Box::new(o)),
8847 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
8848 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8849 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8850 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8851 err: std::ptr::null_mut(),
8857 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
8858 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
8859 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8860 fn drop(&mut self) {
8862 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8863 let _ = unsafe { Box::from_raw(self.contents.result) };
8869 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8870 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
8871 let contents = if o.result_ok {
8872 let result = unsafe { o.contents.result };
8873 unsafe { o.contents.result = std::ptr::null_mut() };
8874 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
8876 let _ = unsafe { Box::from_raw(o.contents.err) };
8877 o.contents.err = std::ptr::null_mut();
8878 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
8882 result_ok: o.result_ok,
8886 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8887 fn clone(&self) -> Self {
8889 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8890 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
8893 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8894 err: std::ptr::null_mut()
8900 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
8901 /// but with all dynamically-allocated buffers duplicated in new buffers.
8902 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
8904 /// The contents of CResult_SignatureNoneZ
8905 pub union CResult_SignatureNoneZPtr {
8906 /// A pointer to the contents in the success state.
8907 /// Reading from this pointer when `result_ok` is not set is undefined.
8908 pub result: *mut crate::c_types::Signature,
8909 /// Note that this value is always NULL, as there are no contents in the Err variant
8910 pub err: *mut std::ffi::c_void,
8913 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
8914 /// containing a crate::c_types::Signature on success and a () on failure.
8915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8916 pub struct CResult_SignatureNoneZ {
8917 /// The contents of this CResult_SignatureNoneZ, accessible via either
8918 /// `err` or `result` depending on the state of `result_ok`.
8919 pub contents: CResult_SignatureNoneZPtr,
8920 /// Whether this CResult_SignatureNoneZ represents a success state.
8921 pub result_ok: bool,
8924 /// Creates a new CResult_SignatureNoneZ in the success state.
8925 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
8926 CResult_SignatureNoneZ {
8927 contents: CResult_SignatureNoneZPtr {
8928 result: Box::into_raw(Box::new(o)),
8934 /// Creates a new CResult_SignatureNoneZ in the error state.
8935 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
8936 CResult_SignatureNoneZ {
8937 contents: CResult_SignatureNoneZPtr {
8938 err: std::ptr::null_mut(),
8944 /// Frees any resources used by the CResult_SignatureNoneZ.
8945 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
8946 impl Drop for CResult_SignatureNoneZ {
8947 fn drop(&mut self) {
8949 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8950 let _ = unsafe { Box::from_raw(self.contents.result) };
8956 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
8957 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
8958 let contents = if o.result_ok {
8959 let result = unsafe { o.contents.result };
8960 unsafe { o.contents.result = std::ptr::null_mut() };
8961 CResult_SignatureNoneZPtr { result }
8963 let _ = unsafe { Box::from_raw(o.contents.err) };
8964 o.contents.err = std::ptr::null_mut();
8965 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
8969 result_ok: o.result_ok,
8973 impl Clone for CResult_SignatureNoneZ {
8974 fn clone(&self) -> Self {
8976 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
8977 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
8980 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
8981 err: std::ptr::null_mut()
8987 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
8988 /// but with all dynamically-allocated buffers duplicated in new buffers.
8989 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
8991 /// The contents of CResult_SignDecodeErrorZ
8992 pub union CResult_SignDecodeErrorZPtr {
8993 /// A pointer to the contents in the success state.
8994 /// Reading from this pointer when `result_ok` is not set is undefined.
8995 pub result: *mut crate::lightning::chain::keysinterface::Sign,
8996 /// A pointer to the contents in the error state.
8997 /// Reading from this pointer when `result_ok` is set is undefined.
8998 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9001 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
9002 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
9003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9004 pub struct CResult_SignDecodeErrorZ {
9005 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
9006 /// `err` or `result` depending on the state of `result_ok`.
9007 pub contents: CResult_SignDecodeErrorZPtr,
9008 /// Whether this CResult_SignDecodeErrorZ represents a success state.
9009 pub result_ok: bool,
9012 /// Creates a new CResult_SignDecodeErrorZ in the success state.
9013 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
9014 CResult_SignDecodeErrorZ {
9015 contents: CResult_SignDecodeErrorZPtr {
9016 result: Box::into_raw(Box::new(o)),
9022 /// Creates a new CResult_SignDecodeErrorZ in the error state.
9023 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
9024 CResult_SignDecodeErrorZ {
9025 contents: CResult_SignDecodeErrorZPtr {
9026 err: Box::into_raw(Box::new(e)),
9032 /// Frees any resources used by the CResult_SignDecodeErrorZ.
9033 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
9034 impl Drop for CResult_SignDecodeErrorZ {
9035 fn drop(&mut self) {
9037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9038 let _ = unsafe { Box::from_raw(self.contents.result) };
9041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9042 let _ = unsafe { Box::from_raw(self.contents.err) };
9047 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
9048 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
9049 let contents = if o.result_ok {
9050 let result = unsafe { o.contents.result };
9051 unsafe { o.contents.result = std::ptr::null_mut() };
9052 CResult_SignDecodeErrorZPtr { result }
9054 let err = unsafe { o.contents.err };
9055 unsafe { o.contents.err = std::ptr::null_mut(); }
9056 CResult_SignDecodeErrorZPtr { err }
9060 result_ok: o.result_ok,
9064 impl Clone for CResult_SignDecodeErrorZ {
9065 fn clone(&self) -> Self {
9067 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
9068 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
9071 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
9072 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9078 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9079 /// but with all dynamically-allocated buffers duplicated in new buffers.
9080 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
9082 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
9083 /// This corresponds to std::vector in C++
9084 pub struct CVec_CVec_u8ZZ {
9085 /// The elements in the array.
9086 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9087 pub data: *mut crate::c_types::derived::CVec_u8Z,
9088 /// The number of elements pointed to by `data`.
9091 impl CVec_CVec_u8ZZ {
9092 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
9093 if self.datalen == 0 { return Vec::new(); }
9094 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9095 self.data = std::ptr::null_mut();
9099 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
9100 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9103 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
9104 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
9105 let datalen = v.len();
9106 let data = Box::into_raw(v.into_boxed_slice());
9107 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9111 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9112 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
9113 impl Drop for CVec_CVec_u8ZZ {
9114 fn drop(&mut self) {
9115 if self.datalen == 0 { return; }
9116 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9119 impl Clone for CVec_CVec_u8ZZ {
9120 fn clone(&self) -> Self {
9121 let mut res = Vec::new();
9122 if self.datalen == 0 { return Self::from(res); }
9123 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9128 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
9129 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
9130 /// A pointer to the contents in the success state.
9131 /// Reading from this pointer when `result_ok` is not set is undefined.
9132 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
9133 /// Note that this value is always NULL, as there are no contents in the Err variant
9134 pub err: *mut std::ffi::c_void,
9137 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
9138 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
9139 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9140 pub struct CResult_CVec_CVec_u8ZZNoneZ {
9141 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
9142 /// `err` or `result` depending on the state of `result_ok`.
9143 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
9144 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
9145 pub result_ok: bool,
9148 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9149 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
9150 CResult_CVec_CVec_u8ZZNoneZ {
9151 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9152 result: Box::into_raw(Box::new(o)),
9158 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9159 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
9160 CResult_CVec_CVec_u8ZZNoneZ {
9161 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9162 err: std::ptr::null_mut(),
9168 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9169 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
9170 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
9171 fn drop(&mut self) {
9173 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9174 let _ = unsafe { Box::from_raw(self.contents.result) };
9180 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
9181 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
9182 let contents = if o.result_ok {
9183 let result = unsafe { o.contents.result };
9184 unsafe { o.contents.result = std::ptr::null_mut() };
9185 CResult_CVec_CVec_u8ZZNoneZPtr { result }
9187 let _ = unsafe { Box::from_raw(o.contents.err) };
9188 o.contents.err = std::ptr::null_mut();
9189 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
9193 result_ok: o.result_ok,
9197 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
9198 fn clone(&self) -> Self {
9200 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9201 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
9204 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9205 err: std::ptr::null_mut()
9211 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9212 /// but with all dynamically-allocated buffers duplicated in new buffers.
9213 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
9215 /// The contents of CResult_InMemorySignerDecodeErrorZ
9216 pub union CResult_InMemorySignerDecodeErrorZPtr {
9217 /// A pointer to the contents in the success state.
9218 /// Reading from this pointer when `result_ok` is not set is undefined.
9219 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
9220 /// A pointer to the contents in the error state.
9221 /// Reading from this pointer when `result_ok` is set is undefined.
9222 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9225 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
9226 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
9227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9228 pub struct CResult_InMemorySignerDecodeErrorZ {
9229 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
9230 /// `err` or `result` depending on the state of `result_ok`.
9231 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
9232 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
9233 pub result_ok: bool,
9236 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9237 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
9238 CResult_InMemorySignerDecodeErrorZ {
9239 contents: CResult_InMemorySignerDecodeErrorZPtr {
9240 result: Box::into_raw(Box::new(o)),
9246 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9247 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
9248 CResult_InMemorySignerDecodeErrorZ {
9249 contents: CResult_InMemorySignerDecodeErrorZPtr {
9250 err: Box::into_raw(Box::new(e)),
9256 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9257 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
9258 impl Drop for CResult_InMemorySignerDecodeErrorZ {
9259 fn drop(&mut self) {
9261 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9262 let _ = unsafe { Box::from_raw(self.contents.result) };
9265 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9266 let _ = unsafe { Box::from_raw(self.contents.err) };
9271 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
9272 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
9273 let contents = if o.result_ok {
9274 let result = unsafe { o.contents.result };
9275 unsafe { o.contents.result = std::ptr::null_mut() };
9276 CResult_InMemorySignerDecodeErrorZPtr { result }
9278 let err = unsafe { o.contents.err };
9279 unsafe { o.contents.err = std::ptr::null_mut(); }
9280 CResult_InMemorySignerDecodeErrorZPtr { err }
9284 result_ok: o.result_ok,
9288 impl Clone for CResult_InMemorySignerDecodeErrorZ {
9289 fn clone(&self) -> Self {
9291 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
9292 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
9295 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
9296 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9302 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9303 /// but with all dynamically-allocated buffers duplicated in new buffers.
9304 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
9306 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
9307 /// This corresponds to std::vector in C++
9308 pub struct CVec_TxOutZ {
9309 /// The elements in the array.
9310 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9311 pub data: *mut crate::c_types::TxOut,
9312 /// The number of elements pointed to by `data`.
9316 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
9317 if self.datalen == 0 { return Vec::new(); }
9318 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9319 self.data = std::ptr::null_mut();
9323 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
9324 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9327 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
9328 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
9329 let datalen = v.len();
9330 let data = Box::into_raw(v.into_boxed_slice());
9331 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9335 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9336 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
9337 impl Drop for CVec_TxOutZ {
9338 fn drop(&mut self) {
9339 if self.datalen == 0 { return; }
9340 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9343 impl Clone for CVec_TxOutZ {
9344 fn clone(&self) -> Self {
9345 let mut res = Vec::new();
9346 if self.datalen == 0 { return Self::from(res); }
9347 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9352 /// The contents of CResult_TransactionNoneZ
9353 pub union CResult_TransactionNoneZPtr {
9354 /// A pointer to the contents in the success state.
9355 /// Reading from this pointer when `result_ok` is not set is undefined.
9356 pub result: *mut crate::c_types::Transaction,
9357 /// Note that this value is always NULL, as there are no contents in the Err variant
9358 pub err: *mut std::ffi::c_void,
9361 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
9362 /// containing a crate::c_types::Transaction on success and a () on failure.
9363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9364 pub struct CResult_TransactionNoneZ {
9365 /// The contents of this CResult_TransactionNoneZ, accessible via either
9366 /// `err` or `result` depending on the state of `result_ok`.
9367 pub contents: CResult_TransactionNoneZPtr,
9368 /// Whether this CResult_TransactionNoneZ represents a success state.
9369 pub result_ok: bool,
9372 /// Creates a new CResult_TransactionNoneZ in the success state.
9373 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
9374 CResult_TransactionNoneZ {
9375 contents: CResult_TransactionNoneZPtr {
9376 result: Box::into_raw(Box::new(o)),
9382 /// Creates a new CResult_TransactionNoneZ in the error state.
9383 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
9384 CResult_TransactionNoneZ {
9385 contents: CResult_TransactionNoneZPtr {
9386 err: std::ptr::null_mut(),
9392 /// Frees any resources used by the CResult_TransactionNoneZ.
9393 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
9394 impl Drop for CResult_TransactionNoneZ {
9395 fn drop(&mut self) {
9397 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9398 let _ = unsafe { Box::from_raw(self.contents.result) };
9404 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
9405 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
9406 let contents = if o.result_ok {
9407 let result = unsafe { o.contents.result };
9408 unsafe { o.contents.result = std::ptr::null_mut() };
9409 CResult_TransactionNoneZPtr { result }
9411 let _ = unsafe { Box::from_raw(o.contents.err) };
9412 o.contents.err = std::ptr::null_mut();
9413 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
9417 result_ok: o.result_ok,
9422 /// The contents of CResult_NoneErrorZ
9423 pub union CResult_NoneErrorZPtr {
9424 /// Note that this value is always NULL, as there are no contents in the OK variant
9425 pub result: *mut std::ffi::c_void,
9426 /// A pointer to the contents in the error state.
9427 /// Reading from this pointer when `result_ok` is set is undefined.
9428 pub err: *mut crate::c_types::IOError,
9431 /// A CResult_NoneErrorZ represents the result of a fallible operation,
9432 /// containing a () on success and a crate::c_types::IOError on failure.
9433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9434 pub struct CResult_NoneErrorZ {
9435 /// The contents of this CResult_NoneErrorZ, accessible via either
9436 /// `err` or `result` depending on the state of `result_ok`.
9437 pub contents: CResult_NoneErrorZPtr,
9438 /// Whether this CResult_NoneErrorZ represents a success state.
9439 pub result_ok: bool,
9442 /// Creates a new CResult_NoneErrorZ in the success state.
9443 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
9444 CResult_NoneErrorZ {
9445 contents: CResult_NoneErrorZPtr {
9446 result: std::ptr::null_mut(),
9452 /// Creates a new CResult_NoneErrorZ in the error state.
9453 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
9454 CResult_NoneErrorZ {
9455 contents: CResult_NoneErrorZPtr {
9456 err: Box::into_raw(Box::new(e)),
9462 /// Frees any resources used by the CResult_NoneErrorZ.
9463 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
9464 impl Drop for CResult_NoneErrorZ {
9465 fn drop(&mut self) {
9468 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9469 let _ = unsafe { Box::from_raw(self.contents.err) };
9474 impl From<crate::c_types::CResultTempl<u8, crate::c_types::IOError>> for CResult_NoneErrorZ {
9475 fn from(mut o: crate::c_types::CResultTempl<u8, crate::c_types::IOError>) -> Self {
9476 let contents = if o.result_ok {
9477 let _ = unsafe { Box::from_raw(o.contents.result) };
9478 o.contents.result = std::ptr::null_mut();
9479 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
9481 let err = unsafe { o.contents.err };
9482 unsafe { o.contents.err = std::ptr::null_mut(); }
9483 CResult_NoneErrorZPtr { err }
9487 result_ok: o.result_ok,
9492 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
9493 /// This corresponds to std::vector in C++
9494 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
9495 /// The elements in the array.
9496 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9497 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9498 /// The number of elements pointed to by `data`.
9501 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
9502 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
9503 if self.datalen == 0 { return Vec::new(); }
9504 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9505 self.data = std::ptr::null_mut();
9509 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
9510 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9513 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
9514 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
9515 let datalen = v.len();
9516 let data = Box::into_raw(v.into_boxed_slice());
9517 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9521 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9522 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
9523 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
9524 fn drop(&mut self) {
9525 if self.datalen == 0 { return; }
9526 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9530 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
9531 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9532 /// A pointer to the contents in the success state.
9533 /// Reading from this pointer when `result_ok` is not set is undefined.
9534 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
9535 /// A pointer to the contents in the error state.
9536 /// Reading from this pointer when `result_ok` is set is undefined.
9537 pub err: *mut crate::c_types::IOError,
9540 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
9541 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
9542 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9543 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9544 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
9545 /// `err` or `result` depending on the state of `result_ok`.
9546 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
9547 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
9548 pub result_ok: bool,
9551 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9552 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9553 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9554 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9555 result: Box::into_raw(Box::new(o)),
9561 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9562 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9563 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9564 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9565 err: Box::into_raw(Box::new(e)),
9571 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9572 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
9573 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9574 fn drop(&mut self) {
9576 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9577 let _ = unsafe { Box::from_raw(self.contents.result) };
9580 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9581 let _ = unsafe { Box::from_raw(self.contents.err) };
9586 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9587 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
9588 let contents = if o.result_ok {
9589 let result = unsafe { o.contents.result };
9590 unsafe { o.contents.result = std::ptr::null_mut() };
9591 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
9593 let err = unsafe { o.contents.err };
9594 unsafe { o.contents.err = std::ptr::null_mut(); }
9595 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
9599 result_ok: o.result_ok,
9604 /// The contents of CResult_NoneAPIErrorZ
9605 pub union CResult_NoneAPIErrorZPtr {
9606 /// Note that this value is always NULL, as there are no contents in the OK variant
9607 pub result: *mut std::ffi::c_void,
9608 /// A pointer to the contents in the error state.
9609 /// Reading from this pointer when `result_ok` is set is undefined.
9610 pub err: *mut crate::lightning::util::errors::APIError,
9613 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
9614 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
9615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9616 pub struct CResult_NoneAPIErrorZ {
9617 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
9618 /// `err` or `result` depending on the state of `result_ok`.
9619 pub contents: CResult_NoneAPIErrorZPtr,
9620 /// Whether this CResult_NoneAPIErrorZ represents a success state.
9621 pub result_ok: bool,
9624 /// Creates a new CResult_NoneAPIErrorZ in the success state.
9625 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
9626 CResult_NoneAPIErrorZ {
9627 contents: CResult_NoneAPIErrorZPtr {
9628 result: std::ptr::null_mut(),
9634 /// Creates a new CResult_NoneAPIErrorZ in the error state.
9635 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
9636 CResult_NoneAPIErrorZ {
9637 contents: CResult_NoneAPIErrorZPtr {
9638 err: Box::into_raw(Box::new(e)),
9644 /// Frees any resources used by the CResult_NoneAPIErrorZ.
9645 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
9646 impl Drop for CResult_NoneAPIErrorZ {
9647 fn drop(&mut self) {
9650 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9651 let _ = unsafe { Box::from_raw(self.contents.err) };
9656 impl From<crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
9657 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>) -> Self {
9658 let contents = if o.result_ok {
9659 let _ = unsafe { Box::from_raw(o.contents.result) };
9660 o.contents.result = std::ptr::null_mut();
9661 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
9663 let err = unsafe { o.contents.err };
9664 unsafe { o.contents.err = std::ptr::null_mut(); }
9665 CResult_NoneAPIErrorZPtr { err }
9669 result_ok: o.result_ok,
9673 impl Clone for CResult_NoneAPIErrorZ {
9674 fn clone(&self) -> Self {
9676 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
9677 result: std::ptr::null_mut()
9680 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
9681 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9687 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9688 /// but with all dynamically-allocated buffers duplicated in new buffers.
9689 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
9691 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
9692 /// This corresponds to std::vector in C++
9693 pub struct CVec_CResult_NoneAPIErrorZZ {
9694 /// The elements in the array.
9695 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9696 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
9697 /// The number of elements pointed to by `data`.
9700 impl CVec_CResult_NoneAPIErrorZZ {
9701 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
9702 if self.datalen == 0 { return Vec::new(); }
9703 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9704 self.data = std::ptr::null_mut();
9708 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
9709 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9712 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
9713 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
9714 let datalen = v.len();
9715 let data = Box::into_raw(v.into_boxed_slice());
9716 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9720 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9721 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
9722 impl Drop for CVec_CResult_NoneAPIErrorZZ {
9723 fn drop(&mut self) {
9724 if self.datalen == 0 { return; }
9725 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9728 impl Clone for CVec_CResult_NoneAPIErrorZZ {
9729 fn clone(&self) -> Self {
9730 let mut res = Vec::new();
9731 if self.datalen == 0 { return Self::from(res); }
9732 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9737 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
9738 /// This corresponds to std::vector in C++
9739 pub struct CVec_APIErrorZ {
9740 /// The elements in the array.
9741 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9742 pub data: *mut crate::lightning::util::errors::APIError,
9743 /// The number of elements pointed to by `data`.
9746 impl CVec_APIErrorZ {
9747 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
9748 if self.datalen == 0 { return Vec::new(); }
9749 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9750 self.data = std::ptr::null_mut();
9754 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
9755 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9758 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
9759 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
9760 let datalen = v.len();
9761 let data = Box::into_raw(v.into_boxed_slice());
9762 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9766 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9767 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
9768 impl Drop for CVec_APIErrorZ {
9769 fn drop(&mut self) {
9770 if self.datalen == 0 { return; }
9771 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9774 impl Clone for CVec_APIErrorZ {
9775 fn clone(&self) -> Self {
9776 let mut res = Vec::new();
9777 if self.datalen == 0 { return Self::from(res); }
9778 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9783 /// The contents of CResult_NonePaymentSendFailureZ
9784 pub union CResult_NonePaymentSendFailureZPtr {
9785 /// Note that this value is always NULL, as there are no contents in the OK variant
9786 pub result: *mut std::ffi::c_void,
9787 /// A pointer to the contents in the error state.
9788 /// Reading from this pointer when `result_ok` is set is undefined.
9789 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
9792 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9793 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
9794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9795 pub struct CResult_NonePaymentSendFailureZ {
9796 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9797 /// `err` or `result` depending on the state of `result_ok`.
9798 pub contents: CResult_NonePaymentSendFailureZPtr,
9799 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
9800 pub result_ok: bool,
9803 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
9804 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
9805 CResult_NonePaymentSendFailureZ {
9806 contents: CResult_NonePaymentSendFailureZPtr {
9807 result: std::ptr::null_mut(),
9813 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
9814 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
9815 CResult_NonePaymentSendFailureZ {
9816 contents: CResult_NonePaymentSendFailureZPtr {
9817 err: Box::into_raw(Box::new(e)),
9823 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9824 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9825 impl Drop for CResult_NonePaymentSendFailureZ {
9826 fn drop(&mut self) {
9829 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9830 let _ = unsafe { Box::from_raw(self.contents.err) };
9835 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9836 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
9837 let contents = if o.result_ok {
9838 let _ = unsafe { Box::from_raw(o.contents.result) };
9839 o.contents.result = std::ptr::null_mut();
9840 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
9842 let err = unsafe { o.contents.err };
9843 unsafe { o.contents.err = std::ptr::null_mut(); }
9844 CResult_NonePaymentSendFailureZPtr { err }
9848 result_ok: o.result_ok,
9852 impl Clone for CResult_NonePaymentSendFailureZ {
9853 fn clone(&self) -> Self {
9855 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9856 result: std::ptr::null_mut()
9859 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9860 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9866 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9867 /// but with all dynamically-allocated buffers duplicated in new buffers.
9868 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
9870 /// A tuple of 2 elements. See the individual fields for the types contained.
9871 pub struct C2Tuple_PaymentHashPaymentSecretZ {
9872 /// The element at position 0
9873 pub a: crate::c_types::ThirtyTwoBytes,
9874 /// The element at position 1
9875 pub b: crate::c_types::ThirtyTwoBytes,
9877 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
9878 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9885 impl C2Tuple_PaymentHashPaymentSecretZ {
9886 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9890 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9892 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
9893 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
9897 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9898 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
9900 /// The contents of CResult_PaymentSecretAPIErrorZ
9901 pub union CResult_PaymentSecretAPIErrorZPtr {
9902 /// A pointer to the contents in the success state.
9903 /// Reading from this pointer when `result_ok` is not set is undefined.
9904 pub result: *mut crate::c_types::ThirtyTwoBytes,
9905 /// A pointer to the contents in the error state.
9906 /// Reading from this pointer when `result_ok` is set is undefined.
9907 pub err: *mut crate::lightning::util::errors::APIError,
9910 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9911 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9913 pub struct CResult_PaymentSecretAPIErrorZ {
9914 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9915 /// `err` or `result` depending on the state of `result_ok`.
9916 pub contents: CResult_PaymentSecretAPIErrorZPtr,
9917 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9918 pub result_ok: bool,
9921 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9922 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9923 CResult_PaymentSecretAPIErrorZ {
9924 contents: CResult_PaymentSecretAPIErrorZPtr {
9925 result: Box::into_raw(Box::new(o)),
9931 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9932 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9933 CResult_PaymentSecretAPIErrorZ {
9934 contents: CResult_PaymentSecretAPIErrorZPtr {
9935 err: Box::into_raw(Box::new(e)),
9941 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9942 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9943 impl Drop for CResult_PaymentSecretAPIErrorZ {
9944 fn drop(&mut self) {
9946 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9947 let _ = unsafe { Box::from_raw(self.contents.result) };
9950 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9951 let _ = unsafe { Box::from_raw(self.contents.err) };
9956 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9957 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9958 let contents = if o.result_ok {
9959 let result = unsafe { o.contents.result };
9960 unsafe { o.contents.result = std::ptr::null_mut() };
9961 CResult_PaymentSecretAPIErrorZPtr { result }
9963 let err = unsafe { o.contents.err };
9964 unsafe { o.contents.err = std::ptr::null_mut(); }
9965 CResult_PaymentSecretAPIErrorZPtr { err }
9969 result_ok: o.result_ok,
9974 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9975 /// This corresponds to std::vector in C++
9976 pub struct CVec_ChannelMonitorZ {
9977 /// The elements in the array.
9978 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9979 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9980 /// The number of elements pointed to by `data`.
9983 impl CVec_ChannelMonitorZ {
9984 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9985 if self.datalen == 0 { return Vec::new(); }
9986 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9987 self.data = std::ptr::null_mut();
9991 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9992 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9995 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9996 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9997 let datalen = v.len();
9998 let data = Box::into_raw(v.into_boxed_slice());
9999 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10003 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10004 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10005 impl Drop for CVec_ChannelMonitorZ {
10006 fn drop(&mut self) {
10007 if self.datalen == 0 { return; }
10008 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10012 /// A tuple of 2 elements. See the individual fields for the types contained.
10013 pub struct C2Tuple_BlockHashChannelManagerZ {
10014 /// The element at position 0
10015 pub a: crate::c_types::ThirtyTwoBytes,
10016 /// The element at position 1
10017 pub b: crate::lightning::ln::channelmanager::ChannelManager,
10019 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10020 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10027 impl C2Tuple_BlockHashChannelManagerZ {
10028 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10032 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10034 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10035 C2Tuple_BlockHashChannelManagerZ { a, b, }
10039 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10040 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10042 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10043 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10044 /// A pointer to the contents in the success state.
10045 /// Reading from this pointer when `result_ok` is not set is undefined.
10046 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10047 /// A pointer to the contents in the error state.
10048 /// Reading from this pointer when `result_ok` is set is undefined.
10049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10052 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10053 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10055 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10056 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10057 /// `err` or `result` depending on the state of `result_ok`.
10058 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10059 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10060 pub result_ok: bool,
10063 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10064 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10065 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10066 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10067 result: Box::into_raw(Box::new(o)),
10073 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10074 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10075 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10076 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10077 err: Box::into_raw(Box::new(e)),
10083 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10084 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10085 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10086 fn drop(&mut self) {
10087 if self.result_ok {
10088 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10089 let _ = unsafe { Box::from_raw(self.contents.result) };
10092 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10093 let _ = unsafe { Box::from_raw(self.contents.err) };
10098 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10099 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10100 let contents = if o.result_ok {
10101 let result = unsafe { o.contents.result };
10102 unsafe { o.contents.result = std::ptr::null_mut() };
10103 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10105 let err = unsafe { o.contents.err };
10106 unsafe { o.contents.err = std::ptr::null_mut(); }
10107 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10111 result_ok: o.result_ok,